4

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/

Stepan Suvorov
  • 25,118
  • 26
  • 108
  • 176
  • Froogaloopelise.FullScreenAPI offers a slightly different solution, but I'm not sure it is cross-device compatible. https://github.com/jasperlinsen/froogaloopelise/blob/master/src/vimeo.froogaloopelise.js – nu everest Dec 16 '15 at 21:35

1 Answers1

-1

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();
    }
  }
}
Stepan Suvorov
  • 25,118
  • 26
  • 108
  • 176
  • This works for switching *off* fullscreen, but it's not clear if or how it can be used for switching it on. Also, how confident are you that this works cross-browser - and in particular, that it works in browsers where Vimeo uses the Flash Player instead of the HTML 5 player? Your answer doesn't inspire confidence in me that this will work everywhere. – Mark Amery Apr 05 '15 at 23:14