audio

<audio> element – sound content (audio stream)

Usage: typically used to include an audio stream on a web page. Since different browsers support a specific audio codec, one typically includes reference to multiple codecs (along with some type of fallback – such as Flash or ability to download the audio stream and play in a native media player).

Permitted Content: typically contains a <source> element and zero or more <track> elements.

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

Example code:

<audio src=”PekingMoon.ogg” controls=”controls”>
Your browser does not support the audio element.
</audio>

Example page (opens in a new tab/ window – view source code): http://learning-html5.info/examples/ExampleAudio1.html

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

Common Attributes:

  • autoplay=”autoplay” – automatically begin playback of audio stream as soon as possible.
  • controls=”controls” – expose user interface to controlĀ  playback of audio stream.
  • loop=”loop” – return to the art of the audio stream after reaching the end of the audio stream.
  • preload=”none/metadata/auto” – identify whether optimistic downloading of audio stream is worthwhile
  • src= location of audio stream

Permitted Parent Elements: any element which can contain phrasing or flow elements.

References: http://dev.w3.org/html5/markup/audio.html#audio

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.