sindresorhus / screenfull

Simple wrapper for cross-browser usage of the JavaScript Fullscreen API
https://sindresorhus.com/screenfull
MIT License
7.06k stars 698 forks source link

can't maximize a video in a video-tag, or a Youtube video that is created by code #71

Closed gidmeister2 closed 9 years ago

gidmeister2 commented 9 years ago

I tried maximizing a videotag with your library as follows: first I made an element in the page: < video id="videotag" ....etc > I had the following javascript var playerElement; if (slideshow.youtube || slideshow.vimeo) { playerElement= $("#diviframe"); } else { playerElement= $("#videotag"); } if (screenfull.enabled) { screenfull.request(playerElement); return; } I used Internet Explorer to test it. It crashed in the following code of yours: var screenfull = { request: function (elem) { var request = fn.requestFullscreen;

        elem = elem || document.documentElement;

        // Work around Safari 5.1 bug: reports support for
        // keyboard in fullscreen even though it doesn't.
        // Browser sniffing, since the alternative with
        // setTimeout is even worse.
        if (/5\.1[\.\d]* Safari/.test(navigator.userAgent)) {
            elem[request]();
        } else {
            elem[request](keyboardAllowed && Element.ALLOW_KEYBOARD_INPUT);
        }
    },

So I have three questions:

  1. Assuming I have a video tag (it is in a table), how to I make it full screen with your library
  2. Assuming I have an iframe that contains a youtube video - how do I make it full screen
  3. Suppose that the youtube iframe is created with javascript (the Youtube javascript api has a function that is called as " myplayer = new YT.player(.....) How can this iframe be maximized? Thanks in advance. Gid
sindresorhus commented 9 years ago

http://stackoverflow.com/questions/ask

Juburin commented 9 years ago
if (screenfull.enabled) {
    screenfull.request(playerElement[0]);
    return;
}

Should do the trick.