Question

What am I doing wrong? The YouTube player replaces the #player element, but onYouTubePlayerReady is never called.

window.onYouTubePlayerReady = function() {
    alert('success!');
    console.log('yt player loaded!', arguments);
}

window.onload = function () {
    swfobject.embedSWF('http://www.youtube.com/v/S57AWoY6zDQ?version=3&enablejsapi=1',
    'player', 800, 600, '8', null, null, 
    { allowScriptAccess: true }, { id: 'myYTplayer' });
};

live code: http://jsfiddle.net/patricklorio/GyMN5/

Was it helpful?

Solution

{ allowScriptAccess: true } should be { allowScriptAccess: 'always' }

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top