Options
All
  • Public
  • Public/Protected
  • All
Menu

A Player controls the playback of a live stream.

Hierarchy

  • EventEmitter
    • Player

Index

Properties

Readonly Static captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Readonly Static errorMonitor

errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Accessors

availableQualities

  • get availableQualities(): Quality[]
  • Array of available Quality objects from the loaded source, or empty if none are currently available. The qualities will be available after the Player transitions to the State.Ready state. Note that this set will contain only qualities capable of being played on the current device and not all those present in the source stream.

    Returns Quality[]

duration

  • get duration(): number
  • The playback duration in seconds. The duration is Infinity if the media is a live stream. A Player.Event.DurationChanged is emitted whenever the playback duration changes.

    Returns number

isMuted

  • get isMuted(): boolean
  • set isMuted(shouldMute: boolean): void
  • Whether the Player is muted. You can also mute the Player by setting it to true, or unmute by setting it to false. Updating this property has no effect once the Player transitions to the Player.State.Ended state.

    Returns boolean

  • Whether the Player is muted. You can also mute the Player by setting it to true, or unmute by setting it to false. Updating this property has no effect once the Player transitions to the Player.State.Ended state.

    Parameters

    • shouldMute: boolean

    Returns void

liveLatency

  • get liveLatency(): number
  • For a live stream, the latency to the source in seconds.

    Returns number

position

  • get position(): number
  • The playback position in seconds.

    Returns number

quality

state

stats

  • The media statistics of the Player's live stream.

    Returns Stats

streamerSid

  • get streamerSid(): string

videoElement

  • get videoElement(): HTMLVideoElement
  • The HTMLVideoElement used to play back the live stream.

    Returns HTMLVideoElement

videoSize

volume

  • get volume(): number
  • The Player's volume level in the range [0.0, 1.0].

    Returns number

Static isHighLatencyReductionEnabled

  • get isHighLatencyReductionEnabled(): boolean
  • set isHighLatencyReductionEnabled(isEnabled: boolean): void
  • Whether high latency reduction is enabled for all Player instances. This is set to true by default. When set to true, the Player SDK will periodiocally inspect player.liveLatency and perform the following when high latency is observed:

    1. If the live latency is between 3 and 5 seconds, the Player will increase the playback rate to a value that should not be perceptible to a user. The increased playback rate will allow the Player to catch up to the live source, and will be reverted once the live latency drops below 3 seconds. Application of this strategy may result in audio pitch distortion.

    2. If the live latency is greater than or equal to 5 seconds, the Player will seek ahead to near the end of the Player's buffered content. The user will notice skips in the media content when this strategy is applied.

    Returns boolean

  • Sets whether high latency reduction is enabled for all Player instances. When set to true, the Player SDK will periodiocally inspect player.liveLatency and perform the following when high latency is observed:

    1. If the live latency is between 3 and 5 seconds, the Player will increase the playback rate to a value that should not be perceptible to a user. The increased playback rate will allow the Player to catch up to the live source, and will be reverted once the live latency drops below 3 seconds. Application of this strategy may result in audio pitch distortion.

    2. If the live latency is greater than or equal to 5 seconds, the Player will seek ahead to near the end of the Player's buffered content. The user will notice skips in the media content when this strategy is applied.

    Parameters

    • isEnabled: boolean

    Returns void

Static isSupported

  • get isSupported(): boolean
  • Whether the SDK supports the browser. The SDK only supports browsers which are capable of running WebAssembly (WASM).

    Returns boolean

Static logLevel

Static telemetry

  • A Telemetry provides facilities for subscribing to event and metric data collected by the SDK.

    Returns Telemetry

Static version

  • get version(): string
  • The SDK version.

    Returns string

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

attach

  • attach(videoElement: HTMLVideoElement): Player
  • Set an HTMLVideoElement to play back the live stream. For iOS browsers, please enable inline playback before attaching the HTMLVideoElement.

    example
    const videoElement = document.querySelector('div#container > video');
    videoElement.playsInline = true;
    player.attach(videoElement);
    

    Parameters

    • videoElement: HTMLVideoElement

      The HTMLVideoElement to be used to play back the live stream

    Returns Player

disconnect

  • Disconnect from the live stream. The Player will transition to the terminal Player.State.Ended state, release all resources related to the playback of the live stream, and stop emitting events.

    Returns Player

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

on

once

  • once(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

pause

play

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): Player
  • Parameters

    • Optional event: string | symbol

    Returns Player

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): Player
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Player

seekTo

  • seekTo(position: number): Player
  • Instruct the Player to seek to a specified time in the stream and begins playing media in that position. The player state might change to buffering if there is not enough buffered content in the specified position. This method is asynchronous and a Player.Event.SeekCompleted is emitted upon completion. This is only supported for recorded media and will emit a Player.Error if invoked on a live media.

    throws

    Player.Error

    Parameters

    • position: number

    Returns Player

setMaxListeners

  • setMaxListeners(n: number): Player
  • Parameters

    • n: number

    Returns Player

setVolume

  • setVolume(level: number): Player

Static connect

  • Connect to a live stream.

    throws

    Player.Error or TypeError

    Parameters

    • token: string

      The access token used to connect to the live stream

    • options: Options

      The options for creating a Player

    Returns Promise<Player>

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static on

  • on(emitter: EventEmitter, event: string): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string

    Returns AsyncIterableIterator<any>

Static once

  • once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>
  • once(emitter: DOMEventTarget, event: string): Promise<any[]>
  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string

    Returns Promise<any[]>

Static setLogLevel

  • Set the SDK's log level.

    Parameters

    Returns void

Generated using TypeDoc