Youtube iframe API: Differentiate "playing because click" versus "playing because playVideo()" -


a youtube player has handler onstatechange event:

function onplayerready(event) {     if (event.data == yt.playerstate.playing) {         if (event.something) {             console.log("the player playing because user clicked 'play' button")         } else {             console.log("the player playing because player.playvideo() called programatically");         }     } } 

question:
there property, something, in object event use determining source of playing state ?

i need differentiate playing state in 2 possible causes:

  • playing because user clicked "play" button
  • playing because code programatically called player.playvideo()

is possible api? if not, ideas on how achieve in elegant manner?

the youtube iframe player api not expose events player controls themselves, , don't think wrapping things in div help, click events don't bubble past iframe. embed chromeless player , construct own player controls bar; way, you'd have full access control buttons , capture click events on them.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -