Jizbo Jonez
Jizbo Jonez

Reputation: 1290

Is it necessary to specify codecs in HTML5 video?

Is it necessary to specify codecs like so in html5 video :

<video id="movie" width="320" height="240" preload controls>
<source src="pr6.webm" type="video/webm; codecs=vp8,vorbis" />
<source src="pr6.ogv" type="video/ogg; codecs=theora,vorbis" />
<source src="pr6.mp4" />
</video>

Or is it ok to simply do the following :

<video id="movie" width="320" height="240" preload controls>
<source src="pr6.webm" type="video/webm" />
<source src="pr6.ogv" type="video/ogg" />
<source src="pr6.mp4" />
</video>

The last method seems to work fine in browsers, what is the benefit of the first method? This info is taken from http://diveintohtml5.info/video.html which also should have the mp4 video first in the list for iDevices.

Upvotes: 3

Views: 2703

Answers (3)

PraJen
PraJen

Reputation: 606

It provides security for cross-browser sniffing when it decodes.

Wikipedia page

Upvotes: -1

Mauricio
Mauricio

Reputation: 3089

No! You just have to make sure to use the supported codecs for the browsers in which your page will be rendered. The browser will ignore the ones it doesn't understand till finds the codec it understands.

Upvotes: 3

Mr. Alien
Mr. Alien

Reputation: 157324

Straight from MDN, codecs help browsers make more intelligent decisions, but it's optional

Source

Upvotes: 3

Related Questions