【问题标题】:How to activate full screen flag in vimeo, youtube video in iframe如何在 vimeo、iframe 中的 youtube 视频中激活全屏标志
【发布时间】:2016-06-13 15:02:45
【问题描述】:

我有一个包含 vimeo 视频的 iframe 如何在该视频中激活全屏标志

这是包含视频的 iframe 的 HTML。

<iframe width="500" height="281" frameborder="0" src="https://player.vimeo.com/video/155984146?color=ececec&amp;title=0&amp;byline=0&amp;portrait=0;"></iframe>

【问题讨论】:

  • 如果有帮助请接受我的回答=)
  • 您的解决方案很好,表明我必须做的事情
  • 请接受我的回答,这是经过我验证的,它正在工作

标签: html iframe youtube vimeo


【解决方案1】:

随便用

 allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"

在你的 iframe 标签下,它会变成这样

<iframe width="500" height="281" src="https://player.vimeo.com/video/155984146" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"> </iframe>

【讨论】:

    【解决方案2】:

    您好,您必须在 iframe 上允许全屏显示。

    只需将 webkitallowfullscreen mozallowfullscreen allowfullscreen 添加到您的 iframe

    <iframe width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen src="https://player.vimeo.com/video/155984146?color=ececec&amp;title=0&amp;byline=0&amp;portrait=0;"></iframe>
    

    【讨论】:

    • 这对我有用,谢谢!注意:如果您使用的是 CodeSandbox,请务必在新窗口中打开进行测试,因为我认为右侧的浏览器也在 iframe 中,因此它无法在 CodeSandbox 编辑器的浏览器中运行。
    猜你喜欢
    • 2016-02-14
    • 2018-12-19
    • 2011-06-11
    • 2015-12-14
    • 1970-01-01
    • 2015-07-05
    • 2014-12-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多