Class: MOQtailPlayer
Extends
Constructors
Constructor
new MOQtailPlayer(
options?):MOQtailPlayer
Runs each plugin's init and setup.
Parameters
options?
MOQtailPlayerOptions = {}
Returns
MOQtailPlayer
Throws
PlayerError UNSUPPORTED_ORIGIN when two plugins set a setup parameter differently.
Throws
TypeError for a plugin listed twice, or a config its init rejects.
Overrides
Properties
options
readonlyoptions:Readonly<MOQtailPlayerOptions>
Accessors
abrController
Get Signature
get abrController():
AbrController|undefined
The active plugins' ABR controller while it's attached.
Returns
AbrController | undefined
bufferController
Get Signature
get bufferController():
BufferController|undefined
The active plugins' buffer controller while it's attached.
Returns
BufferController | undefined
client
Get Signature
get client():
MOQtailClient|undefined
The shared client while this player holds it; a reconnect replaces it (see the client event).
Returns
MOQtailClient | undefined
mediaSink
Get Signature
get mediaSink():
SinkElement&MediaSinkElement|undefined
The first sink in chain order that provides MEDIA_SINK.
Returns
SinkElement & MediaSinkElement | undefined
mediaSources
Get Signature
get mediaSources(): readonly (
SourceElement&MediaSourceElement)[]
Sources that provide MEDIA_SOURCE, except those loaded by another media source.
Returns
readonly (SourceElement & MediaSourceElement)[]
sources
Get Signature
get sources(): readonly
SourceElement[]
Returns
readonly SourceElement[]
state
Get Signature
get state():
PlayerState
Returns
Methods
destroy()
destroy():
Promise<void>
Aborts in-flight work, destroys sinks then sources, and releases the client last. Callable in any state.
Returns
Promise<void>
emit()
emit<
K>(event, ...args):void
Calls every listener of event with args. Allocates nothing when there are none.
Type Parameters
K
K extends "client" | "warning" | "error" | "catalog" | "ended" | "statechange" | "playing" | "pause" | "stalled" | "reconnecting" | "reconnected" | "timelineevent" | "autoplayblocked" | "renditionchange" | "selectionchange" | "streamtypechange"
Parameters
event
K
args
...Parameters<PlayerEvents[K]>
Returns
void
Inherited from
init()
init():
Promise<void>
Connects and negotiates the chain; rejects with UNSUPPORTED_SOURCE when no element accepts a source. A track URL no element accepts alone is requested, and probed again by its properties. Idempotent.
Returns
Promise<void>
isAbrAvailable()
isAbrAvailable(
source):boolean
Whether source switches renditions automatically: it provides ABR, or an ABR controller can drive it, since the stream is live and no media source provides ABR. A rendition picked manually detaches the controller but leaves this true, so selecting every rendition again resumes it.
Parameters
source
Returns
boolean
off()
off<
K>(event,listener):void
Removes listener, the same function given to on(), from event.
Type Parameters
K
K extends "client" | "warning" | "error" | "catalog" | "ended" | "statechange" | "playing" | "pause" | "stalled" | "reconnecting" | "reconnected" | "timelineevent" | "autoplayblocked" | "renditionchange" | "selectionchange" | "streamtypechange"
Parameters
event
K
listener
PlayerEvents[K]
Returns
void
Inherited from
on()
on<
K>(event,listener):void
Adds listener for event. Adding the same function twice has no effect.
Type Parameters
K
K extends "client" | "warning" | "error" | "catalog" | "ended" | "statechange" | "playing" | "pause" | "stalled" | "reconnecting" | "reconnected" | "timelineevent" | "autoplayblocked" | "renditionchange" | "selectionchange" | "streamtypechange"
Parameters
event
K
listener
PlayerEvents[K]
Returns
void
Inherited from
pause()
pause():
Promise<void>
Returns
Promise<void>
play()
play():
Promise<void>
A NotAllowedError moves the player to paused and emits autoplayblocked.
Returns
Promise<void>
registerElement()
registerElement(
definition):this
Registers an element on this player only, ahead of the plugins' and built-in ones: a source for the probe, a transform for the chain to load where a pad needs one. Call it before source().
Parameters
definition
Returns
this
seek()
seek(
mediaTime):Promise<void>
Seconds. Resolves or rejects as the media sink's seek() does.
Parameters
mediaTime
number
Returns
Promise<void>
setPlaybackRate()
setPlaybackRate(
rate):void
Parameters
rate
number
Returns
void
sink()
Call Signature
sink(
video,options?):this
A video element gets the MSE sink with options, a canvas the Playout sink with them.
Parameters
video
HTMLVideoElement
options?
Omit<MSEOptions, "video">
Returns
this
Call Signature
sink(
canvas,options?):this
A video element gets the MSE sink with options, a canvas the Playout sink with them.
Parameters
canvas
HTMLCanvasElement
options?
Omit<PlayoutOptions, "canvas">
Returns
this
Call Signature
sink(
definition,options?):this
A video element gets the MSE sink with options, a canvas the Playout sink with them.
Parameters
definition
options?
Record<string, unknown>
Returns
this
source()
source(
uri,options?):this
Adds a top-level source for a moqt URI. init() picks its element, once the peer's SETUP decided which plugins are active, and gives it { ...options, source }.
Parameters
uri
string
options?
switchFrom?
boolean
Returns
this
Throws
PlayerError UNSUPPORTED_SOURCE for a URI that can't be used here, UNSUPPORTED_ORIGIN for another origin or client setup; the player stays idle.
start()
start():
Promise<void>
init(), then play(). Idempotent.
Returns
Promise<void>
transform()
transform(
definition,options?):this
Adds a transform, created with options after the sources, in call order.
Parameters
definition
options?
Record<string, unknown> = {}
Returns
this