Chrome video autoplay

前端 未结 6 1596
鱼传尺愫
鱼传尺愫 2021-01-19 23:06

Following Chrome & Firefox\'s recent update autoplay videos are no longer supported - I\'ve tried to add some code to play this on startup but it doesn\'t seem to work?<

6条回答
  •  无人及你
    2021-01-19 23:34

    1. Add allow="autoplay;" to your iframe like this

      This one does autoplay and loop. 4. Set your video size using css, f.e. width: 100%. 5. Now you don't want to have the black frame around the video, so let's resize the iframe, let's make the height proportional to width. In my case the video is 1920x1080px:

      
      

      My video is playing in loop as page's background. I disabled mouse events like this (in your CSS styles):

      #background-video {
        pointer-events: none;
      }
      

      Let me know if I missed something, I will update these instructions!

提交回复
热议问题