Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Duration info for Windows SystemMediaTransportControls incorrect #2621

Open
4 of 5 tasks
Schtenk opened this issue Nov 19, 2024 · 3 comments
Open
4 of 5 tasks
Labels
bug Something isn't working official-youtube-music-issue It's an YouTube's issue (not YTM-Desktop issue)

Comments

@Schtenk
Copy link

Schtenk commented Nov 19, 2024

Preflight Checklist

  • I use the latest version of YouTube Music (Application).
  • I have searched the issue tracker for a bug report that matches the one I want to file, without success.
  • I understand that th-ch/youtube-music has NO affiliation with Google or YouTube

YouTube Music (Application) Version

3.6.2.0

Checklists

What operating system are you using?

Windows

Operating System Version

Windows 11 23H2 22631.4460

What CPU architecture are you using?

x64

Last Known Working YouTube Music (Application) version

No response

Reproduction steps

  1. Listen to multiple tracks in a row without manually changing tracks.

Expected Behavior

Position, StartTime and EndTime in SytemMediaTransportControls to be that of the current playing song/media.

Actual Behavior

Position and EndTime time in minutes seems to increase seconds stays correct.

For example:
first song 3:32
second song 3:41
EndTime in SystemMediaTransportControls 5:41 on the second song

Enabled plugins

  1. Ad Blocker - In Player
  2. API Server - Authorize at first request, no hostname set, no port set
  3. Exponential Volume
  4. In-App Menu
  5. Navigation
  6. Precise Volume - local arrow keys
  7. Taskbar Media Control

Additional Information

Since this seems to be an issue with music.youtube.com both in MSEdge and Firefox I understand that it's unlikely you can do anything about this, but if you can do something that would be highly appreciated.

Thanks in advance for any of your time!

@JellyBrick JellyBrick added official-youtube-music-issue It's an YouTube's issue (not YTM-Desktop issue) bug Something isn't working labels Nov 21, 2024
@jbhannah
Copy link

jbhannah commented Nov 25, 2024

This happens in macOS as well, both in-app and when using the website in a browser, so it's likely an issue in the website code itself.

Screenshot 2024-11-25 at 10 01 29

@1000Delta
Copy link

I found some details about this issue, if the music natually ended and begin play the next one, Youtube Music website will reuse the same HTMLMediaElement (the <video> tag), you can get it from console:

document.querySelector('.video-stream')

And they not reset the state of media element, seems like they only append new audio data slice to the src and continue playing, so the duration and currentTime of media will still increasing, check the progress:

let duration = new Date(document.querySelector('.video-stream').duration*1000);
console.log(duration.getMinutes()+":"+duration.getSeconds()); // 15:40

let currentTime = new Date(document.querySelector('.video-stream').currentTime*1000);
console.log(currentTime.getMinutes()+":"+currentTime.getSeconds()); // 14:38

But if we pressed the next music button, they will create a new <video> tag to replace the old one, with a new src, so the internal state of media element will not as same as the old one, the issue will not happend.


Some solutions:

  • Trigger "next music" once when current music ended, but this may need some time to buffer the next music if in weak network (maybe they do not reset the media element is that they want to buffer the next music earlier, anyway this is a bug about the usage of media API)
  • Debug and hook the internal logic of Youtube Music's js to handle the music switch logic, more complex.

Maybe someone can have better idea to fix this issue.

I also send a feedback of this issue to Google, hope they can fix this ASAP :)

@Schtenk
Copy link
Author

Schtenk commented Dec 10, 2024

Nice find! I did fill in a feedback form to google/youtube about this when I created this issue, it does kinda feels like putting a bottled message in the ocean when doing it so I didn't have much hope :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working official-youtube-music-issue It's an YouTube's issue (not YTM-Desktop issue)
Projects
None yet
Development

No branches or pull requests

4 participants