Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/473.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 是否可以在Vimeo播放器(Froogaloop)中打开和关闭视频全屏?_Javascript_Fullscreen_Vimeo_Froogaloop - Fatal编程技术网

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

Javascript 是否可以在Vimeo播放器(Froogaloop)中打开和关闭视频全屏?,javascript,fullscreen,vimeo,froogaloop,Javascript,Fullscreen,Vimeo,Froogaloop,我正在使用Vimeo API和 我需要在播放器完成活动后关闭全屏视频模式。我知道如何完成,但有可能从全屏切换吗 下面是froogaloop播放器示例的链接-jsfiddle.net/bdougherty/hfwy/light/找到了答案- 跨浏览器解决方案 function toggleFullScreen() { if (!document.fullscreenElement && // alternative standard method !docum

我正在使用Vimeo API和 我需要在播放器完成活动后关闭全屏视频模式。我知道如何完成,但有可能从全屏切换吗

下面是froogaloop播放器示例的链接-jsfiddle.net/bdougherty/hfwy/light/

找到了答案-

跨浏览器解决方案

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

这可以用于关闭全屏,但不清楚是否可以或如何使用它来打开全屏。另外,您有多大信心它可以跨浏览器工作,尤其是在Vimeo使用Flash播放器而不是HTML 5播放器的浏览器中工作?你的回答并没有让我相信这会在任何地方都有效。Froogaloopelise.FullScreenAPI提供了一个稍微不同的解决方案,但我不确定它是否是跨设备兼容的。