The void HTML <source> element was first introduced in HTML5 and Gecko 1.9.1. It is used to specify multiple media resources for <audio> and <video> elements. Currently, Gecko picks the first <source> element that has an exact MIME type of video/ogg or application/ogg.


Attribute Value Description
src source Required, specifies the address of the media resource.
type MIME type Specifies the MIME type of the resource, optionally with a codecs parameter. See RFC 4281 for information about how to specify codecs. If this attribute isn't specified, the media's type is retrieved from the server and checked to see if the browser can handle it; if it can't be rendered, the next source is checked. If the type attribute is specified, it's compared against the types the browser can play, and if it's not recognized, the server doesn't even get queried; instead, the next <source> element is checked at once.
media media query Specifies the media query of the resource's intended media.

HTML examples:

<video controls>  
   <source src="foo.ogg" type="video/ogg">  
   <source src="foo.mp4">  
   Your browser does not support the <code>video</code> element.  

Multiple <source> elements can be used in order to provide video/audio encoded in different formats for compatibility with different browsers.

<video controls>  
   <source src="foo.ogg" type="video/ogg; codecs=dirac, speex">  
   Your browser does not support the <code>video</code> element.  

Here, it specifies that the video uses the Dirac and Speex codecs. If the browser supports Ogg, but not the specified codecs, the video will not load.

External Links

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.