工作在Firefox机器人的背景录影不运作在Chrome

时间:2018-06-08 10:12:38

标签: javascript php html css wordpress

后台视频在Firefox上工作得很好但在Chrome中没有用,任何人都可以告诉我问题我尽力解决这个问题但每次都失败了。但有些时候会自动运行chrome并自行停止。

这是该网站的链接。

2 个答案:

答案 0 :(得分:1)

JQuery 中添加静音,以便在 Chrome

中播放视频
<!-- home banner video -->
        <video id="video"  poster="https://briolaundry.com/wp-content/uploads/2017/05/bg-main.jpg" autoplay loop>
            <!--<source src=""> -->
            <source src="https://briolaundry.com/wp-content/uploads/2017/05/Brio-HomePage-Hero-473358135.webm">
            <source src="https://briolaundry.com/wp-content/uploads/2017/05/home-banner.ogv">
    </video>

JQuery

window.onload = function () {
    var element = document.getElementById('video');
    element.muted = "muted";
}

答案 1 :(得分:1)

试试这个:添加如下所示的参数

<video id="bg_video" playsinline autoplay muted loop controls="controls">

然后用CSS

删除控件
/* This used to work for the parent element of button divs */
/* But it does not work with newer browsers, the below doesn't hide the play button parent div */

*::-webkit-media-controls-panel {
  display: none!important;
  -webkit-appearance: none;
}

/* Old shadow dom for play button */

*::-webkit-media-controls-play-button {
  display: none!important;
  -webkit-appearance: none;
}

/* New shadow dom for play button */

/* This one works! */

*::-webkit-media-controls-start-playback-button {
  display: none!important;
  -webkit-appearance: none;
}