Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Skip to main content
https://html.spec.whatwg.org/multipage/media.html#htmlmediaelement This object also emits few custom events other than standard events described in w3c specification. “playbackstarted” : event sent to the client when MediaPlayer start the playback “audiofocusgranted”: event sent to the client when MediaPlayer resumes the playback internally on obtaining the audio focus. “audiofocuspaused” : event sent to the client when MediaPlayer pauses the playback internally on loosing the audio focus temporarily. “audiofocuslost” : event sent to the client when MediaPlayer pauses the playback internally on loosing the audio focus permanantly.

Extends

Constructors

new HTMLVideoElement()

new HTMLVideoElement(): HTMLVideoElement

Returns

HTMLVideoElement

Inherited from

HTMLMediaElement.constructor

Properties

audioTracks

abstract readonly audioTracks: AudioTrackList Gets the list of audio tracks. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-audiotracks.

Inherited from

HTMLMediaElement.audioTracks

autoplay

abstract autoplay: boolean If set to true, automatically starts the playback when the URL is loaded. If set to false, the app must call play explicitly to start playback. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-autoplay.

Inherited from

HTMLMediaElement.autoplay

buffered

abstract readonly buffered: TimeRanges Get the buffered time range of the content. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered.

Inherited from

HTMLMediaElement.buffered

controls?

optional controls: boolean Enable or disable the UI for media controls. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-controls.

Inherited from

HTMLMediaElement.controls

currentSrc

abstract readonly currentSrc: string Get the source URL of the current media being played. https://html.spec.whatwg.org/multipage/media.html#dom-media-currentsrc.

Inherited from

HTMLMediaElement.currentSrc

currentTime

abstract currentTime: number Get or set the current time of the playback. Setting the current time leads to a seek operation. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-currenttime.

Inherited from

HTMLMediaElement.currentTime

defaultSeekIntervalInSec

abstract defaultSeekIntervalInSec: number Configure the default seek interval in second for remote control media key press “fast-forward” or “rewind” functionality

Inherited from

HTMLMediaElement.defaultSeekIntervalInSec

duration

abstract readonly duration: number Get the duration of the content being played. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-duration.

Inherited from

HTMLMediaElement.duration

ended

abstract readonly ended: boolean Check whehter the media playback has ended. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-ended.

Inherited from

HTMLMediaElement.ended

error

abstract readonly error: MediaError Get the last media error encountered. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-error.

Inherited from

HTMLMediaElement.error

height

abstract height: number Sets the display height of the video. https://html.spec.whatwg.org/multipage/embedded-content-other.html#dom-dim-height.

mediaKeys?

abstract readonly optional mediaKeys: MediaKeys

Brief

The media keys to use to decrypt DRM protected content. For additional information, see https://www.w3.org/TR/encrypted-media/#dom-htmlmediaelement-mediakeys.

Inherited from

HTMLMediaElement.mediaKeys

nodeName

abstract readonly nodeName: string For additional information, see https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName.

Inherited from

HTMLMediaElement.nodeName

paused

abstract readonly paused: boolean Check whether the media playback is paused or not. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-paused.

Inherited from

HTMLMediaElement.paused

readyState

abstract readonly readyState: number Get the ready state of the media element. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-readystate.

Inherited from

HTMLMediaElement.readyState

seekable

abstract readonly seekable: TimeRanges Get the seekable time range of the content. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable.

Inherited from

HTMLMediaElement.seekable

seeking

abstract readonly seeking: boolean Check whehter the media element is currently seeking. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-seeking.

Inherited from

HTMLMediaElement.seeking

src

abstract src: string Set the URL of the media source. For additional information, see https://html.spec.whatwg.org/multipage/media.html#location-of-the-media-resource.

Inherited from

HTMLMediaElement.src

srcObject

abstract srcObject: MediaProvider Set the source MediaProvider object. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-srcobject.

Inherited from

HTMLMediaElement.srcObject

textTracks

abstract readonly textTracks: TextTrackList Gets the list of text tracks. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-texttracks.

Inherited from

HTMLMediaElement.textTracks

videoHeight

abstract readonly videoHeight: number Gets the height of the video. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-video-videoheight.

videoTracks

abstract readonly videoTracks: VideoTrackList Gets the list of video tracks. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-videotracks.

Inherited from

HTMLMediaElement.videoTracks

videoWidth

abstract readonly videoWidth: number Gets the width of the video. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-video-videowidth.

width

abstract width: number Sets the display width of the video. For additional information, see https://html.spec.whatwg.org/multipage/embedded-content-other.html#dom-dim-width.

HAVE_CURRENT_DATA

readonly static HAVE_CURRENT_DATA: number = 2 For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-have\_current\_data.

Inherited from

HTMLMediaElement.HAVE_CURRENT_DATA

HAVE_ENOUGH_DATA

readonly static HAVE_ENOUGH_DATA: number = 4 For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-have\_enough\_data.

Inherited from

HTMLMediaElement.HAVE_ENOUGH_DATA

HAVE_FUTURE_DATA

readonly static HAVE_FUTURE_DATA: number = 3 For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-have\_future\_data.

Inherited from

HTMLMediaElement.HAVE_FUTURE_DATA

HAVE_METADATA

readonly static HAVE_METADATA: number = 1 For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-have\_metadata.

Inherited from

HTMLMediaElement.HAVE_METADATA

HAVE_NOTHING

readonly static HAVE_NOTHING: number = 0 For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-have\_nothing.

Inherited from

HTMLMediaElement.HAVE_NOTHING

Methods

addEventListener()

abstract addEventListener(type, listener, options?): void Adds an event listener.

Parameters

type
string The event to listen to.
listener
EventListener The Event Handler function.
options?
Ignore.

Returns

void

Inherited from

HTMLMediaElement.addEventListener

addTextTrack()

abstract addTextTrack(kind, label?, language?, uri?, mimeType?): TextTrack

Parameters

kind
TextTrackKind The kind parameter must return the text track kind of the text track that the TextTrack object represents.
label?
string The label parameter must return the text track label of the text track that the TextTrack object represents.
language?
string The language parameter must return the text track language of the text track that the TextTrack object represents.
uri?
string The uri parameter must return the URI of the out of band subtitle of the text track that the TextTrack object represents. This is a custom addition (not part of the w3c specification). If you specify the uri parameter, the component parses and renders subtitles.
mimeType?
string The mimeType parameter must return the mime type of the out of band subtitle of the text track that the TextTrack object represents. This is a custom addition (not part of the w3c specification).

Returns

TextTrack

Brief

For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-addtexttrack.

Inherited from

HTMLMediaElement.addTextTrack

getVideoPlaybackQuality()

abstract getVideoPlaybackQuality(): VideoPlaybackQuality Get video playback quality attributes. For additional information, see https://w3c.github.io/media-playback-quality/#dom-htmlvideoelement-getvideoplaybackquality.

Returns

VideoPlaybackQuality

pause()

abstract pause(): void Pauses the playback. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-pause.

Returns

void

Inherited from

HTMLMediaElement.pause

play()

abstract play(): void Starts the playback. For additional information, see https://html.spec.whatwg.org/multipage/media.html#dom-media-play.

Returns

void

Inherited from

HTMLMediaElement.play

removeEventListener()

abstract removeEventListener(type, listener, options?): void Removes an event listener.

Parameters

type
string The event to listen to.
listener
EventListener The Event Handler function to be removed.
options?
Ignore.

Returns

void

Inherited from

HTMLMediaElement.removeEventListener

setMediaKeys()

abstract setMediaKeys(mediaKeys?): Promise<void>

Parameters

mediaKeys?
MediaKeys For additional information, see https://www.w3.org/TR/encrypted-media/#dom-mediakeys.

Returns

Promise<void>

Brief

Sets the media keys used for decrypting DRM protected content. For additional information, see https://www.w3.org/TR/encrypted-media/#dom-htmlmediaelement-setmediakeys

Inherited from

HTMLMediaElement.setMediaKeys
Last modified on February 25, 2026