Fancybox Chrome自动播放视频问题

时间:2012-02-16 20:38:23

标签: jquery fancybox html5-video

我正在使用Fancybox作为灯箱。我在外部html文档中设置了视频,并在从主文档中单击链接时加载到Fancybox中。问题是Fancybox在某种程度上阻止了Chrome中的“自动播放”。 Firefox似乎工作正常。

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>

感谢大家的帮助。

1 个答案:

答案 0 :(得分:0)

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

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