class MediaElement
package js.html
extends Element › DOMElement › Node › EventTarget
extended by AudioElement, VideoElement
The HTMLMediaElement
interface adds to HTMLElement
the properties and methods needed to support basic media-related capabilities that are common to audio and video. The HTMLVideoElement
and HTMLAudioElement
elements both inherit this interface.
Documentation HTMLMediaElement by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See:
Variables
read onlyaudioTracks:AudioTrackList
Is a AudioTrackList
that lists the AudioTrack
objects contained in the element.
Is a Boolean
that reflects the autoplay
HTML attribute, indicating whether playback should automatically begin as soon as enough media is available to do so without interruption.
read onlybuffered:TimeRanges
Returns a TimeRanges
object that indicates the ranges of the media source that the browser has buffered (if any) at the moment the buffered
property is accessed.
Is a Boolean
that reflects the controls
HTML attribute, indicating whether user interface items for controlling the resource should be displayed.
Is a double
indicating the current playback time in seconds. Setting this value seeks the media to the new time.
Is a Boolean
that reflects the muted
HTML attribute, which indicates whether the media element's audio output should be muted by default.
read onlyerror:MediaError
Returns a MediaError
object for the most recent error, or null
if there has not been an error.
Is a Boolean
that reflects the loop
HTML attribute, which indicates whether the media element should start over when it reaches the end.
Is a Boolean
that determines whether audio is muted. true
if the audio is muted and false
otherwise.
read onlynetworkState:Int
Returns a unsigned short
(enumeration) indicating the current state of fetching the media over the network.
read onlyplayed:TimeRanges
Returns a TimeRanges
object that contains the ranges of the media source that the browser has played, if any.
Is a DOMString
that reflects the preload
HTML attribute, indicating what data should be preloaded, if any. Possible values are: none
, metadata
, auto
.
read onlyreadyState:Int
Returns a unsigned short
(enumeration) indicating the readiness state of the media.
read onlyseekable:TimeRanges
Returns a TimeRanges
object that contains the time ranges that the user is able to seek to, if any.
Is a DOMString
that reflects the src
HTML attribute, which contains the URL of a media resource to use.
Is a MediaStream
representing the media to play or that has played in the current HTMLMediaElement
.
read onlyvideoTracks:VideoTrackList
Returns the list of VideoTrack
objects contained in the element.
Note: Gecko supports only single track playback, and the parsing of tracks' metadata is only available for media with the Ogg container format.
Methods
addTextTrack (kind:TextTrackKind, label:String = "", language:String = ""):TextTrack
Adds a text track (such as a track for subtitles) to a media element.
Resets the media element and restarts the media resource. Any pending events are discarded. How much media data is fetched is still affected by the preload
attribute. This method can be useful for releasing resources after any src
attribute and source
element descendants have been removed. Otherwise, it is usually unnecessary to use this method, unless required to rescan source
element children after dynamic changes.