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