1 Minute HTML CSS Part 14 – Videos

HTML VIDEOS

<video
  src="dog.mp4"
  width="405" height="720"
  poster="poster.jpg"
  controls
  loop
  autoplay
  muted>
</video>
  • src Source file.
  • width height Video dimensions.
  • poster Optional, show this image as the poster before the video plays.
  • controls Show the video controls.
  • loop Loop the video when it ends.
  • autoplay Start the video automatically when sufficiently loaded. But take note, this may not always work.
  • muted Mute the video by default.

 

NOTES ON AUTOPLAY

  • The video has to be muted if you want it to play on page load.
  • The video may not autoplay if the user is on a slow network, or using a mobile device.
  • May also not autoplay depending on the user’s preference/security settings.