Can I turn on and off the full-screen video mode in Vimeo Player (Froogaloop)?

I am using the Vimeo API and I need to close the full-screen video mode after the “complete” player event. And I know how to catch the “finish”, but is it possible to switch from full-screen mode?

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

+4
source share
1 answer

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();
    }
  }
}
-1
source

Source: https://habr.com/ru/post/1541392/


All Articles