DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Chara has posted 50 posts at DZone. View Full User Profile

Media Code in HTML5

  • submit to reddit
<!-- source: -->
<video poster="images/preview.png" width="800" height="600" controls="controls" preload="none"> 
  <source src="media/my_video.mp4" type="video/mp4"></source> 
  <source src="media/my_video.webm" type="video/webm"></source> 
  <source src="media/my_video.ogg" type="video/ogg"></source>
<audio controls="controls" preload="none">
  <source src="audio/my_music.ogg" type="audio/ogg">
  <source src="audio/my_music.mp3" type="audio/mpeg">

This example is a basic design structure for loading multiple video and audio formats for universal work of media content on your page.