T
T
Timofey2019-02-22 07:26:09
css
Timofey, 2019-02-22 07:26:09

On the site, silent video only works when you turn on the control panel in Google, and not immediately. What should I do to make it a background and load immediately?

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
  #video-bg {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
    z-index: 1;
    background: url(bg/daisy-stock-poster.jpg) no-repeat #94a233;
    background-size: cover;
}

#video-bg > video {
    position: absolute;
    top: 0;
    left: 0;
    min-width: 100%; 
    min-height: 100%;
    width: auto;
    height: auto; 
}

 @supports (object-fit: cover) {
     #video-bg > video {
         top: 0;
         left: 0;
         width: 100%;
         height: 100%;
         object-fit: cover;
     }
 }
</style>
</head>
<body>

  <div id="video-bg">
    <video width="100%" height="auto" preload="auto" autoplay="autoplay"
    loop="loop" poster="bg/daisy-stock-poster.jpg" controls="controls">
        <source src="Video88.mp4" type="video/mp4"></source>
        <source src="Video88.webm" type="video/webm"></source>
    </video>
</div>
  
</body>
</html>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sergski, 2019-02-22
@timofeygusevopal

add muted="muted" attribute, without it playback may be blocked

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question