I have a webpage with a full-screen html5 video (width & height 100%) and if i open the webpage, the video does not play. But if i rightclick and then open video in new tab. then the video plays. and if i then reload my webpage then the video plays normal. I thought that was the problem but if i close my webpage and reopen it i have the same problem. Please help?
My code: index.html:
<!DOCTYPE html>
<html lang="en-US">
<head>
<link rel="icon" type="image/png" href="./assets/loadingSim_icon64x64.png" />
<script src="https://kit.fontawesome.com/3a05f4171b.js" crossorigin="anonymous"></script>
<title>Loading Simulator</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="intro.css">
<script src="intro.js"></script>
</head><body onmousedown='return false' onselectstart='return false' style="cursor: none;">
<!--<img src="./assets/loadingSimIntro.gif" width="100%" height="100%">-->
<video autoplay class="vid" preload="auto">
<source src="./assets/bpLoadingSimIntroFull.mp4" type="video/mp4">
</video>
</center>
</body>
</html>
intro.css:
@import url('https://fonts.googleapis.com/css2?family=Varela+Round&display=swap');
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
font-family: 'Varela Round', sans-serif;
}
body {
margin:0px;
/*background-image: url('/assets/loadingSimIntro.gif');*/
background-size: cover;
overflow: hidden;
}
.vid{
/*position: fixed;
min-width: 100%;
min-height: 100%;
*/
-webkit-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
-o-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
position: absolute;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
}