【问题标题】:Is it possible to switch on and off video fullscreen in Vimeo Player (Froogaloop)?是否可以在 Vimeo Player (Froogaloop) 中打开和关闭视频全屏?
【发布时间】:2014-07-09 20:38:27
【问题描述】:

我正在使用 Vimeo API 并且 我需要在播放器“完成”事件后关闭全屏视频模式。而且我知道如何捕捉“完成”,但是可以从全屏切换吗?

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

【问题讨论】:

标签: javascript fullscreen vimeo froogaloop


【解决方案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();
    }
  }
}

【讨论】:

  • 这适用于关闭关闭全屏,但尚不清楚它是否或如何用于打开它。此外,您对这适用于跨浏览器有多大信心 - 特别是它在 Vimeo 使用 Flash Player 而不是 HTML 5 播放器的浏览器中适用?你的回答并没有激发我对这将在任何地方都有效的信心。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-08-25
相关资源
最近更新 更多