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
Parameter | Type |
---|---|
eventType | EventType |
callback | EventCallback |
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
Parameter | Type | Description |
---|---|---|
extensionClass | PlayerExtensionConstructor <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
Parameter | Type |
---|---|
playerConfiguration | PlayerConfiguration |
pause()
pause(): Promise<void>
play()
play(): Promise<void>
removeEventListener()
removeEventListener(eventType, callback): void
Parameters
Parameter | Type |
---|---|
eventType | EventType |
callback | EventCallback |
Inherited from
BaseEventEmitter.removeEventListener
replay()
replay(): Promise<void>
setMuted()
setMuted(newMuted): Promise<void>
Parameters
Parameter | Type |
---|---|
newMuted | boolean |
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
Parameter | Type | Description |
---|---|---|
newPlaybackRate | number | The 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
Parameter | Type | Description |
---|---|---|
newPosition | number | New position in milliseconds. |
setVolume()
setVolume(newVolume): Promise<void>
Parameters
Parameter | Type |
---|---|
newVolume | number |
stop()
stop(): Promise<void>
supportsPictureInPicture()
supportsPictureInPicture(): Promise<undefined | boolean>