Skip to main content
Version: v7 Beta

Interface: WebVideoPlayer

Defined in: types/WebVideoPlayer.ts:20

Experimental

Extended VideoPlayer interface with web-only methods. Use this type when you need access to audio/video track APIs on web.

Audio/video tracks have ~16% browser support (Safari only, behind flags in Chrome/Firefox). These methods return empty arrays on unsupported browsers.

Example​

import { useVideoPlayer, type WebVideoPlayer } from 'react-native-video';

const player = useVideoPlayer(source) as WebVideoPlayer;
const audioTracks = player.getAvailableAudioTracks();

Extends​

  • VideoPlayerBase

Properties​

currentTime​

currentTime: number;

Defined in: types/VideoPlayerBase.ts:44

Experimental

The duration of the video in seconds (1.0 = 1 sec). Returns NaN if the duration is not available.

Inherited from​

VideoPlayerBase.currentTime

disableAudioSessionManagement​

disableAudioSessionManagement: boolean;

Defined in: types/VideoPlayerBase.ts:113

Experimental

Disables the internal audio session management for this player. When disabled, react-native-video will not configure or activate the AVAudioSession, allowing other libraries (like audio recording libraries) to manage it.

Default​

false

Platform​

iOS

Inherited from​

VideoPlayerBase.disableAudioSessionManagement

duration​

readonly duration: number;

Defined in: types/VideoPlayerBase.ts:32

Experimental

The current time of the video in seconds (1.0 = 1 sec). Returns NaN if the current time is not available.

Inherited from​

VideoPlayerBase.duration

ignoreSilentSwitchMode​

ignoreSilentSwitchMode: IgnoreSilentSwitchMode;

Defined in: types/VideoPlayerBase.ts:82

Experimental

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.

Inherited from​

VideoPlayerBase.ignoreSilentSwitchMode

isPlaying​

readonly isPlaying: boolean;

Defined in: types/VideoPlayerBase.ts:120

Experimental

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.

Inherited from​

VideoPlayerBase.isPlaying

loop​

loop: boolean;

Defined in: types/VideoPlayerBase.ts:54

Experimental

Whether the player is looped.

Inherited from​

VideoPlayerBase.loop

mixAudioMode​

mixAudioMode: MixAudioMode;

Defined in: types/VideoPlayerBase.ts:72

Experimental

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.

Inherited from​

VideoPlayerBase.mixAudioMode

muted​

muted: boolean;

Defined in: types/VideoPlayerBase.ts:49

Experimental

Whether the player is muted.

Inherited from​

VideoPlayerBase.muted

playInBackground​

playInBackground: boolean;

Defined in: types/VideoPlayerBase.ts:92

Experimental

Whether the player should play in background.

  • true - play in background.
  • false - pause in background (default).

Note​

this can override playWhenInactive.

Inherited from​

VideoPlayerBase.playInBackground

playWhenInactive​

playWhenInactive: boolean;

Defined in: types/VideoPlayerBase.ts:103

Experimental

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.

Inherited from​

VideoPlayerBase.playWhenInactive

rate​

rate: number;

Defined in: types/VideoPlayerBase.ts:60

Experimental

Controls the speed at which the player should play.

Note​

if rate is = 0, it will pause video.

Inherited from​

VideoPlayerBase.rate

selectedAudioTrack?​

readonly optional selectedAudioTrack?: AudioTrack;

Defined in: types/WebVideoPlayer.ts:23

Experimental


selectedTrack?​

readonly optional selectedTrack?: TextTrack;

Defined in: types/VideoPlayerBase.ts:186

Experimental

Get the currently selected text track.

Returns​

The currently selected text track, or undefined if none is selected

Inherited from​

VideoPlayerBase.selectedTrack

selectedVideoTrack?​

readonly optional selectedVideoTrack?: VideoTrack;

Defined in: types/WebVideoPlayer.ts:27

Experimental


showNotificationControls​

showNotificationControls: boolean;

Defined in: types/VideoPlayerBase.ts:191

Experimental

Whether to show notification controls (lock screen / control center).

Inherited from​

VideoPlayerBase.showNotificationControls

source​

readonly source: VideoPlayerSourceBase;

Defined in: types/VideoPlayerBase.ts:17

Experimental

The source of the video. Source is immutable. To change the source, you need to call replaceSourceAsync method. see VideoPlayerSourceBase

Inherited from​

VideoPlayerBase.source

status​

readonly status: VideoPlayerStatus;

Defined in: types/VideoPlayerBase.ts:26

Experimental

The status of the player.

Param​

The player is idle (source is not loaded)

Param​

The player is loading.

Param​

The player is ready to play (source is loaded).

Param​

The player has an error.

Inherited from​

VideoPlayerBase.status

volume​

volume: number;

Defined in: types/VideoPlayerBase.ts:38

Experimental

The volume of the video (0.0 = 0%, 1.0 = 100%).

Note​

If the player is muted, the volume will be 0.0.

Inherited from​

VideoPlayerBase.volume

Methods​

addEventListener()​

addEventListener<Event>(event, callback): ListenerSubscription;

Defined in: types/VideoPlayerBase.ts:198

Experimental

Type Parameters​

Type Parameter
Event extends keyof VideoPlayerEvents | "onError"

Parameters​

ParameterType
eventEvent
callbackAllPlayerEvents[Event]

Returns​

ListenerSubscription

Inherited from​

VideoPlayerBase.addEventListener

getAvailableAudioTracks()​

getAvailableAudioTracks(): AudioTrack[];

Defined in: types/WebVideoPlayer.ts:21

Experimental

Returns​

AudioTrack[]


getAvailableTextTracks()​

getAvailableTextTracks(): TextTrack[];

Defined in: types/VideoPlayerBase.ts:174

Experimental

Get all available text tracks for the current source.

Returns​

TextTrack[]

Array of available text tracks

Inherited from​

VideoPlayerBase.getAvailableTextTracks

getAvailableVideoTracks()​

getAvailableVideoTracks(): VideoTrack[];

Defined in: types/WebVideoPlayer.ts:25

Experimental

Returns​

VideoTrack[]


initialize()​

initialize(): Promise<void>;

Defined in: types/VideoPlayerBase.ts:125

Experimental

Manually initialize the player. You don't need to call this method manually, unless you set initializeOnCreation to false in VideoConfig

Returns​

Promise<void>

Inherited from​

VideoPlayerBase.initialize

pause()​

pause(): void;

Defined in: types/VideoPlayerBase.ts:142

Experimental

Pause playback of player.

Returns​

void

Inherited from​

VideoPlayerBase.pause

play()​

play(): void;

Defined in: types/VideoPlayerBase.ts:137

Experimental

Start playback of player.

Returns​

void

Inherited from​

VideoPlayerBase.play

preload()​

preload(): Promise<void>;

Defined in: types/VideoPlayerBase.ts:132

Experimental

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>

Inherited from​

VideoPlayerBase.preload

release()​

release(): void;

Defined in: types/VideoPlayerBase.ts:196

Experimental

Releases the player's resources. After calling this, the player is no longer usable.

Returns​

void

Inherited from​

VideoPlayerBase.release

replaceSourceAsync()​

replaceSourceAsync(source): Promise<void>;

Defined in: types/VideoPlayerBase.ts:166

Experimental

Replace the current source of the player.

Parameters​

ParameterTypeDescription
source| VideoSource | VideoConfig | VideoPlayerSourceBase | nullThe new source of the video.

Returns​

Promise<void>

Note​

If you want to clear the source, you can pass null. see VideoPlayerSourceBase

Inherited from​

VideoPlayerBase.replaceSourceAsync

seekBy()​

seekBy(time): void;

Defined in: types/VideoPlayerBase.ts:150

Experimental

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​

ParameterTypeDescription
timenumberThe time to seek from current time in seconds.

Returns​

void

Inherited from​

VideoPlayerBase.seekBy

seekTo()​

seekTo(time): void;

Defined in: types/VideoPlayerBase.ts:158

Experimental

Seek to a specific time in the video.

Parameters​

ParameterTypeDescription
timenumberThe 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).

Inherited from​

VideoPlayerBase.seekTo

selectAudioTrack()​

selectAudioTrack(track): void;

Defined in: types/WebVideoPlayer.ts:22

Experimental

Parameters​

ParameterType
trackAudioTrack | null

Returns​

void


selectTextTrack()​

selectTextTrack(textTrack): void;

Defined in: types/VideoPlayerBase.ts:180

Experimental

Select a text track to display.

Parameters​

ParameterTypeDescription
textTrackTextTrack | nullText track to select, or null to unselect current track

Returns​

void

Inherited from​

VideoPlayerBase.selectTextTrack

selectVideoTrack()​

selectVideoTrack(track): void;

Defined in: types/WebVideoPlayer.ts:26

Experimental

Parameters​

ParameterType
trackVideoTrack | null

Returns​

void