仅在Chrome开发工具打开时加载mp4视频 [英] mp4 video only loads when chrome dev tools are open
本文介绍了仅在Chrome开发工具打开时加载mp4视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我为div设置的视频仅在刷新页面并且chrome开发工具打开时才开始播放.
The video i have set for background of the div will only start playing when i refresh the page and the chrome dev tools are open.
html:
<div id="videoDiv">
<div id="videoBlock">
<img src="" id="vidSub">
<video preload="preload" id="vid1" autoplay="autoplay" loop="loop">
<source src="images/solPromo.mp4" type="video/mp4"></source>
</video>
css:
#vid1 {
display: none;
}
#vidSub {
display:block;
width:100%;
height:auto;
max-width:100%;
}
@media only screen and (min-width: 992px) {
#vid1 {
display: block;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding-top: 480px;
z-index: 1;
}
#vidSub {
display: none;
}
}
#videoDiv {
width: 100%;
max-width:992px;
margin:auto;
display:block;
position: relative;
z-index: 2;
background: transparent;
}
我的想法是使用z-index,但是我都将它们都切换了,并且都没有打开开发工具就对视频的加载没有任何影响
my thought was with the z-index but i have switched them both and neither had any effect on the loading of the video w/o the dev tools opened
推荐答案
This is not so much related to dev tools, but to new Chrome browser "Video Autoplay Policy" changes. Chrome stopped autoplaying unmuted videos.
这篇关于仅在Chrome开发工具打开时加载mp4视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文