<source> element – allows for inclusion of multiple media within either <audio> or <video> elements.

Usage: since browser support for various codecs varies widely, we need some means of including different MIME type files for different browsers. For example, some browsers prefer open source codecs like WebM and Theora OGG (Firefox), while other browsers prefer proprietary codecs like MP4 (Safari).

Permitted Content: typically contains the following attributes.

  • src=”location”
  • type=”MIME type” common values are (audio/ogg, audio/mpeg, video/ogg, video/mp4, video/webm)

Tag omission: both start and end tag must be present.

Example code:

<audio controls=”controls”>
<source src=”peking-moon.ogg” type=”audio/ogg” />
<source src=”peking-moon.mp3″ type=”audio/mpeg” />
Example pages (opens in a new tab/ window – view source code):

Default display properties: typically transparent (controls will show).

Permitted Parent Elements: only <audio> or <video> elements.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.