Bootstrap 3 - 响应式 mp4 视频 [英] Bootstrap 3 - Responsive mp4-video

查看:32
本文介绍了Bootstrap 3 - 响应式 mp4 视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在引导站点上找到一个好的解决方案,但我还没有得到答案.我想我不可能是唯一一个为此苦苦挣扎的人,但我找不到任何对我有帮助的东西.

我正在尝试在我的网站上嵌入 mp4 视频.问题是,如果我使用 iframe-tag,我将无法使用自动播放和循环播放.因此,我想用视频标签(或其他支持自动播放和循环的东西)来解决它.之后,我尝试使用对象标签使我的视频响应,但这不起作用.即使我将它放在我的代码中(向您展示),您可以在下面看到:

<object class="embed-responsive-item"><视频自动播放循环><source src="file.mp4"/></视频></对象>

我希望你们中的任何人都可以帮助我解决这个问题.

解决方案

据我所知,您希望在您的网站上嵌入视频:

  • 响应迅速
  • 允许自动播放和循环播放
  • 使用引导程序

这个 Demo Here 就是这样做的.您必须按照 此处的说明 在 object/embed/iframe 标记之外放置另一个嵌入类 - 但您' 也可以使用视频标签而不是对象标签,即使它没有被指定.

<视频自动播放循环类="embed-responsive-item"><source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4"></视频>

I tried to find a good solution on the bootstrap site but I didn't get an answer to this yet. I think I can't be the only one struggling with this, but I couldn't find anything that helped me.

I'm trying to embed an mp4-video on my website. The problem is, that if I use an iframe-tag I can't use autoplay and loop. Because of that I would like to solve it with a video tag (or something else that supports autoplay and loop). After that I tried to make my video responsive with an object-tag but this didn't work. Even though I let it in my code (to show you) which you can see below:

<div align="center">
   <object class="embed-responsive-item">
     <video autoplay loop >
       <source src="file.mp4" />
     </video>
   </object>
 </div>

I hope anyone of you can help me fix this.

解决方案

It is to my understanding that you want to embed a video on your site that:

  • Is responsive
  • Allows both autoplay and loop
  • Uses Bootstrap

This Demo Here does just that. You have to place another embed class outside of the object/embed/iframe tag as per the the instructions here - but you're also able to use a video tag instead of the object tag even though it's not specified.

<div align="center" class="embed-responsive embed-responsive-16by9">
    <video autoplay loop class="embed-responsive-item">
        <source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4">
    </video>
</div>

这篇关于Bootstrap 3 - 响应式 mp4 视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆