Srim
Srim

Reputation: 547

video tag of html5

I am familiar with html4 but not in html5. I am starting to learn. But I am sticking in video and audio tags. for video tag I have written like:

<video width="320" height="240" controls="controls" style="border:2px solid #ccc;">
   <source src="Wildlife.mp4" type="video/mp4" />
   <source src="Wildlife.wmv" type="video/wmv" />
   Your browser does not support the video tag.
  </video>

where as code for audio tag is like:

<audio controls="controls">
    <source src="Kalimba.ogg" type="audio/ogg" />
    <source src="Kalimba.MP3" type="audio/mpeg" />
    Your browser does not support the audio element.
   </audio>

the video file "Wildlife.wmv" and audio file "Kalimba.MP3" are on the same folder where the above html file is present. Also I confess that these types of code I got from http://www.w3schools.com/html5/html5_video.asp though I did not understand what is the need for writing source tag twice with different extensions.

Upvotes: 2

Views: 760

Answers (1)

Madara&#39;s Ghost
Madara&#39;s Ghost

Reputation: 175078

Well, it's for fallback, webkit browsers only support a certain type of files, while gecko based browsers (like Firefox) only support a different kind. So it's there to accommodate the difference between the browsers and allow all of them to display the file corretly.

If I may suggest, don't go to w3schools for information. It's a generally bad and misleading site.

Upvotes: 0

Related Questions