blog

Home / DeveloperSection / Blogs / Use Video Player in HTML5

Use Video Player in HTML5

Abhishek Singh 3753 20-Jan-2014
Videos can be embedded in HTML pages with several methods.

Code to add Video player using HTML5

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  <source src="movie.webm" type="video/webm">
  <object data="movie.mp4" width="320" height="240">
    <embed src="movie.swf" width="320" height="240">
  </object> 
</video>

The <embed> tag defines a container for external (non-HTML) content.

The following HTML fragment displays a Flash video embedded in a web page:

<embed src="intro.swf" height="200" width="200">


Problems

  • If the browser does not support Flash, the video will not play
  • iPad and iPhone do not support Flash videos

The HTML5 <video> tag defines a video or movie.

The <video> element works in all modern browsers.

The following example uses the HTML5 <video> tag, which specifies one

MP4 file (for Internet Explorer, Chrome, Firefox 21+, and Safari), and one OGG

file (for older Firefox and Opera). If something fails, it will display a text:

Problems:
  • You must convert your videos to many different formats
  • The <video> element does not work in older browsers

Updated 18-Sep-2014
I am an Junior Software Developer in Loginworks Software Private Ltd.

Leave Comment

Comments

Liked By