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');
});