如何在youtube iframe上禁用全屏?

时间:2016-11-16 21:10:09

标签: iframe youtube youtube-api html5-video embed

我有一个div容器和iframe里面。我指定width = 200和height = 200。 当我点击全屏时,视频变得模糊,质量非常差。所以,我想知道是否可以在youtube iframe上禁用全屏。

5 个答案:

答案 0 :(得分:1)

我在我的网址末尾使用了?controls = 0,它解决了问题。

答案 1 :(得分:1)

使用不带allowFullscreen的iframe标记来禁用播放器上的按钮,例如:

<iframe src="https://www.youtube.com/embed/12345"></iframe>

要允许全屏,只需添加allowFullscreen:

<iframe allowfullscreen="0" src="https://www.youtube.com/embed/@(item.VideoUrl)"></iframe>

答案 2 :(得分:1)

&#34;我在网址末尾使用?controls=0并解决了问题。&#34;

您的回答并不能解决问题,您也可以全屏切换双击视频。我试过了allowfullscreen="0",也没有用。

同样适用于?showinfo=0;也没有用。

?showinfo=0仅在您更改链接时才有效:

https://www.youtube.com/embed/Di2KMatiGAM?controls=0&showinfo=0

为:

    https://www.youtube-nocookie.com/embed/Di2KMatiGAM?controls=0&showinfo=0

答案 3 :(得分:1)

当你在youtube上有视频时,你可以分享它。它还会显示一个嵌入它的选项。

您的代码中可能有<iframe></iframe>

我看起来像这样:

<div class="IFR" alt="-">
    <iframe width="560" height="315" src="https://www.youtube.com/embed/AdfFnTt2UT0 rel=0&amp;controls=1&amp;showinfo=0" frameborder="0" allow="autoplay; encrypted-media" donotallowfullscreen>
        <p>
            Your browser does not support Iframes <br>
            I suggest that you use Google Chrome or FireFox
        </p>
    </iframe>
</div>

这里重要的是&#34; donotallowfullscreen&#34;。 如果你把它设置为&#34; allowfullscreen&#34;你将能够使用全屏。

TLDR:在您的YT视频所在的Iframe标记中,添加&#34; donotallowfullscreen&#34;在末尾。及其固定的

答案 4 :(得分:0)

        <iframe title="video player" src={videoSrc} allowfullscreen="0"/>

React- youtube API的全屏修复