gpt4 book ai didi

video - iframe Vimeo 全屏按钮未显示

转载 作者:行者123 更新时间:2023-12-04 04:13:55 26 4
gpt4 key购买 nike

出于某种原因,Vimeo iframe 缺少全屏按钮。如果我直接在 HTML 中使用官方嵌入代码,它会起作用,但不是这种方式。

JS:

var iframe = document.createElement("iframe");
var videoid = document.querySelector(".active .video-id");
videoid.setAttribute("src", "allow='autoplay; fullscreen' webkitallowfullscreen mozallowfullscreen allowfullscreen");
iframe.setAttribute("src", "https://player.vimeo.com/video/" + videoid.id + "?autoplay=1&portrait=0&title=0 width='100' height='100' frameborder='0' allow='autoplay; fullscreen' webkitallowfullscreen mozallowfullscreen allowfullscreen");
videoid.appendChild(iframe);

CSS:
    .video-id {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
z-index: -1;
pointer-events: none;
}
.video-id iframe,
.video-id object,
.video-id embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: auto;
}

最佳答案

我在一个老问题中知道这一点,但我今天遇到了类似的问题,我想我有你的答案。
看起来您正在“src”属性中设置 iframe 的所有设置。 “src”应该只包含视频链接。
目前你有:

iframe.setAttribute("src", "https://player.vimeo.com/video/" + videoid.id + "?autoplay=1&portrait=0&title=0 width='100' height='100' frameborder='0' allow='autoplay; fullscreen' webkitallowfullscreen mozallowfullscreen allowfullscreen"); 
应该将其扩展为以下几行:
iframe.setAttribute("src", "https://player.vimeo.com/video/" + videoid.id + "?autoplay=1&portrait=0&title=0");
iframe.setAttribute("width","100");
iframe.setAttribute("height","100");
iframe.setAttribute("frameborder","0");
iframe.setAttribute("allow","autoplay; fullscreen");
iframe.setAttribute("webkitallowfullscreen","");
iframe.setAttribute("mozallowfullscreen","");
iframe.setAttribute("allowfullscreen","");
因为这些设置都是单独的属性,而不是源的一部分。

关于video - iframe Vimeo 全屏按钮未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61112633/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com