chrome html5视频在一两秒钟后停止自动播放 [英] chrome html5 video stops autoplay after a second or two
本文介绍了chrome html5视频在一两秒钟后停止自动播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个自动播放的视频,该视频在除Chrome之外的所有浏览器上都可以正常运行,而Chrome显然已禁用了自动播放的视频.我已经尝试了一些解决方法,但是现在它只播放1-2秒,然后完全停止.
I've got an autoplaying video which works well on all browsers, except Chrome - which has apparently disabled autoplay video. I've tried some work arounds, but now it just plays for 1-2 seconds and stops entirely.
这是我的代码:
<video id="introduction-video" preload="auto" playsinline autoplay muted loop volume="0" poster="/images/videos/video-background.png" width="100%" height="100%">
<source src="/images/videos/Tasman10seconds.mp4" type="video/mp4">
<source src="/images/videos/Tasman10seconds.webm" type="video/webm">
Sorry, your browser does not support HTML5 video.
</video>
<script>$(window).on('load',function(){$('#introduction-video').get(0).play();});</script>
您可以在此处进行检查:
And you can check it here:
http://taslogistics.website.2018.360southclients.net:8080/
任何帮助将不胜感激!
推荐答案
对于其他遇到此问题的人来说,这对我有用.
For anyone else having this issue, this worked for me..
$(window).bind('load',function(){
'use strict';
$('#introduction-video').trigger('play');
});
这篇关于chrome html5视频在一两秒钟后停止自动播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文