Class: VideoPlayer
Defined in: VideoPlayer.ts:20
Extends
VideoPlayerEvents
Implements
VideoPlayerBase
Constructors
Constructor
new VideoPlayer(source): VideoPlayer;
Defined in: VideoPlayer.ts:23
Parameters
Parameter | Type |
---|---|
source | | VideoSource | VideoConfig | VideoPlayerSource |
Returns
VideoPlayer
Overrides
VideoPlayerEvents.constructor
Accessors
currentTime
Get Signature
get currentTime(): number;
Defined in: VideoPlayer.ts:106
The duration of the video in seconds (1.0 = 1 sec). Returns NaN if the duration is not available.
Returns
number
Set Signature
set currentTime(value): void;
Defined in: VideoPlayer.ts:110
The duration of the video in seconds (1.0 = 1 sec). Returns NaN if the duration is not available.
Parameters
Parameter | Type |
---|---|
value | number |
Returns
void
Implementation of
VideoPlayerBase.currentTime
duration
Get Signature
get duration(): number;
Defined in: VideoPlayer.ts:92
The current time of the video in seconds (1.0 = 1 sec). Returns NaN if the current time is not available.
Returns
number
Implementation of
VideoPlayerBase.duration
ignoreSilentSwitchMode
Get Signature
get ignoreSilentSwitchMode(): IgnoreSilentSwitchMode;
Defined in: VideoPlayer.ts:151
Controls the silent switch mode of the player.
Note
This is only supported on iOS.
auto
- uses default behavior for player.ignore
- ignore the silent switch.obey
- obey the silent switch.
Returns
Set Signature
set ignoreSilentSwitchMode(value): void;
Defined in: VideoPlayer.ts:155
Controls the silent switch mode of the player.
Note
This is only supported on iOS.
auto
- uses default behavior for player.ignore
- ignore the silent switch.obey
- obey the silent switch.
Parameters
Parameter | Type |
---|---|
value | IgnoreSilentSwitchMode |
Returns
void
Implementation of
VideoPlayerBase.ignoreSilentSwitchMode
isPlaying
Get Signature
get isPlaying(): boolean;
Defined in: VideoPlayer.ts:184
Whether the player is playing.
Note
This is a read-only property.
Note
To pause/resume the player, you need to use play and pause methods.
Returns
boolean
Implementation of
VideoPlayerBase.isPlaying
loop
Get Signature
get loop(): boolean;
Defined in: VideoPlayer.ts:124
Whether the player is looped.
Returns
boolean
Set Signature
set loop(value): void;
Defined in: VideoPlayer.ts:128
Whether the player is looped.
Parameters
Parameter | Type |
---|---|
value | boolean |
Returns
void
Implementation of
VideoPlayerBase.loop
mixAudioMode
Get Signature
get mixAudioMode(): MixAudioMode;
Defined in: VideoPlayer.ts:142
Controls the audio mixing mode of the player.
mixWithOthers
- Mix with other players.doNotMix
- Do not mix with other players.duckOthers
- Duck other players.auto
- uses default behavior for player.
default is auto
.
Returns
Set Signature
set mixAudioMode(value): void;
Defined in: VideoPlayer.ts:146
Controls the audio mixing mode of the player.
mixWithOthers
- Mix with other players.doNotMix
- Do not mix with other players.duckOthers
- Duck other players.auto
- uses default behavior for player.
default is auto
.
Parameters
Parameter | Type |
---|---|
value | MixAudioMode |
Returns
void
Implementation of
VideoPlayerBase.mixAudioMode
muted
Get Signature
get muted(): boolean;
Defined in: VideoPlayer.ts:115
Whether the player is muted.
Returns
boolean
Set Signature
set muted(value): void;
Defined in: VideoPlayer.ts:119
Whether the player is muted.
Parameters
Parameter | Type |
---|---|
value | boolean |
Returns
void
Implementation of
VideoPlayerBase.muted
playInBackground
Get Signature
get playInBackground(): boolean;
Defined in: VideoPlayer.ts:166
Whether the player should play in background.
true
- play in background.false
- pause in background (default).
Note
this can override playWhenInactive.
Returns
boolean
Set Signature
set playInBackground(value): void;
Defined in: VideoPlayer.ts:170
Whether the player should play in background.
true
- play in background.false
- pause in background (default).
Note
this can override playWhenInactive.
Parameters
Parameter | Type |
---|---|
value | boolean |
Returns
void
Implementation of
VideoPlayerBase.playInBackground
playWhenInactive
Get Signature
get playWhenInactive(): boolean;
Defined in: VideoPlayer.ts:175
Whether the player should play when the app is inactive (user opened control center).
true
- play when the app is inactive.false
- pause when the app is inactive (default).
Note
this can be overridden by playInBackground.
Note
This is only supported on iOS.
Returns
boolean
Set Signature
set playWhenInactive(value): void;
Defined in: VideoPlayer.ts:179
Whether the player should play when the app is inactive (user opened control center).
true
- play when the app is inactive.false
- pause when the app is inactive (default).
Note
this can be overridden by playInBackground.
Note
This is only supported on iOS.
Parameters
Parameter | Type |
---|---|
value | boolean |
Returns
void
Implementation of
VideoPlayerBase.playWhenInactive
rate
Get Signature
get rate(): number;
Defined in: VideoPlayer.ts:133
Controls the speed at which the player should play.
Note
if rate is = 0, it will pause video.
Returns
number
Set Signature
set rate(value): void;
Defined in: VideoPlayer.ts:137
Controls the speed at which the player should play.
Note
if rate is = 0, it will pause video.
Parameters
Parameter | Type |
---|---|
value | number |
Returns
void
Implementation of
VideoPlayerBase.rate
selectedTrack
Get Signature
get selectedTrack(): undefined | TextTrack;
Defined in: VideoPlayer.ts:281
Get the currently selected text track.
Returns
undefined
| TextTrack
The currently selected text track, or undefined if none is selected
Implementation of
VideoPlayerBase.selectedTrack
showNotificationControls
Get Signature
get showNotificationControls(): boolean;
Defined in: VideoPlayer.ts:188
Returns
boolean
Set Signature
set showNotificationControls(value): void;
Defined in: VideoPlayer.ts:192
Parameters
Parameter | Type |
---|---|
value | boolean |
Returns
void
source
Get Signature
get source(): VideoPlayerSource;
Defined in: VideoPlayer.ts:82
The source of the video. Source is immutable. To change the source, you need to call replaceSourceAsync method. see VideoPlayerSourceBase
Returns
VideoPlayerSource
Implementation of
VideoPlayerBase.source
status
Get Signature
get status(): VideoPlayerStatus;
Defined in: VideoPlayer.ts:87
The status of the player.
Returns
Implementation of
VideoPlayerBase.status
volume
Get Signature
get volume(): number;
Defined in: VideoPlayer.ts:97
The volume of the video (0.0 = 0%, 1.0 = 100%).
Note
If the player is muted, the volume will be 0.0.
Returns
number
Set Signature
set volume(value): void;
Defined in: VideoPlayer.ts:101
The volume of the video (0.0 = 0%, 1.0 = 100%).
Note
If the player is muted, the volume will be 0.0.
Parameters
Parameter | Type |
---|---|
value | number |
Returns
void
Implementation of
VideoPlayerBase.volume
Methods
addEventListener()
addEventListener<Event>(event, callback): void;
Defined in: VideoPlayerEvents.ts:35
Type Parameters
Type Parameter |
---|
Event extends keyof AllPlayerEvents |
Parameters
Parameter | Type |
---|---|
event | Event |
callback | AllPlayerEvents [Event ] |
Returns
void
Inherited from
VideoPlayerEvents.addEventListener
clearAllEvents()
clearAllEvents(): void;
Defined in: VideoPlayerEvents.ts:53
Clears all events from the event emitter.
Returns
void
Inherited from
VideoPlayerEvents.clearAllEvents
clearEvent()
clearEvent(event): void;
Defined in: VideoPlayerEvents.ts:63
Clears a specific event from the event emitter.
Parameters
Parameter | Type | Description |
---|---|---|
event | keyof AllPlayerEvents | The name of the event to clear. |
Returns
void
Inherited from
VideoPlayerEvents.clearEvent
getAvailableTextTracks()
getAvailableTextTracks(): TextTrack[];
Defined in: VideoPlayer.ts:263
Get all available text tracks for the current source.
Returns
Array of available text tracks
Implementation of
VideoPlayerBase.getAvailableTextTracks
initialize()
initialize(): Promise<void>;
Defined in: VideoPlayer.ts:196
Manually initialize the player. You don't need to call this method manually, unless you set initializeOnCreation
to false in VideoConfig
Returns
Promise
<void
>
Implementation of
VideoPlayerBase.initialize
pause()
pause(): void;
Defined in: VideoPlayer.ts:226
Pause playback of player.
Returns
void
Implementation of
VideoPlayerBase.pause
play()
play(): void;
Defined in: VideoPlayer.ts:218
Start playback of player.
Returns
void
Implementation of
VideoPlayerBase.play
preload()
preload(): Promise<void>;
Defined in: VideoPlayer.ts:202
Preload the video. This is useful to avoid delay when the user plays the video. Preloading too many videos can lead to memory issues or performance issues.
Returns
Promise
<void
>
Implementation of
VideoPlayerBase.preload
release()
release(): void;
Defined in: VideoPlayer.ts:214
Releases the player's native resources and releases native state.
After calling this method, the player is no longer usable.
Accessing any properties or methods of the player after calling this method will throw an error.
If you want to clean player resource use replaceSourceAsync
with null
instead.
Returns
void
removeEventListener()
removeEventListener<Event>(event, callback): void;
Defined in: VideoPlayerEvents.ts:43
Type Parameters
Type Parameter |
---|
Event extends keyof AllPlayerEvents |
Parameters
Parameter | Type |
---|---|
event | Event |
callback | AllPlayerEvents [Event ] |
Returns
void
Inherited from
VideoPlayerEvents.removeEventListener
replaceSourceAsync()
replaceSourceAsync(source): Promise<void>;
Defined in: VideoPlayer.ts:250
Replace the current source of the player.
Parameters
Parameter | Type | Description |
---|---|---|
source | | null | VideoSource | VideoConfig | The new source of the video. |
Returns
Promise
<void
>
Note
If you want to clear the source, you can pass null. see VideoPlayerSourceBase
Implementation of
VideoPlayerBase.replaceSourceAsync
seekBy()
seekBy(time): void;
Defined in: VideoPlayer.ts:234
Seek by given time. If the time is negative, it will seek backward. time will be clamped if it is out of range (0 ~ duration).
Parameters
Parameter | Type | Description |
---|---|---|
time | number | The time to seek from current time in seconds. |
Returns
void
Implementation of
VideoPlayerBase.seekBy
seekTo()
seekTo(time): void;
Defined in: VideoPlayer.ts:242
Seek to a specific time in the video.
Parameters
Parameter | Type | Description |
---|---|---|
time | number | The time to seek to in seconds. |
Returns
void
Note
This have same effect as currentTime setter.
Note
time will be clamped if it is out of range (0 ~ duration).
Implementation of
VideoPlayerBase.seekTo
selectTextTrack()
selectTextTrack(textTrack): void;
Defined in: VideoPlayer.ts:272
Select a text track to display.
Parameters
Parameter | Type | Description |
---|---|---|
textTrack | null | TextTrack | Text track to select, or null to unselect current track |
Returns
void
Implementation of
VideoPlayerBase.selectTextTrack