是否可以在Vimeo Player(Froogaloop)中打开和关闭全屏视频?

时间:2014-05-21 09:28:53

标签: javascript fullscreen vimeo froogaloop

我正在使用 Vimeo API 和 在玩家"完成"之后我需要关闭全屏视频模式事件。我知道如何抓住"完成",但是可以从全屏切换吗?

这里是froogaloop播放器示例的链接 - jsfiddle.net/bdougherty/HfwWY/light /

1 个答案:

答案 0 :(得分:-1)

找到答案 - https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode

跨浏览器解决方案

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