Playing video files in HTML5

Posted by Anantha Narayanan On 12:53 PM No comments

Section 3: How to play video files in HTML5

The sweetest and simplest way to play video files is HTML5.

<video src="videofile.ogg" autoplay poster="posterimage.jpg">
  Sorry, your browser doesn't support embedded videos, 
  but don't worry, you can <a href="videofile.ogg">download 
  it</a>and watch it with your favorite video player!
</video>

Arriving upon a video format and a codec is the complex part of playing a video file. Refer the browser compatibility in MDN before you use this.

Note: the source you are using in src need not be from same server where html5 is residing. This means that you can embed videos from YouTube inside your webpages using this same tag. The advantage is that you can put more controls on your webpage by using JavaScript.

0 comments:

Post a Comment

Recommended Post Slide Out For Blogger