As you can see on my site http://www2.outofscopes.com/test/index.html
I'm trying to make the youtube API inform me of any event that is in onStateChange by alerting it. using the function below:
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
videoId: '-cSFPIwMEq4',
events: {
'onStateChange': function (event) {
alert(event.data);
}
}
});
}
But both in chrome and firefox(mostly firefox), it alerts only sometimes when reloading the page.
Why would that happen?