Cross-Browser HTML5 Video With Flash or Silverlight Fall-back

/ Published in: HTML
Save to your folder(s)

Until recently, playing video files in a web page was notoriously complicated. The user requires a Flash or Silverlight plug-in and even the simplest HTML is a confusing mess.

Few HTML5 features excite developers more than native audio and video. The and tags allow you to play media files in an HTML5-aware browser without a plug-in. The elements also become part of the DOM so you can create your own player controls, add captions and synchronize JavaScript events with media playback. As a bonus, the basic HTML5 code is far easier to understand.

Copy this code and paste it in your HTML
  1. <video width="320" height="240">
  2. <source src="myvideo.mp4" type="video/mp4" />
  3. <source src="myvideo.ogv" type="video/ogg" />
  4. <source src="myvideo.webm" type="video/webm" />
  5. <p>Sorry, your browser cannot play this video.</p>
  6. <img src="videofail.png" />
  7. </video>


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.