javascript - 在 Twitter Bootrap 中禁用视频自动播放并在模式关闭时停止视频

标签 javascript twitter-bootstrap video

我正在使用 Bootstrap 3 将本地视频嵌入到我的页面

我在模态中使用此代码

    <div class="embed-responsive embed-responsive-16by9">        
    <iframe class="embed-responsive-item" height="300" width="480"        
    src="hunnybunny.mp4"></iframe></div>        

如何防止该视频自动播放?我还希望视频在模态窗口关闭时停止。

最佳答案

我遇到了这个问题并找到了解决方法。将 iframe 放入 html 中,例如: (注意:我想要视频在左侧,所以我将其放在前 7 列的一行中,并且“class = left_vid”也在我的“覆盖”自定义链接样式表中定义)

<div class="row">
        <div class="col-md-7">
           <video controls class= left_vid> <source src="vid.mp4" type="video/mp4">
        This browser does not display this video type </video>
        </div>
        <div class="col-md-5">
           <p> Text stuff </p>
        </div>
</div>

在 style.css 中

.left_vid {
    display:block;
    margin-left:auto;
    margin-right:auto;
    width: 80%;
    height:auto;
 }

关于javascript - 在 Twitter Bootrap 中禁用视频自动播放并在模式关闭时停止视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26988960/

相关文章:

css - 将打印媒体的 Bootstrap 网格从 col-xs 更改为 col-sm

html - 自定义复选框不起作用

javascript - 嵌入视频总是自动播放

javascript - 更改对象的 __proto__ 值是否被认为是不好的做法?

javascript - 无法 GET/blah.html - .ejs 无法加载 html?

html - 如何使用 twitter bootstrap 右对齐元素?

python - 使用 MoviePy 时输出视频中没有音频

javascript - 将 JSON 与 AJAX 和 Python 数据库结合使用

javascript - getComputedStyle 给出 "transparent"而不是实际的背景颜色

video - 什么是好的无损视频编解码器?