Types

Video Types

Types related to the video player including state, configuration, and custom video track interfaces.

CustomVideoTrack

The CustomVideoTrack interface represents a custom video track with user-friendly properties. It extends the base VideoTrack from react-native-video with additional fields for better UX.

PropertyTypeRequiredDefaultDescription
labelstringNoundefinedUser-friendly label to display in the UI (e.g., "Auto", "1080p", "720p HD").
uristringNoundefinedOptional URI for the specific quality stream. Useful for direct links to quality renditions.
heightnumberYes–The height of the video track in pixels. Used for track selection by resolution.

If label is not provided, the UI will automatically display the height followed by "p" (e.g., "720p").

Example

import type { CustomVideoTrack } from 'react-native-video-toolkit';

const customVideoTracks: CustomVideoTrack[] = [
  { height: 0, label: 'Auto' },
  { height: 1080, label: '1080p Full HD' },
  { height: 720, label: '720p HD' },
  { height: 480, label: '480p SD' },
];

VideoState

The VideoState interface represents the current state of the video player.

PropertyTypeRequiredDefaultDescription
isPlayingbooleanYesfalseWhether the video is currently playing.
endedbooleanYesfalseWhether playback reached the end of the source.
durationnumberYes0The total duration of the video.
bufferingbooleanYesfalseWhether the video is currently buffering.
mutedbooleanYesfalseWhether the video is currently muted.
volumenumberYes1The current volume of the video.
playbackRatenumberYes1The current playback rate of the video.
fullscreenbooleanYesfalseWhether the video is currently in fullscreen.
pictureInPicturebooleanYesfalseWhether the video is playing in picture-in-picture.
errorstringYesnullThe current error, if any.

The playback position (currentTime and playableDuration) isn't part of the state. Read it with useProgress(): it changes on every progress event, and keeping it out of the state means only the components that call useProgress() re-render.

VideoPlayerConfig

The VideoPlayerConfig interface allows you to configure the behavior of the video player.

PropertyTypeRequiredDefaultDescription
autoHideControlsbooleanNotrueIf true, the controls will automatically hide after a certain delay.
autoPlaybooleanNotrueIf true, the video will start playing automatically.
autoHideDelaynumberNo5000The delay in milliseconds before the controls are hidden.
enableDoubleTapGesturesbooleanNotrueIf true, the user can double-tap to seek forward or backward.
enableFullscreenbooleanNotrueIf true, DefaultLayout shows the fullscreen button. enterFullscreen() still works when false, for always-fullscreen players.
enableVolumeControlbooleanNotrueIf true, the user can control the volume of the video.
enablePictureInPicturebooleanNofalseIf true, DefaultLayout shows the picture-in-picture button. Needs native setup.
enablePanGesturesbooleanNotrueIf true, the user can use pan gestures to control volume and brightness.
enableScreenRotationbooleanNotrueIf true, the screen will rotate automatically when the device is rotated.
playbackRatesnumber[]No[0.5, 1, 1.25, 1.5, 2]An array of playback rates to be displayed in the settings menu.
useCustomAudioTracksbooleanNofalseIf true, use custom audio tracks instead of auto-extracting from source.
useCustomVideoTracksbooleanNofalseIf true, use custom video tracks instead of auto-extracting from source.
onEnterFullscreen() => voidNoundefinedA callback function that is called when the player enters fullscreen mode.
onExitFullscreen() => voidNoundefinedA callback function that is called when the player exits fullscreen mode.
onEnterPictureInPicture() => voidNoundefinedA callback function that is called when the player enters picture-in-picture.
onExitPictureInPicture() => voidNoundefinedA callback function that is called when the player exits picture-in-picture.
onHideControls() => voidNoundefinedA callback function that is called when the controls are hidden.
onShowControls() => voidNoundefinedA callback function that is called when the controls are shown.

On this page