Giter Site home page Giter Site logo

Comments (12)

itsmeeudrino avatar itsmeeudrino commented on July 28, 2024

Can't replicate, presence seems to work like expected on Firefox 129.0b6 & PreMiD 2.6.4

from presences.

theusaf avatar theusaf commented on July 28, 2024

Duplicate of #7094

from presences.

dlsf avatar dlsf commented on July 28, 2024

The console output is completely different and I'm not using an external PreMiD software, so no, it's not a duplicate of that 2 year old issue. I can provide logs if it helps.

Can't replicate, presence seems to work like expected on Firefox 129.0b6 & PreMiD 2.6.4

Did you test it on Linux / Arch?

from presences.

dlsf avatar dlsf commented on July 28, 2024

It should also be noted that the YT Music presence is the only one I'm having issues with (Twitch and GitHub work just fine) and that restarting Discord/Firefox/the OS or reinstalling the presence/PreMiD doesn't fix the issue

from presences.

theusaf avatar theusaf commented on July 28, 2024

If there are any relevant logs you can provide, that would be helpful

from presences.

dlsf avatar dlsf commented on July 28, 2024

Output from developer tools console: https://haste.devcord.club/xevabevufi.makefile
More verbose browser console: https://haste.devcord.club/ripagupeji.pl (first few lines are probably from before I refreshed the YTM tab; removed a few lines from unrelated extensions)

I believe there are some TypeErrors in the presence.ts?

from presences.

Slowlife01 avatar Slowlife01 commented on July 28, 2024

Can you see which selector returns null

from presences.

dlsf avatar dlsf commented on July 28, 2024

I noticed that the selector is working once the page has fully loaded, so I tried isolating the issue and found out that it was caused by a browser addon called "Plasma Integration", which aims to add better support for Firefox to the KDE Plasma desktop environment. This means that this issue is technically resolved, and I apologize for not doing this from the start.

However, the selector document.querySelector('ytmusic-player-bar[slot="player-bar"]') still appears to be null when the page is refreshed, and another error, which is also included in the logs above, popped up: TypeError: n is undefined in line 539 (timestampFromFormat() method in PreMiD's Presence.ts [not the YouTube Music presence.ts file]).

At the very least, it doesn't display any timestamps on my YouTube Music presence even though timestamps are enabled in the presence settings, but I suppose this is a different issue and I can't confirm if it's directly related to the error message mentioned above or even a problem with the YouTube Music presence and not PreMiD itself. However, I was able to replicate the issue on a new Firefox installation with only PreMiD installed this time around.

Since this is not directly related to the problem that was initially brought up: if you consider this issue done from your point of view, you're more than welcome to close this. However, I would much appreciate further assistance.

from presences.

itsmeeudrino avatar itsmeeudrino commented on July 28, 2024

The KDE extension seems to be overwriting the global mediaSession 's playbackState property

which the presence uses to determine whether a song is loaded or not.

The YT Music presence expects playbackState to be either playing or paused when a song is loaded, which the plasma extension overrides to always be none

for reproduction, go to a song's page on YT music, after the song is loaded, navigator.mediaSession.playbackState should be equal to "playing" or "paused".

then do the same with the plasma extension enabled, playbackState should be equal to "none".

note: make sure the script is running in the PreMiD extenson scope

from presences.

dlsf avatar dlsf commented on July 28, 2024

@itsmeeudrino That makes sense, thank you. I wonder why they overwrite this value…

Do you also have an idea what could prevent the presence's timestamps from showing up, by any chance?

from presences.

itsmeeudrino avatar itsmeeudrino commented on July 28, 2024

Do you also have an idea what could prevent the presence's timestamps from showing up, by any chance?

if you're using Watching or Listening statuses, timestamps don't show up on desktop (app or web) which i believe is a bug in discord because it shows up as expected on mobile.

i also noticed that YT Music presence errors out in updateSongTimestamps while the player is loading (querying #left-controls > span), however once the player is loaded the presence should be able to read timestamps.

function updateSongTimestamps(useTimeLeft: boolean) {
const element = document
.querySelector<HTMLSpanElement>("#left-controls > span")
.textContent.trim()
.split(" / "),
[currTimes, totalTimes] = element;
if (useTimeLeft) {
mediaTimestamps = presence.getTimestamps(
presence.timestampFromFormat(currTimes),
presence.timestampFromFormat(totalTimes)
);
} else {
mediaTimestamps = [
Date.now() / 1000 - presence.timestampFromFormat(currTimes),
null,
];
}
}

from presences.

dlsf avatar dlsf commented on July 28, 2024

Oh wow, you're right, it displays them on mobile. What a weird issue, from a DE browser extension problem to a Discord bug... Well, this explains everything, thank you! :)

from presences.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.