HTML and CSS Reference
In-Depth Information
Note The formnovalidate attribute overrides the form's novalidate attribute if both are set.
Multimedia elements
HTML5 offers two new markup elements that developers can use to play audio and video files from
within webpages without resorting to external plug-ins such as Flash and Silverlight. The entire
infrastructure to play audio and video (including graphical feedback to users) now is provided natively
by the browser.
The audio element
To embed audio content into HTML documents, you use the <audio> element. The syntax is trivial, as
the example below shows:
<audio src="/hello.mp3">
<p>Your browser does not support the audio element.</p>
Optionally, you can incorporate some markup in the body of the <audio> element to be used in
case the browser can't deal successfully with the <audio> element. Next, you'll explore a bit more
about how to embed audio in HTML5 pages.
Using the <audio> element
The <audio> element supports a variety of attributes, as listed in Table 2-2. Of these, the most impor-
tant is src , which you use to point to the location of the actual audio stream.
TABLE 2-2 Attributes of the <audio> element
Indicates that the audio will start playing as soon as the content is available to the
Instructs the browser to display audio controls, such as the play and pause buttons.
Indicates that the audio will automatically restart after it is finished.
Note that the preload attribute is
ignored if the autoplay attribute
is also present.
Instructs the browser on how to load the audio content when the page loads.
Allowed values are none, meaning that no content should be preloaded; auto,
meaning that the entire content should be downloaded when the page loads;
and metadata, meaning that only content metadata should be preloaded on
page display.
Indicates the URL of the audio file, whether local or remote.
Search WWH ::

Custom Search