Fancybox Chrome 自动播放视频问题
我使用 Fancybox 作为灯箱。我在外部 html 文档中设置了视频,并在从主文档单击链接时将其加载到 Fancybox 中。问题是 Fancybox 在某种程度上阻止了 Chrome 中的“自动播放”。火狐浏览器似乎工作正常。
From index.html
Fancybox script:
<script type="text/javascript">
$(document).ready(function() {
$(".video").fancybox({
'overlayOpacity': 0.9,
'hideOnContentClick': true
});
}); //ready
</script>
Body code:
<li><a class="video" href="video/healthcarevideo1.html">Smart Outsourcing (HIPPA 5010, EMR)</a></li>
<li><a class="video" href="video/healthcarevideo2.html">Guaranteed Rejection of Claims (HIPPA 5010)</a></li>
-->From healthcarevideo1.html:
<video width="640" height="360" controls autoplay>
<source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" type="video/mp4">
<source src="http://clips.vorwaerts-gmbh.de/VfE.ogv" type="video/ogg"></video>
关于这里可能出现的问题有什么想法吗? 谢谢!
EDIT: JFK, below, is correct. Final code:
<script type="text/javascript">
$(document).ready(function() {
$(".video").fancybox({
'overlayOpacity': 0.9,
'width': 640, //or whatever
'height': 360, //or whatever
'type' : 'iframe',
'scrolling': 'no'
});
}); //ready
</script>
感谢大家的帮助。
I'm using Fancybox as a lightbox. I have videos set up in external html docs and are loaded in the Fancybox when the link is clicked from the main doc. The problem is Fancybox is somehow preventing "autoplay" in Chrome. Firefox seems to be working ok.
From index.html
Fancybox script:
<script type="text/javascript">
$(document).ready(function() {
$(".video").fancybox({
'overlayOpacity': 0.9,
'hideOnContentClick': true
});
}); //ready
</script>
Body code:
<li><a class="video" href="video/healthcarevideo1.html">Smart Outsourcing (HIPPA 5010, EMR)</a></li>
<li><a class="video" href="video/healthcarevideo2.html">Guaranteed Rejection of Claims (HIPPA 5010)</a></li>
-->From healthcarevideo1.html:
<video width="640" height="360" controls autoplay>
<source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" type="video/mp4">
<source src="http://clips.vorwaerts-gmbh.de/VfE.ogv" type="video/ogg"></video>
Any ideas on what the issue may be here?
Thanks!
EDIT: JFK, below, is correct. Final code:
<script type="text/javascript">
$(document).ready(function() {
$(".video").fancybox({
'overlayOpacity': 0.9,
'width': 640, //or whatever
'height': 360, //or whatever
'type' : 'iframe',
'scrolling': 'no'
});
}); //ready
</script>
Thanks everyone for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试在自定义 fancybox 脚本中设置
'type':'iframe'
? (您可能还需要设置宽度
和高度
),例如:Have you try setting
'type':'iframe'
in your custom fancybox script? (you may need to set thewidth
andheight
too) like: