开发者

Youtube iframe api: 'onReady', 'onStateChange' not firing in IE 8

I just was checking my youtube player in IE 8 and noticed the 'onReady', 'onStateChange' events are not firing. The initPlayer method is being called and the video plays, but the events are not firing.

Works as expected on Safari, Firefox Mac, FireFox Win.

Am I missing something here?

Here is the relevant code:

MyPlayer.prototype = {

/*   [...]  */


initPlayer: function () {

    var that = this;
    alert("initPlayer: (IE 8 gets this far)");

    this.player = new YT.Player(this.cfg.divTagId, {
        height:  this.cfg.height,
        width:   this.cfg.width,
        videoId: this.cfg.videoId,
        origin:  location.host,
        playerVars: {
           controls: this.cfg.controls, 
           wmode: 'opaque',
          fs:开发者_运维百科 0
       },
       events: {
         'onReady': function (event) {alert("onReady")},
         'onStateChange': function (event) {alert("onChange")}
      }
   });

},

/* [...] */

}


One possible factor: the API won't work properly in IE if you are running it locally - try running your code from an http: path.

Source:

http://groups.google.com/forum/?fromgroups=#!topic/youtube-api-gdata/LV49fIR5Uo0


This was an old bug in the YouTube api code. It should all be working at this point.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜