The html5 tutorials

 
About HTML5
Home
Introduction to HTML5
Features of HTML5
Older versions Vs. HTML5
 
Tags  
source
article
aside
audio
canvas
command
datalist
details
embed
figcaption
figure
footer
header
hgroup
keygen
mark
meter
nav
output
progress
ruby
section
summary
time
video
wbr
 

The <source> Tag

The media elements like <audio> and <video> are defined in source tag to specify multiple media resources. This newest tag initiated by HTML5 is denoted by <source> allowing you to specify alternative video and audio files, based on its media type or codec support. The main reason to use source tag is to recognize multiple versions of source media.

Example code:

<video controls>

   <source="video.WMV" type="video/WMV" /> <!-MP4 for Mozilla Firefox -->

   <source="video.ogg" type="video/ogg" /> <!-- Ogg Theora for Google Chrome -->

</video>

With the use of source tag you can now embed video clips and audio tracks in web pages without any need for plug-ins like Flash or Quicktime.

Attributes of Source Tag

Headers value Description
media media query It is actually used to describe the media resource for browsers and helps to decide whether it should be downloaded or not.
scr URL If specified it will assist you in choosing uniform source locator for the web page.
type numeric value It details you about audio stream feature from where it should start playing. In this context, audio will start playing from beginning itself.