The js basically looks like this: function onPlayerStateChange(event) { var player = event.target; switch (event.data) { case YT.PlayerState.PLAYING: document.title = '▶' + document.title; break; } }
The js basically looks like this: function onPlayerStateChange(event) { var player = event.target; switch (event.data) { case YT.PlayerState.PLAYING: document.title = '▶' + document.title; break; } }
Edit: This is two different bugs. It means that if you are not playing, it will still look like it is playing and if you play multiple times, you will see the symbol get duplicated.
Edit 2: Code should be like this:
var documentTitle = document.title; function onPlayerStateChange(event) { var player = event.target; switch (event.data) { case YT.PlayerState.PLAYING: document.title = '▶' + documentTitle; break; default: document.title = documentTitle } }
but it assumes that the document title doesn't otherwise change.
And to revise my original code, this is what you could use in the PLAYING statement to prevent multiple play symbols: document.title = "\u25B6" + document.title.replace("\u25B6","");
Notice, too, that I replaced the "▶" with the appropriate javascript encoding.