JavaScripture
Contribute via GitHub Feedback

HTMLMediaElement : HTMLElement

HTMLMediaElement is the base class for the HTMLAudioElement and the HTMLVideoElement.

Instance Properties

audioTracks : AudioTrackList  

autoplay : Boolean

buffered : TimeRanges  

controller : MediaController

controls : Boolean

crossOrigin : String

currentSrc : String  

currentTime : Number

defaultMuted : Boolean

defaultPlaybackRate : Number

duration : Number  

The duration of the media in seconds. May return NaN or Infinity if the duration is not known yet.

ended : Boolean  

Returns true when the media has played to the end.

error : MediaError  

loop : Boolean

mediaGroup : String

muted : Boolean

networkState : Number  

paused : Boolean  

Returns true if the media is paused. Use pause() and play() methods to pause and play the media.

playbackRate : Number

Example:

Run

Results:

 

played : TimeRanges  

Returns a list of ranges of the media that has been played.

Example:

Run

Results:

 

preload : String

readyState : Number  

Returns one of HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTURE_DATA, or HAVE_ENOUGH_DATA based on the amount of data downloaded for the media.

seekable : TimeRanges  

seeking : Boolean  

src : String

textTracks : TextTrackList  

videoTracks : VideoTrackList  

volume : Number

Instance Methods

addTextTrack(kind : String, [label : String, [language : String]]) : TextTrack

kind must be one of 'subtitles', 'captions', 'descriptions', 'chapters', or 'metadata'.

canPlayType(mimeType : String) : String

Returns one of '', 'maybe', or 'probably' depending on the ability of the browser to play the specified type of video.

fastSeek(time : Number) : undefined

getStartDate() : Date

load() : undefined

pause() : undefined

play() : undefined

Instance Events

onabort / 'abort'  
listener(event : Event) : undefined

oncanplay / 'canplay'  
listener(event : Event) : undefined

oncanplaythrough / 'canplaythrough'  
listener(event : Event) : undefined

ondurationchange / 'durationchange'  
listener(event : Event) : undefined

onemptied / 'emptied'  
listener(event : Event) : undefined

onemptied / 'emptied'  
listener(event : Event) : undefined

onended / 'ended'  
listener(event : Event) : undefined

onerror / 'error'  
listener(event : Event) : undefined

onloadeddata / 'loadeddata'  
listener(event : Event) : undefined

onloadedmetadata / 'loadedmetadata'  
listener(event : Event) : undefined

onloadstart / 'loadstart'  
listener(event : Event) : undefined

onpause / 'pause'  
listener(event : Event) : undefined

onplay / 'play'  
listener(event : Event) : undefined

onplaying / 'playing'  
listener(event : Event) : undefined

onprogress / 'progress'  
listener(event : Event) : undefined

onratechange / 'ratechange'  
listener(event : Event) : undefined

onseeked / 'seeked'  
listener(event : Event) : undefined

onseeking / 'seeking'  
listener(event : Event) : undefined

onsuspend / 'suspend'  
listener(event : Event) : undefined

ontimeupdate / 'timeupdate'  
listener(event : Event) : undefined

onvolumechange / 'volumechange'  
listener(event : Event) : undefined

onwaiting / 'waiting'  
listener(event : Event) : undefined

HTMLMediaElement Properties

HAVE_CURRENT_DATA : Number    

Returned by readyState when the the metadatad for the media has loaded and some of the data for the current position has loaded. Listen to the loadeddata event to know when the current data has loaded.

HAVE_ENOUGH_DATA : Number    

Returned by readyState when the the metadatad for the media has loaded and enough of the data for the current position has loaded so the media will play to the end without needing to pause for buffering. Listen to the canplaythrough event to know when enough data has loaded.

HAVE_FUTURE_DATA : Number    

Returned by readyState when the the metadatad for the media has loaded and enough of the data for the current position has loaded to start playing (but not necessarily enough to play to the end). Listen to the canplay event to know when the future data has loaded.

HAVE_METADATA : Number    

Returned by readyState when the metadata for the media has loaded but no data for the media has loaded yet. Listen to the loadedmetadata event to know when the metadata has loaded.

HAVE_NOTHING : Number    

Returned by readyState when no data for the media has loaded yet.

NETWORK_EMPTY : Number    

NETWORK_IDLE : Number    

NETWORK_LOADING : Number    

NETWORK_NO_SOURCE : Number