Private
_rttPrivate
_wsStart a log
a Log object with the levels of log to call
Get the number of audio frame per second currently decoding
Index of the manual audio selection, undefined indicates automatic mode and -1 disable manually the track
Index of the effective audio track, can be undefined on start and -1 means track disabled
Select a audio track to the index provided, or indicates automatic with undefined
True when source is closed
The CMCD session ID
Set the CMCD session ID, if undefined reset to empty string
Source is CMAF and passthrough it to MSE, it's a debugging mode activable when you set Connect.Params.mediaExt to 'cmaf'
Stream name, for example as+bc3f535f-37f3-458b-8171-b4c5e77a6137
Returns true if manual track selection is supported by the source implementation
Get the number of video sample per second currently decoding
Index of the manual video selection, undefined indicates automatic mode and -1 disable manually the track
Index of the effective video track, can be undefined on start and -1 means track disabled
Selects a video track based on the provided index, or enables automatic selection if set to undefined
.
Manually setting a track disables any Adaptive Bitrate algorithm.
Protected
_autoReturns -1 if no track, otherwise returns the id of the middle rendition compatible with the device screen
Protected
_newProtected
_onOptional
sample: SampleProtected
_playProtected
_selectSelect the audio and video track to play
tracks to select, undefined mean "auto" selection
Protected
_setProtected
_setProtected
_setOptional
error: SourceErrorProtected
fetchFetches a resource in a compliant way by invoking finalizeRequest during preparation.
the URL to fetch
Optional
init: RequestInitoptional fetch configuration
the fetched response
Protected
fetchProtected
fetchFetches a resource and measures the RTT (round-trip time) in a compliant way by invoking finalizeRequest during preparation.
the URL to fetch
Optional
init: RequestInitoptional fetch configuration
the fetched response (including RTT metadata)
Protected
finalizePrepares a request, exposing the user-interception onFinalizeRequest to modify it if needed.
URL to adjust if need
HTTP headers to tweak as desired
the finalized URL
Protected
fixEvent unsubscription
Name of event without the 'on' prefix (ex: 'log' to 'onLog' event declared)
Event subscription
Name of event without the on
prefix (ex: log
to onLog
event declared)
Subscriber Function
Optional
options: { Optional
signal?: AbortSignalOptional AbortSignal
to stop this or multiple subscriptions in same time
Event subscription only one time, once time fired it's automatically unsubscribe
Name of event without the on
prefix (ex: log
to onLog
event declared)
Subscriber Function
Optional
options: { Optional
signal?: AbortSignalProtected
readIngest audio sample for trackId, if sample is undefined it only changes the tracks
Optional
sample: SampleProtected
readProtected
readProtected
readIngest video sample for trackId, if sample is undefined it only changes the tracks If sample.duration is negative, it will extend the sample until the currentTime to repair synchronization
Optional
sample: SampleStatic
getRetrieves the Source class registered for the specified protocol.
The name of the protocol (e.g., 'wss', 'https', 'http').
The registered Source class implementation for the protocol, or undefined
if not found.
Static
registerRegisters a Source class for one or multiple protocols, see getClass to retrieve the registered Source class.
Rest
...protocols: [string, ...string[]]One or more protocol names (e.g., 'wss', 'https', 'http'), at least one protocol is required.
A decorator that registers the given Source class under the specified protocols.
*@Source.registerClass('wss', 'ws')*
export class MySource extends Source {
constructor(playing: IPlaying, params: Connect.Params) {
super(playing, 'wss', params);
}
}
Fire when source is closed
Optional
error: SourceErrorerror description on an improper closure
Event fired when metadata is available in the stream.
On the first occurrence, the optional return value allows specifying which track to use when starting the stream. By default, the middle-quality track is selected.
Note that this differs from using videoTrack or audioTrack, where a specific track is fixed, which disables any Adaptive Bitrate algorithm.
The metadata received from the stream.
Optional tracks to use for initializing the stream.
// Set the initial video track to the highest quality; MBR will adjust it later based on network conditions.
player.onMetadata = (metadata) => ({ video: metadata.videoTracks[0].id });
// Alternatively, disable MBR and lock the video track to the highest available quality.
player.onMetadata = (metadata) => player.videoTrack = metadata.videoTracks[0].id;
Fire on new audio or video Media.Sample
WebSocket Streaming