Skip to main content

Player

Represents the native player and provides methods for its control.

Getter methods do not rely on the React Native bridge; they return cached values instead. Cached values are updated via the event pipeline. Setter methods use the React Native bridge to modify the native player.

Extends

  • default

Implements

  • default

Methods

addEventListener()

addEventListener(eventType, callback): void

Parameters

ParameterType
eventTypeEventType
callbackEventCallback

Inherited from

BaseEventEmitter.addEventListener


destroy()

destroy(): Promise<void>

enterPictureInPictureMode()

enterPictureInPictureMode(): Promise<void>

exitPictureInPictureMode()

exitPictureInPictureMode(): Promise<void>

getDuration()

getDuration(): number

Returns the duration of the current stream in milliseconds.


getExtension()

getExtension<T>(extensionClass): T

Returns the extension of the specified type.

Throws the ErrorCode.PlayerExtensionNotFound error if the extension is not found.

Type parameters

Parameter
T extends default<T>

Parameters

ParameterTypeDescription
extensionClassPlayerExtensionConstructor<T>The extension class.

getFatalError()

getFatalError(): null | PrestoPlayError

Returns the last fatal error that occurred.


getPlaybackRate()

getPlaybackRate(): number

Returns the current playback speed, where 1 represents 'normal' speed.


getPosition()

getPosition(): number

Returns the current playback position in milliseconds.


getState()

getState(): PlayerState

Returns the current player state.


getTrackManager()

getTrackManager(): TrackManager

Returns the track manager.


getVolume()

getVolume(): number

isLive()

isLive(): boolean

Returns whether the player is playing a live stream.


isMuted()

isMuted(): boolean

isPictureInPictureMode()

isPictureInPictureMode(): boolean

isPlayWhenReady()

isPlayWhenReady(): boolean

open()

open(playerConfiguration): Promise<void>

Parameters

ParameterType
playerConfigurationPlayerConfiguration

pause()

pause(): Promise<void>

play()

play(): Promise<void>

removeEventListener()

removeEventListener(eventType, callback): void

Parameters

ParameterType
eventTypeEventType
callbackEventCallback

Inherited from

BaseEventEmitter.removeEventListener


replay()

replay(): Promise<void>

setMuted()

setMuted(newMuted): Promise<void>

Parameters

ParameterType
newMutedboolean

setPlaybackRate()

setPlaybackRate(newPlaybackRate): Promise<void>

Set the playback speed, where 1 represents 'normal' speed.

Note that setting speed for the online playback with high video quality may result in video stuttering/lagging, and it is advised to disable the ABR by setting one of the low video qualities before changing the playback speed.

Parameters

ParameterTypeDescription
newPlaybackRatenumberThe new speed at which the video is being played.

Returns

Remarks

On Android, when the requested speed is different from 1, then the audio is disabled and otherwise is enabled automatically. On iOS, when the requested speed is higher than 2, then the audio is disabled.


setPosition()

setPosition(newPosition): Promise<void>

Seeks to a new position.

Parameters

ParameterTypeDescription
newPositionnumberNew position in milliseconds.

setVolume()

setVolume(newVolume): Promise<void>

Parameters

ParameterType
newVolumenumber

stop()

stop(): Promise<void>

supportsPictureInPicture()

supportsPictureInPicture(): Promise<undefined | boolean>