Fancybox Chrome 自动播放视频问题

发布于 2025-01-06 17:43:28 字数 1254 浏览 1 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世界和平 2025-01-13 17:43:28

您是否尝试在自定义 fancybox 脚本中设置 'type':'iframe' ? (您可能还需要设置宽度高度),例如:

$(".video").fancybox({
 'type': 'iframe',
 'width': 660,
 'height': 380,
 'scrolling': 'no',
 'overlayOpacity': 0.9
});

Have you try setting 'type':'iframe' in your custom fancybox script? (you may need to set the width and height too) like:

$(".video").fancybox({
 'type': 'iframe',
 'width': 660,
 'height': 380,
 'scrolling': 'no',
 'overlayOpacity': 0.9
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文