0

I am using YouTube's HTML5 API, which works very well, but the JavaScript console keeps displaying this error:

Blocked a frame with origin "http://www.youtube.com" from accessing a frame with origin "http://localhost". Protocols, domains, and ports must match.

My code does contain an "origin" variable, but that doesn't seem to change much:

playerVars: { 'wmode': 'transparent', 'rel':0, 'modestbranding':0,
'autoplay': 1, 'controls': 0, 'showinfo':0, 'origin':'http://localhost'},

Is this error supposed to happen? Do I need to prevent it and how?

This is the whole 'player' code. It seems that the onStateChange event is not being called. There is no console log message.

var t = this;
player = new YT.Player('player', {
             width: '685',
             height: '385',
             videoId: strMovie,
             playerVars: { 'wmode': 'transparent', 'rel':0, 'modestbranding':0, 'autoplay': 1, 'controls': 0, 'showinfo':0, 'origin':'http://projects.eerkmans.nl'},
             events: {
                 'onReady': function(e) {t.onPlayerReady(e)},
                 'onStateChange': function(e) {
                     console.log("state change");
                     t.onPlayerStateChange(e);
                 }
             }
        });
tshepang
  • 12,111
  • 21
  • 91
  • 136
Kokodoko
  • 26,167
  • 33
  • 120
  • 197
  • cross-domain security policy applies. Try to upload it to a web server. – Raptor Jun 13 '13 at 10:28
  • I've uploaded it, and changed the origin parameter to the url of my server. But I still get the same error. It also seems that youtube's "playerStateChange" event is not firing. – Kokodoko Jun 13 '13 at 10:43

0 Answers0