2
votes

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

},

/* [...] */

}

2

2 Answers

2
votes

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

0
votes

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