The HTML 5 source
element has a src
and a type
attribute, like this:
<source src='url' type='mime/type; codec="codec-name"' />
Where is a complete list of the MIME types for the type attribute, together with their corresponding valid codecs attribute values?
There is a great list of MIME types and their browser support along with the codecs at WHATWG Wiki.
The most common codecs used and supported for HTML5 video are:
So, you can set the <source>
for your video to read:
<source src="video.ogv" type='video/ogg; codecs="theora, vorbis"'>
<source src="video.webm" type='video/webm; codecs="vp8, vorbis"'>
<source src="video.mp4" type='video/mp4; codecs="vc1.42E01E, mp4a.40.2"'>
As you can see, the MP4 is the trickiest, as you have to know which codec you're using and the AVC level for the video stream. The one I list above is a common one, but not the only possible one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With