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
Native
Skip to main content

Interface IHtmlMediaElement

interface IHtmlMediaElement
Extends com.amazon.apmf.IStandard The HtmlMediaElement object.

Methods

initializeAsync()

com.amazon.apmf.ISubscription* initializeAsync(IHtmlMediaElementInitStatusListener* initStatusListener)
Asynchronously initializes the W3CMedia stack.

Parameters

initStatusListener
IHtmlMediaElementInitStatusListener* — Required IHtmlMediaElementInitStatusListener instance to notify initialization completed.

Returns

com.amazon.apmf.ISubscription* ISubscription object instance

deinitializeAsync()

com.amazon.apmf.ISubscription* deinitializeAsync(IHtmlMediaElementDeInitStatusListener* deInitStatusListener)
Asynchronously deinitializes the W3CMedia stack.

Parameters

deInitStatusListener
IHtmlMediaElementDeInitStatusListener* — Required IHtmlMediaElementDeInitStatusListener object instance to callback to notify deinitialiation completed.

Returns

com.amazon.apmf.ISubscription* ISubscription object instance

addEventListener()

com.amazon.apmf.ISubscription* addEventListener(IHtmlMediaElementEventListener* eventListener)
Asynchronously recieve events through IHtmlMediaElementEventListener callbacks.

Parameters

eventListener
IHtmlMediaElementEventListener* — Required IHtmlMediaElementEventListener instance for callback to notify events.

Returns

com.amazon.apmf.ISubscription* ISubscription object instance

setVideoSurface()

void setVideoSurface(com.amazon.kepler.graphics.IMediaSurface* videoSurface)
Sets the video surface for video rendering

Parameters

videoSurface
com.amazon.kepler.graphics.IMediaSurface* — Required IMediaSurface instance

clearVideoSurface()

void clearVideoSurface(com.amazon.kepler.graphics.IMediaSurface* videoSurface)
Clears the video surface for video rendering

Parameters

videoSurface
com.amazon.kepler.graphics.IMediaSurface* — Required IMediaSurface instance

getError()

IMediaError? getError()
Gets the last error of HtmlMediaElement. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-error

Returns

IMediaError? The return value is optional and might be absent. Pointer that receives IMediaError

setSource()

void setSource(string url)
Gets the currently playing source media URL. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-currentsrc

Parameters

url
string — Required The url that is set for playback.

getCurrentSource()

string getCurrentSource()
Gets the currently playing source media URL. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-currentsrc

Returns

string The url that is set for playback.

getBufferedRange()

TimeRange[] getBufferedRange()
Gets the TimeRange of buffered media data. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-buffered

Returns

TimeRange[] TimeRange array.

getReadyState()

ReadyState getReadyState()
Gets the ready state of the media. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-readystate

Returns

ReadyState returns ReadyState.

isSeeking()

bool isSeeking()
Checks if the player is currently seeking the media For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-seeking

Returns

bool returns true if the player is seeking.

getCurrentTimeSecs()

double getCurrentTimeSecs()
Gets the current playback position in seconds For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-currenttime

Returns

double returns the current playback position in seconds.

setCurrentTime()

void setCurrentTime(double positionSecs)
Seeks to the new playback granular position. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-currenttime

Parameters

positionSecs
double — Required The new playback position to seek (granular seek) to in seconds. return none

getDuration()

double getDuration()
Gets the duration of the media content in URL and MSE mode. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-duration

Returns

double the duration of the media in seconds. Applicable URL and MSE mode playback configurations. For MSSE mode it will throw an exception as not supported.

isPaused()

bool isPaused()
Checks if the player is paused. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-paused

Returns

bool returns true if playback is paused false otherwise.

setPlaybackRate()

void setPlaybackRate(double playbackRate)
Sets the media playback rate. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-playbackrate

Parameters

playbackRate
double — Required The rate at playback. 1.0 is the normal playback rate. return none

getPlaybackRate()

double getPlaybackRate()
Gets the current media playback rate. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-playbackrate

Returns

double returns the current rate at playback.

getSeekableRange()

TimeRange[] getSeekableRange()
Gets the TimeRange of the content which can be seeked to. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable

Returns

TimeRange[] returns the seekable time ranges.

hasEnded()

bool hasEnded()
Checks if the playback has ended. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-ended

Returns

bool returns whether the playback has ended or not. true if ended, otherwise false.

isAutoplayEnabled()

bool isAutoplayEnabled()
Checks if auto play is enabled. If not enabled, call play API explicitly. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-autoplay

Returns

bool returns whether autoplay is enabled or not. true if enabled, otherwise false.

enableAutoplay()

void enableAutoplay()
Enable autoplay mode. Clients need not call play explicitly after setSource. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-autoplay

disableAutoplay()

void disableAutoplay()
Disable autoplay. Clients need to call play explicitly after setSource. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-autoplay

play()

void play()
Starts or resumes the playback. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-play

pause()

void pause()
Pauses the playback. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-pause

getVolumeLevel()

double getVolumeLevel()
Gets the current volume level of audio stream in the range 0.0 to 1.0. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-volume

Returns

double the volume level of audio stream.

setVolumeLevel()

void setVolumeLevel(double volumeLevel)
Sets the volume level of audio stream in the range 0.0 to 1.0. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-volume

Parameters

volumeLevel
double — Required The volume level of the audio stream.

isAudioMuted()

bool isAudioMuted()
Checks if audio is muted or not. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-muted

Returns

bool whether the audio is muted or not. true if muted, false otherwise.

muteAudio()

void muteAudio()
Mutes the audio. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-muted

unmuteAudio()

void unmuteAudio()
Unmutes the audio. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-muted

getAudioTrackList()

IAudioTrack*[] getAudioTrackList()
Gets the list of audio tracks of the content. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-audiotracks

Returns

IAudioTrack*[] the array of audio tracks.

getVideoTrackList()

IVideoTrack*[] getVideoTrackList()
Gets the list of video tracks of the content. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-videotracks

Returns

IVideoTrack*[] the array of video tracks.

getTextTrackList()

ITextTrack*[] getTextTrackList()
Gets the list of Text tracks of the content. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-texttracks

Returns

ITextTrack*[] the array of text tracks.

addTextTrack()

ITextTrack* addTextTrack(TextTrackKind kind, string? label, string? language, SubtitleInfo? subtitleInfo)
Adds a text track (subtitles) to be played along with the content. For further details see https://html.spec.whatwg.org/multipage/media.html#dom-media-addtexttrack

Parameters

kind
TextTrackKind — Required The kind of the text track as per the spec. For further details see https://html.spec.whatwg.org/multipage/media.html#text-track-kind .
label
string? — Optional A user friendly label of the text track. For further details see https://html.spec.whatwg.org/multipage/media.html#text-track-label .
language
string? — Optional The language of the text track. For further details see https://html.spec.whatwg.org/multipage/media.html#text-track-language .
subtitleInfo
SubtitleInfo? — Optional Optional info about the out-of-band subtitle that will be used to render this text track. This is a custom (not w3c spec) addition. Use this param if you want this component to parse and render captions.

Returns

ITextTrack* the newly created text track instance.

clearMediaKeys()

void clearMediaKeys()
Unsets the MediaKeys provided by setMediaKeys API. UnsupportedPlayerModeError This API is only supported in PlayerMode::MSE and PlayerMode::MSSE player modes.

setMediaKeys()

com.amazon.apmf.ISubscription* setMediaKeys(IMediaKeys* mediaKeys, IHtmlMediaElementKeysSetListener* keysSetListener)
Sets the MediaKeys used for decryption DRM protect content. For further details see https://www.w3.org/TR/encrypted-media/#dom-htmlmediaelement-setmediakeys

Parameters

mediaKeys
IMediaKeys* — Required The MediaKeys used to decrypt a DRM protected.
keysSetListener
IHtmlMediaElementKeysSetListener* — Required IHtmlMediaElementKeysSetListener object to handle callback when MediaKeys is set.

Returns

com.amazon.apmf.ISubscription* ISubscription object instance.

setMediaSampleSource()

void setMediaSampleSource(IMediaSampleSource* mediaSampleSource)
Sets the MediaSampleSource object instance.

Parameters

mediaSampleSource
IMediaSampleSource* — Required The MediaSampleSource object instance to set.
Last modified on October 29, 2026