newgiin / cloudplayer-scrobbler

Chrome plugin for scrobbling from Google Play (music.google.com)
52 stars 15 forks source link

Fix YtMusic is_playing detection - check browser tab title instead of… #46

Closed bulhi closed 3 years ago

bulhi commented 3 years ago

https://github.com/newgiin/cloudplayer-scrobbler/issues/45

After some debugging, I found out playing detection was based on the play button's title: .attr("title") === "Pause" It turns out the title is translated into the user's locale, so it's not "Pause" if the user's default language is not English.

When compared both button states (playing and paused) unfortunately the only difference is in the SVG icon path, no change in CSS classes etc. I didn't want to hardcode that but I noticed YT prepends browser tab title with current song's name when it's playing, so it seems this is the easiest way how to detect this.