Interface MediaSource
activeSourceBuffers: SourceBufferList;
duration: number;
onsourceclose: ((this: MediaSource, ev: Event) => any) | null;
onsourceended: ((this: MediaSource, ev: Event) => any) | null;
onsourceopen: ((this: MediaSource, ev: Event) => any) | null;
readyState: ReadyState;
sourceBuffers: SourceBufferList;
addEventListener<K extends keyof MediaSourceEventMap>(
type: K,
listener: (this: MediaSource, ev: MediaSourceEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
addSourceBuffer(type: string): SourceBuffer;
clearLiveSeekableRange(): void;
dispatchEvent(event: Event): boolean;
endOfStream(error?: EndOfStreamError): void;
removeEventListener<K extends keyof MediaSourceEventMap>(
type: K,
listener: (this: MediaSource, ev: MediaSourceEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
removeSourceBuffer(sourceBuffer: SourceBuffer): void;
setLiveSeekableRange(start: number, end: number): void;
}
Hierarchy
- EventTarget
- MediaSource
Properties
ReadonlyactiveSourceBuffers
The activeSourceBuffers read-only property of the containing a subset of the SourceBuffer objects contained within providing the selected video track, enabled audio tracks, and shown/hidden text tracks.
duration
The duration property of the MediaSource interface gets and sets the duration of the current media being presented.
onsourceclose
onsourceended
onsourceopen
ReadonlyreadyState
The readyState read-only property of the current MediaSource.
ReadonlysourceBuffers
The sourceBuffers read-only property of the containing the list of SourceBuffer objects associated with this MediaSource.
Methods
addEventListener
- addEventListener<K extends keyof MediaSourceEventMap>(
type: K,
listener: (this: MediaSource, ev: MediaSourceEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Type Parameters
- K extends keyof MediaSourceEventMap
Parameters
- type: K
- listener: (this: MediaSource, ev: MediaSourceEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
- addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
addSourceBuffer
The
addSourceBuffer()method of the given MIME type and adds it to theMediaSource'sSourceBufferis also returned.Parameters
- type: string
Returns SourceBuffer
clearLiveSeekableRange
The
clearLiveSeekableRange()method of the to MediaSource.setLiveSeekableRange().Returns void
dispatchEvent
The
dispatchEvent()method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.Parameters
- event: Event
Returns boolean
endOfStream
The
endOfStream()method of thejs-nolint endOfStream() endOfStream(endOfStreamError)-endOfStreamErrorMISSING: optional_inline] - : A string representing an error to throw when the end of the stream is reached.Parameters
Optionalerror: EndOfStreamError
Returns void
removeEventListener
- removeEventListener<K extends keyof MediaSourceEventMap>(
type: K,
listener: (this: MediaSource, ev: MediaSourceEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Type Parameters
- K extends keyof MediaSourceEventMap
Parameters
- type: K
- listener: (this: MediaSource, ev: MediaSourceEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
- removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
removeSourceBuffer
The
removeSourceBuffer()method of the MediaSource interface removes the given SourceBuffer from the SourceBufferList associated with thisMediaSourceobject.Parameters
- sourceBuffer: SourceBuffer
Returns void
setLiveSeekableRange
The
setLiveSeekableRange()method of the media element.Parameters
- start: number
- end: number
Returns void
The
MediaSourceinterface of the Media Source Extensions API represents a source of media data for an HTMLMediaElement object.MDN Reference