我只是在IE8中檢查我的YouTube播放器,並注意到'onReady','onStateChange'事件沒有觸發。正在調用initPlayer方法,視頻播放,但事件不會觸發。Youtube iframe api:'onReady','onStateChange'在IE中沒有觸發8
按照預期在Safari,Firefox Mac,FireFox Win上運行。
我在這裏錯過了什麼嗎?
下面是相關代碼:
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")}
}
});
},
/* [...] */
}