HTMLAudioElement : HTMLMediaElement
Return to: HTML DOM Level 5 index

Represents an sound or audio stream.

Platform Support

Mozilla Chrome Safari Opera IE Netscape
3.5+ no 4.0.5+ 10.5+ 9.0+ no

Constructors

Constructor Action Mozilla Chrome Safari Opera IE Netscape
HTMLAudioElement Constructor() : HTMLAudioElement
Audio in an HTML document.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no

HTMLAudioElement() : HTMLAudioElement

Audio in an HTML document.

Returns
HTMLAudioElement

Visibility
internal

Inherited Properties

Property Action Mozilla Chrome Safari Opera IE Netscape
error : MediaError
Returns a MediaError object representing the current error state of the element.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

src : String
Gives the address of the media resource (video, audio) to show.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

currentSrc : String
Guves the current address of the media resource (video, audio) to show.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

NETWORK_EMPTY : Number
The element has not yet been initialized. All attributes are in their initial states. (numeric value 0)
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

NETWORK_IDLE : Number
The element's resource selection algorithm is active and has selected a resource, but it is not actually using the network at this time.(numeric value 1)
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

The user agent is actively trying to download data.(numeric value 2)
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

The element's resource selection algorithm is active, but it has failed to find a resource to use.(numeric value 3)
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

networkState : Number
The state of the network.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

preload : String
Provides a hint to the user agent about what the author thinks will lead to the best user experience.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

buffered : TimeRanges
Returns a new instance normalized TimeRanges object that represents the ranges of the media resource, if any, that the user agent has buffered, at the time the attribute is evaluated.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

HAVE_NOTHING : Number
No information regarding the media resource is available. No data for the current playback position is available. Media elements whose networkState attribute are set to NETWORK_EMPTY are always in the HAVE_NOTHING state. (numeric value 0)
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

HAVE_METADATA : Number
Enough of the resource has been obtained that the duration of the resource is available. In the case of a video element, the dimensions of the video are also available. The API will no longer raise an exception when seeking. No media data is available for the immediate current playback position. The timed tracks are ready.(numeric value 1)
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

Data for the immediate current playback position is available, but either not enough data is available that the user agent could successfully advance the current playback position in the direction of playback at all without immediately reverting to the HAVE_METADATA state, or there is no more data to obtain in the direction of playback.(numeric value 2)
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

Data for the immediate current playback position is available, as well as enough data for the user agent to advance the current playback position in the direction of playback at least a little without immediately reverting to the HAVE_METADATA state.(numeric value 3)
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

All the conditions described for the HAVE_FUTURE_DATA state are met, and, in addition, the user agent estimates that data is being fetched at a rate where the current playback position, if it were to advance at the rate given by the defaultPlaybackRate attribute, would not overtake the available data before playback reaches the end of the media resource.(numeric value 4)
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

readyState : Number
Returns the value that describes the current ready state of the media element.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

seeking : Boolean
Specifies whether the user is currently seeking.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

currentTime : Number
The current playback position, expressed in seconds.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

startTime : Number
The earliest possible position, expressed in seconds.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

duration : Number
The length of the media resource, expressed in seconds.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

paused : Number
Represents whether the media element is paused or not.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

The desired speed at which the media resource is to play, as a multiple of its intrinsic speed.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

playbackRate : Number
The speed at which the media resource is to play, as a multiple of its intrinsic speed.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

played : TimeRanges
A new instance normalized TimeRanges object that represents the ranges of the media resource, if any, that the user agent has so far rendered, at the time the attribute is evaluated.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

seekable : TimeRanges
A new instance normalized TimeRanges object that represents the ranges of the media resource, if any, that the user agent is able to seek to, at the time the attribute is evaluated.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

ended : Boolean
Returns true if the media element has ended playback and the direction of playback is forwards, and false otherwise.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

autoplay : Boolean
When present, the user agent (as described in the algorithm described herein) will automatically begin playback of the media resource as soon as it can do so without stopping.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

loop : Boolean
Indicates that the media element is to seek back to the start of the media resource upon reaching the end.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

controls : Boolean
If present, it indicates that the author has not provided a scripted controller and would like the user agent to provide its own set of controls.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

volume : Number
The playback volume of any audio portions of the media element, in the range 0.0 (silent) to 1.0 (loudest).
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

muted : Boolean
Returns true if the audio channels are muted and false otherwise.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

tracks : Array
Return an array host object for objects of type TimedTrack that is fixed length and read only.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

Inherited Functions

Method Action Mozilla Chrome Safari Opera IE Netscape
load() : void
Causes the element to reset and start selecting and loading a new media resource from scratch.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

play() : void
Sets the paused attribute to false, loading the media resource and beginning playback if necessary. If the playback had ended, will restart it from the start.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

pause() : void
Sets the paused attribute to true, loading the media resource if necessary.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no
Availability

WhatWG

canPlayType(Number type) : DOMString
Returns the empty string (a negative response), "maybe", or "probably" based on how confident the user agent is that it can play media resources of the given type.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no

Parameters
Number type The type of media resource.

Returns
DOMString

Availability

WhatWG

addTrack(String label, String kind, String language) : MutableTimedTrack
Creates and returns a new MutableTimedTrack object, which is also added to the media element's list of timed tracks.
Show Details 3.5+ no 4.0.5+ 10.5+ 9.0+ no

Parameters
String label The timed track label.
String kind The kind of timed track.
String language The langu

Returns
MutableTimedTrack

Availability

WhatWG

References

HTMLAudioElement

Availability

JavaScript 1.2|WhatWG

text_javascript aptana_docs