A feature using the YouTube Iframe API has been broken for a while on a little music discovery site I have, and I'm trying to understand why:
spacebar
key.→ Expected: playback should start.
→ Actual: the playpause
function throws TypeError: player.getPlayerState is not a function
when running var playerState = player.getPlayerState()
. And looking at my player object, indeed this method is missing:
What's wrong in my API usage / initialization? It used to work fine, and I think started to fail a few months ago, even though the YouTube Iframe Player API Reference mentions no recent changes to the API. Thanks for the help!
Add
enablejsapi=1
to the iframe 'src' attribute. E.g.:
http://www.youtube.com/embed/videoseries?wmode=opaque&autohide=0&disablekb=1&enablejsapi=1&list="