Skip to content Skip to sidebar Skip to footer

Iframe Has No Defined Request Full Screen Method

I'm trying to have a YouTube video on my web page start in full screen mode. Since the YouTube API doesn't have a full screen call directly, I'm trying to get a YouTube video to st

Solution 1:

Have you tried adding the allowFullScreen="true" attribute to the iframe html? (from: Cant switch to fullscreen mode from an iframe) --- looks like without this set, an iframe can't be made to go full screen (https://developer.mozilla.org/en/docs/Web/HTML/Element/iframe)

Solution 2:

Instead of just selecting the iframe's jQuery object, try selecting the DOM element by appending [0] or .get(0)

functiononPlayerReady(event) {
    var iframe = $('#player')[0];
    ...
}

Also, just in case you were setting custom paremeters to your YouTube player instantiation, make sure that 'fs' is set to 1 instead of 0.

function playIntroVideo() {
    player = new YT.Player('player', {
        videoId: 'M7lc1UVf-VE',
        playerVars: {
          fs: 1
        },
        events: {
        'onReady': onPlayerReady
        }
    });
}

Post a Comment for "Iframe Has No Defined Request Full Screen Method"