HTML Element: <audio>
[this page | pdf | back links]
The
HTML <audio> element is used to
define and play sound, such as music or other audio streams. Supported file
formats include MP3 (nearly all browsers), Wav (not Internet Explorer) and Ogg
(some browsers). It is new in HTML 5.
If the browser does not
support <audio> elements
then any text between the <audio>
and </audio> tags will be
displayed.
The attributes
it can take (in addition to HTML global
attributes and HTML
event attributes) include:
Attribute
|
Description
|
More
|
autoplay
|
Specifies whether media
should start playing as soon as ready
|
Here
|
controls
|
Whether controls (such
as play and pause buttons) should be displayed
|
Here
|
loop
|
Media to start over
again when it finishes
|
Here
|
muted
|
Audio output should be
muted
|
Here
|
preload
|
If / how author thinks media
should be loaded when page loads
|
Here
|
src
|
URL of media
|
Here
|
To create or access such
an element in JavaScript
see here. The
corresponding HTML DOM
object supports standard
DOM properties and methods, and additional properties with the same name and
meaning as the attributes of the underlying HTML element referred to above. It also supports DOM generic media
properties and methods and the following additional properties and methods.
Additional
methods:
Method
|
Description
|
More
|
fastSeek()
|
Seeks
to a specified time in audio
|
Here
|
getStartDate()
|
Returns Date object representing current timeline offset
|
Here
|
The default style
applicable to this element is shown here.
NAVIGATION LINKS
Contents | Prev | Next | HTML Elements