javascriptfullscreenvimeofroogaloop

Is it possible to switch on and off video fullscreen in Vimeo Player (Froogaloop)?


I'm using Vimeo API and I need to close fullscreen video mode after player "finish" event. And I know how to catch "finish", but is it possible to switch from fullscreen?

here is link to froogaloop player example - jsfiddle.net/bdougherty/HfwWY/light/


Solution

  • found the answer - https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode

    cross-browser solution

    function toggleFullScreen() {
      if (!document.fullscreenElement &&    // alternative standard method
          !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) {  // current working methods
        if (document.documentElement.requestFullscreen) {
          document.documentElement.requestFullscreen();
        } else if (document.documentElement.msRequestFullscreen) {
          document.documentElement.msRequestFullscreen();
        } else if (document.documentElement.mozRequestFullScreen) {
          document.documentElement.mozRequestFullScreen();
        } else if (document.documentElement.webkitRequestFullscreen) {
          document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
        }
      } else {
        if (document.exitFullscreen) {
          document.exitFullscreen();
        } else if (document.msExitFullscreen) {
          document.msExitFullscreen();
        } else if (document.mozCancelFullScreen) {
          document.mozCancelFullScreen();
        } else if (document.webkitExitFullscreen) {
          document.webkitExitFullscreen();
        }
      }
    }