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.