Html 单击时,视频不会自动播放

Html 单击时,视频不会自动播放,html,html5-video,fancybox-2,video.js,Html,Html5 Video,Fancybox 2,Video.js,由于某些原因,我的视频在单击时不会自动播放。我已将我的视频元素设置为: <video id="epsilon_launch" class="video-js vjs-default-skin" preload="auto" data-setup="{}" width="920" height="518" controls autoplay> <source src="video/epsilon_launch.mp4" type="video/mp4"> </vide

由于某些原因,我的视频在单击时不会自动播放。我已将我的视频元素设置为:

<video id="epsilon_launch" class="video-js vjs-default-skin" preload="auto" data-setup="{}" width="920" height="518" controls autoplay>
<source src="video/epsilon_launch.mp4" type="video/mp4">
</video>

当使用IE8时,它会自动正确显示(非HTML5浏览器的swf回退)


var myVideo=document.getElementById(“epsilon_启动”);
myVideo.play();

试试这个

我会这样做的

$("a#videolink").fancybox({
    frameWidth: 920,
    frameHeight: 518,
    padding: 0,
    scrolling: 'no',
    afterShow: function() { _V_(this.href.replace('#','')).play() }
});
this.href
中,这是对链接的引用,因此抓取href属性并删除
#
将为您提供视频的id。使用此方法,您可以使用V方法获取对播放器的引用,并告诉它播放


仅供参考:您使用的是一个相当旧的video.js版本

看看这篇文章——可能会有所启发:谢谢您的提示。不幸的是,我不知道如何在我的代码中实现这种变通方法。如果你使用
数据设置='{“autoplay”:true}'
而不是
autoplay
,它能工作吗?看起来它不能:(伙计们,它可以在我办公室的电脑上工作,但不能在家里的电脑上工作。不管怎样,这都很重要。
$("a#videolink").fancybox({
    frameWidth: 920,
    frameHeight: 518,
    padding: 0,
    scrolling: 'no',
    afterShow: function() { _V_(this.href.replace('#','')).play() }
});