HTML Video

HTML Video

In the past, embedding a video in a HTML webpage was not an easy task because just like in the case of audio files, there were no standard methods of attaching media files to web documents. You can use the new HTML 5 <video> element to attach video files as shown in the example below. Other methods of attaching media files are still available to developers, but they are not as reliable as using the <video> element.

Embedding YouTube videos

There are many developers who prefer uploading their videos to YouTube first before attaching them to their documents using code.

To show a video in HTML, use the?<video>?element:

 

<video width="500" height="320" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

HTML <video> Autoplay

To start a video automatically use the?autoplay?attribute:

<video width="320" height="240" autoplay>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>

 

Terry White

Terry White is a professional Drupal & WordPress developer, Web developer, Web designer, Software Engineer, and Blogger. He strives for pixel-perfect design, clean robust code, and a user-friendly interface. If you have a project in mind and like his work, feel free to contact him

View all posts by Terry White →