Thursday , August 16 2018
Home / Web Technologies / HTML5 / Lesson 8:HTML5 VIDEO Tag

Lesson 8:HTML5 VIDEO Tag

HTML5 VIDEO:

Many modern websites show videos. HTML5 provides a standard for showing them.

Video on the Web
Until now, there has not been a standard for showing a video/movie on a web page. Today, most videos are shown through a plug-in (like flash). However, different browsers may have different plug-ins.HTML5 defines a new element which specifies a standard way to embed a video/movie on a web page: using e <video> element.

Browser Support
Internet Explorer 9, Firefox, Opera, Chrome, and Safari support the <video> element.
Note: Internet Explorer 8 and earlier versions, do not support the <video> element.

HTML5 Video – How It Works
To show a video in HTML5, this is all you need:
Example

The control attribute adds video controls, like play, pause, and volume. It is also a good idea to always include width and height attributes. If height and width are set, the space required for the video is reserved when the page is loaded. However, without these attributes, the browser does not know the
size of the video, and cannot reserve the appropriate space to it. The effect will be that the page layout will change during loading (while the video loads). You should also insert text content between the <video> and </video> tags for browsers that do not support the <video> element. The <video> element allows multiple <source> elements. <source> elements can link to different video files. The browser will use the first recognized format.

Video Formats and Browser Support
Currently, there are 3 supported video formats for the <video> element: MP4,WebM, and Ogg:

Video Formats and Browser Support
no Browser MP4 WebM Ogg
1 Internet Explorer 9 Yes No No
2 Firefox No Yes Yes
3 Google Chrome Yes Yes Yes
4 Apple Safari Yes No No
4 Opera No Yes Yes
  • MP4 = MPEG 4 files with H264 video codec and AAC audio codec
  • WebM = WebM files with VP8 video codec and Vorbis audio codec
  • Ogg = Ogg files with Theora video codec and Vorbis audio codec

HTML5 <video> – DOM Methods and Properties
HTML5 has DOM methods, properties, and events for the <video> and <audio> elements.
These methods, properties, and events allow you to manipulate <video> and <audio> elements using JavaScript. There are methods for playing, pausing, and loading, for example and there are properties (like duration and volume). There are also DOM events that can notify you when the <video> element begins to play, is paused, is ended, etc. The example below illustrates, in a simple way, how to address a <video> element, read and set properties, and call methods.
HTML5 Video Tags and Description

Video Formats and Browser Support
no Tag Description
1 video Defines a video or movie
2 source Defines multiple media resources for media elements
3 track Defines text tracks in mediaplayers

Examples:

Example1

Example2

Print Friendly, PDF & Email

Give us your valuable feedback

comments

About Murali

Hello everyone I am Software Developer having 3+ years of Experience in Microsoft Technologies and Others. My skills :- Asp.net, C#,Ado.net, SQL SERVER, web services, windows Service,Windows applications,HTML,CSS, JavaScript,JQuery,AnjularJs

Check Also

Lesson 14:HTML5 New Form Input Types Example-2

HTML5 New Form Inputs Example: [crayon-5b74f83363e71815233650/]   Give us your valuable feedback comments