javascript - youtube iframe api events not firing on IE -
java script code :
var tag = document.createelement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstscripttag = document.getelementsbytagname('script')[0]; firstscripttag.parentnode.insertbefore(tag, firstscripttag); var player; window.onyoutubeiframeapiready=function() { player = new yt.player('video', { events: { 'onready': onplayerready, 'onstatechange': onplayerstatechange } }); } function onplayerready(event) { alert("onplayerready"); } function onplayerstatechange(event) { alert("statechanged"); }
and iframe in html wrote
<iframe id="video" width="560" height="315" src="https://www.youtube.com/embed/che_onjaoau?enablejsapi=1&autohide=1&autoplay=1&controls=0&showinfo=0&playerapiid=ytplayer" frameborder="0" allowfullscreen></iframe>
when run on google chrome or safari code works fine , got alert messages when try on ie nothing happens (using ie11) hope guys have solution have been searching 2 days now.
Comments
Post a Comment