Youtube iframe api:“onReady"、“onStateChange"未在 IE 8 中触发 [英] Youtube iframe api: 'onReady', 'onStateChange' not firing in IE 8

查看:21
本文介绍了Youtube iframe api:“onReady"、“onStateChange"未在 IE 8 中触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在 IE 8 中检查我的 youtube 播放器,并注意到onReady"、onStateChange"事件没有触发.正在调用 initPlayer 方法并播放视频,但未触发事件.

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.

在 Safari、Firefox Mac、FireFox Win 上按预期工作.

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

我在这里遗漏了什么吗?

Am I missing something here?

相关代码如下:

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")}
      }
   });

},

/* [...] */

/* [...] */

}

推荐答案

这是 YouTube api 代码中的一个旧错误.此时应该一切正常.

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

这篇关于Youtube iframe api:“onReady"、“onStateChange"未在 IE 8 中触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆