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 IMediaSource

interface IMediaSource
Extends com.amazon.apmf.IStandard MediaSource object. https://www.w3.org/TR/2016/REC-media-source-20161117/

Methods

getSourceBuffers()

ISourceBuffer*[] getSourceBuffers()
Gets the list of source buffers added to MediaSource. For further details see https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-sourcebuffers

Returns

ISourceBuffer*[] the list of source buffers added to MediaSource. This interface is now updated to return list of ISourceBuffer extension i.e. list of ISourceBuffer2.

getActiveSourceBuffers()

ISourceBuffer*[] getActiveSourceBuffers()
Get the list of active source buffers being used by MediaSource. For further details see https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-activesourcebuffers

Returns

ISourceBuffer*[] the list of active source buffers being used by MediaSource. This interface is now updated to return list of ISourceBuffer extension i.e. list of ISourceBuffer2.

getMediaSourceReadyState()

MediaSourceReadyState getMediaSourceReadyState()
Gets the ready state of the MediaSource. For further details see https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-readystate

Returns

MediaSourceReadyState returns the ready state of MediaSource.

addSourceBuffer()

ISourceBuffer* addSourceBuffer(string mimeType, ISourceBufferConfig? sourceBufferConfig)
Adds a SourceBuffer to the media source. For further details see https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-addsourcebuffer

Parameters

mimeType
string — Required MimeType type of the content that the SourceBuffer will be configured for.
sourceBufferConfig
ISourceBufferConfig? — Optional Optional Source Buffer config to let component know the properties of the content. If null, then default config values are used.

Returns

ISourceBuffer* a new instance of ISourceBuffer object. This interface is updated to create and return ISourceBuffer extension i.e. ISourceBuffer2.

removeSourceBuffer()

void removeSourceBuffer(ISourceBuffer* sourceBuffer)
Removes a SourceBuffer from a MediaSource For further details see https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-removesourcebuffer

Parameters

sourceBuffer
ISourceBuffer* — Required SourceBuffer object instance to be removed from MediaSource. This interface is updated to remove ISourceBuffer extension i.e. ISourceBuffer2.

endOfStream()

void endOfStream(EndOfStreamError eosError)
Signal end of stream to MediaSource. For further details see https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-endofstream

Parameters

eosError
EndOfStreamError — Required The reason for end of stream EndOfStreamError This API is deprecated, use IMediaSource2::endOfStream2

setLiveSeekableRange()

void setLiveSeekableRange(double startSecs, double endSecs)
Sets the Live Seekable Time Range to the MediaSource. This modifies TimeRange values returned by HtmlMediaElement_getSeekableRange API. For further details see https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-setliveseekablerange

Parameters

startSecs
double — Required The start of the range, in seconds, measured from presentation start time.
endSecs
double — Required The end of range, in seconds, measured from presentation start time.

clearLiveSeekableRange()

void clearLiveSeekableRange()
Clears previously set Live Seekable Range. For further details see https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-clearliveseekablerange

isTypeSupported()

bool isTypeSupported(string mimeType)
Checks if MediaSource supports the mime type of the media segment appened to the SourceBufer. For further details see https://www.w3.org/TR/2016/REC-media-source-20161117/#dom-mediasource-istypesupported

Parameters

mimeType
string — Required The mime type of the content.

Returns

bool true if mime type is supported, false otherwise.

setDuration()

void setDuration(double durationSecs)
Sets the duration of the media URL provided in setSource API.

Parameters

durationSecs
double — Required the duration of the media in seconds. Applicable only for URL mode playback
Last modified on October 29, 2026