Name

MediaElement — a media player element

Inherits from

Node, Element

Synopsis

MediaElement is the common superclass of the <audio> and <video> elements. Those two elements define almost exactly the same API, which is described here, but see Audio and Video for audio- and video-specific details. And see Scripting Audio and Video for an introduction to these media elements.

Constants

The NETWORK constants are the possible values of the networkState, and the HAVE constants are the possible values of the readyState property.

unsigned short NETWORK_EMPTY = 0

The element has not started using the network. This would be the state before the src attribute was set.

unsigned short NETWORK_IDLE = 1

The element is not currently loading data from the network. It might have loaded the complete resource, or it might have buffered all the data it currently needs. Or it might have preload set to “none” and not yet have been asked to load or play the media.

unsigned short NETWORK_LOADING = 2

The element is currently using the network to load media data.

unsigned short NETWORK_NO_SOURCE = 3

The element is not using the network because it was not able to find a media source that it is able to play.

unsigned short HAVE_NOTHING = 0

No media data or metadata has been loaded.

unsigned short HAVE_METADATA = 1

The media metadata has been loaded, but no data for the current playback position has been loaded. This means that you can query the duration of the media or the dimensions of a video and you can seek by setting ...

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.