keifufu / WebNowPlaying

WebNowPlaying browser extension. Provides support for browser-based players
MIT License
81 stars 10 forks source link

Apple Music; wrong times #21

Closed pitschka closed 1 year ago

pitschka commented 1 year ago

Hello, first I would like to say that I love your plugin! I have noticed that, while using apple music in a browser, in rainmeter WebNowPlaying shows the wrong lenght of every song For a second its completely correct and then it just adds a seemingly random amount of minutes/seconds In my example the song is exactly 2 minutes long, but for some reason it changes to 5:33 I have tried it in edge and in chrome Can someone please help me fix it? :D Sorry for my english, I am not a native speaker 😅 image

keifufu commented 1 year ago

It's difficult for me to test apple music, it reports the correct duration for me but that's just with the preview.

Could you open the console on apple music and paste the line below into the console and send the result? console.log(document.querySelector("amp-lcd").shadowRoot.querySelector("#playback-progress").max, document.querySelector("audio").duration)

To open the console, you press F12 and go to the Console tab.

pitschka commented 1 year ago

Hi, sorry for the late reply. In the example with the same song (exactly 2 minutes long) it shows 120 332.834601 But when I have the browser in a smaller window (so that it takes less place on the screen) it shows: Uncaught TypeError: Cannot read properties of null (reading 'shadowRoot') at :1:46 (anonym) @ VM3279:1 But even when I just start the song in fullscreen the example player shows a leghth of 5:33

image image

keifufu commented 1 year ago

Hey, what about this: (document.querySelector("amp-lcd") || document.querySelector("amp-footer-player").shadowRoot.querySelector("amp-lcd")).shadowRoot.querySelector("#playback-progress").max

It'll hopefully report the correct length under both circumstances. Also, have you noticed anything else being broken when in a smaller window?

pitschka commented 1 year ago

Hey, I will try it when I am back home, in about 10 hours Am 31.08.2023 um 07:37 schrieb Elaina @.***>: Hey, what about this: (document.querySelector("amp-lcd") || document.querySelector("amp-footer-player").shadowRoot.querySelector("amp-lcd")).shadowRoot.querySelector("#playback-progress").max It'll hopefully report the correct length under both circumstances. Also, have you noticed anything else broken when in a smaller window?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

pitschka commented 1 year ago

Hey, sorry for my late reply again. I just tried it and in the console it always returned the right amount of seconds. So in the example with the 2 minute song. it returned 120, and it didn´t matter how small the window is image

keifufu commented 1 year ago

Good! I'll fix this in the next release soon :tm:

pitschka commented 1 year ago

That sounds great, thanks alot :D