This is a simple javascript that adds a unicode "▶" to the beginning of html page title. This can be easily coded using the youtube javascript api. Just add the following code when the youtube playstate changes to "YT.PlayerState.PLAYING".
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;
}
}
FYI, if you implement this code for real, you'll need to make sure the symbol doesn't get repeated upon multiple plays and that it gets removed when not playing.
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.
In practice, the youtube api has other cases in that switch expression (ENDED, PAUSED, etc). For those, you would use the following in their case statement: document.title = document.title.replace("\u25B6","");
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.
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; } }