HTML5 VIDEO

HTML5 defines a new element to display <video> a video or movie on a website.

Syntax HTML5 VIDEO

<video width="320" height="240" controls="controls">     <source src="filmName.mp4" type="video/mp4" />     <source src="filmName.ogg" type="video/ogg" />     <source src="filmName.webm" type="video/WebM" />     Your browser does not support HTML5 video </video>

Explanation of the above syntax:

The attributes width and height serve to make the web browser reserve the space needed to display the video. Are optional but is useful to put them.

The attribute controls is to add a bar of basic controls for the video, with functions to stop and play the video, adjust volume, play time, video length, etc.

The controls are displayed at the bottom of the video.

<source> element used to indicate the path and file name you want to play video.

The 3 types of video format available for the web are: MP4, OGG, WEBM

Some web browsers use MP4, OGG use other web browsers and WEBM, so it is convenient to record the video in the 3 possible formats (MP4, OGG, WEBM) and include 3 elements </source> with the name and path of each individual, and be sure that our video will be displayed in any web browser.

You can also include a text before the </video> to display in the event that your browser does not recognize HTML VIDEO.

Optionally, you can also include the element </track> to include subtitles in different languages.

<track src="subtitles_english.vtt" kind="subtitles" srclang="en" label="English"> <track src="subtitles_spanish.vtt" kind="subtitles" srclang="es" label="Spanish">