2023-10-07 04:56:35 -06:00
|
|
|
import type {ISO639_1} from './language';
|
|
|
|
import type {ReactVideoEvents} from './events';
|
|
|
|
import type {StyleProp, ViewStyle} from 'react-native';
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2023-10-07 04:56:35 -06:00
|
|
|
type Filter =
|
|
|
|
| 'None'
|
|
|
|
| 'CIColorInvert'
|
|
|
|
| 'CIColorMonochrome'
|
|
|
|
| 'CIColorPosterize'
|
|
|
|
| 'CIFalseColor'
|
|
|
|
| 'CIMaximumComponent'
|
|
|
|
| 'CIMinimumComponent'
|
|
|
|
| 'CIPhotoEffectChrome'
|
|
|
|
| 'CIPhotoEffectFade'
|
|
|
|
| 'CIPhotoEffectInstant'
|
|
|
|
| 'CIPhotoEffectMono'
|
|
|
|
| 'CIPhotoEffectNoir'
|
|
|
|
| 'CIPhotoEffectProcess'
|
|
|
|
| 'CIPhotoEffectTonal'
|
|
|
|
| 'CIPhotoEffectTransfer'
|
|
|
|
| 'CISepiaTone';
|
2023-10-06 10:39:14 -06:00
|
|
|
|
|
|
|
type Headers = Record<string, string>;
|
|
|
|
|
|
|
|
export type ReactVideoSource = Readonly<{
|
|
|
|
uri?: string;
|
|
|
|
isNetwork?: boolean;
|
|
|
|
isAsset?: boolean;
|
|
|
|
shouldCache?: boolean;
|
|
|
|
type?: string;
|
|
|
|
mainVer?: number;
|
|
|
|
patchVer?: number;
|
|
|
|
headers?: Headers;
|
|
|
|
startTime?: number;
|
|
|
|
endTime?: number;
|
2023-10-07 07:14:10 -06:00
|
|
|
title?: string;
|
|
|
|
subtitle?: string;
|
|
|
|
description?: string;
|
|
|
|
customImageUri?: string;
|
2023-10-06 10:39:14 -06:00
|
|
|
}>;
|
|
|
|
|
2023-10-10 01:47:56 -06:00
|
|
|
type DebugConfig = Readonly<{
|
|
|
|
enable?: boolean;
|
|
|
|
thread?: boolean;
|
|
|
|
}>;
|
|
|
|
|
2023-10-06 10:39:14 -06:00
|
|
|
export type ReactVideoDrm = Readonly<{
|
|
|
|
type?: 'widevine' | 'playready' | 'clearkey' | 'fairplay';
|
|
|
|
licenseServer?: string;
|
|
|
|
headers?: Headers;
|
|
|
|
contentId?: string; // ios
|
|
|
|
certificateUrl?: string; // ios
|
|
|
|
base64Certificate?: boolean; // ios default: false
|
2023-10-07 04:56:35 -06:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
|
|
getLicense?: (
|
|
|
|
licenseUrl: string,
|
|
|
|
contentId: string,
|
|
|
|
spcBase64: string,
|
|
|
|
) => void; // ios
|
|
|
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
|
|
}>;
|
2023-10-06 10:39:14 -06:00
|
|
|
|
|
|
|
type BufferConfig = {
|
|
|
|
minBufferMs?: number;
|
|
|
|
maxBufferMs?: number;
|
|
|
|
bufferForPlaybackMs?: number;
|
|
|
|
bufferForPlaybackAfterRebufferMs?: number;
|
|
|
|
maxHeapAllocationPercent?: number;
|
|
|
|
minBackBufferMemoryReservePercent?: number;
|
|
|
|
minBufferMemoryReservePercent?: number;
|
2023-10-07 04:56:35 -06:00
|
|
|
};
|
2023-10-06 10:39:14 -06:00
|
|
|
|
|
|
|
type SelectedTrack = {
|
|
|
|
type: 'system' | 'disabled' | 'title' | 'language' | 'index';
|
|
|
|
value?: string | number;
|
2023-10-07 04:56:35 -06:00
|
|
|
};
|
2023-10-06 10:39:14 -06:00
|
|
|
|
|
|
|
type SelectedVideoTrack = {
|
2023-10-07 04:56:35 -06:00
|
|
|
type: 'auto' | 'disabled' | 'resolution' | 'index';
|
2023-10-06 10:39:14 -06:00
|
|
|
value?: number;
|
2023-10-07 04:56:35 -06:00
|
|
|
};
|
2023-10-06 10:39:14 -06:00
|
|
|
|
|
|
|
type SubtitleStyle = {
|
|
|
|
fontSize?: number;
|
|
|
|
paddingTop?: number;
|
|
|
|
paddingBottom?: number;
|
|
|
|
paddingLeft?: number;
|
|
|
|
paddingRight?: number;
|
2023-10-07 04:56:35 -06:00
|
|
|
};
|
2023-10-06 10:39:14 -06:00
|
|
|
|
|
|
|
type TextTracks = {
|
|
|
|
title: string;
|
|
|
|
language: ISO639_1;
|
2023-10-07 04:56:35 -06:00
|
|
|
type: 'application/x-subrip' | 'application/ttml+xml' | 'text/vtt';
|
2023-10-06 10:39:14 -06:00
|
|
|
uri: string;
|
2023-10-07 04:56:35 -06:00
|
|
|
}[];
|
2023-10-06 10:39:14 -06:00
|
|
|
|
2023-10-07 07:14:10 -06:00
|
|
|
type Chapters = {
|
|
|
|
title: string;
|
|
|
|
startTime: number;
|
|
|
|
endTime: number;
|
|
|
|
uri?: string;
|
|
|
|
};
|
|
|
|
|
2023-10-06 10:39:14 -06:00
|
|
|
export interface ReactVideoProps extends ReactVideoEvents {
|
|
|
|
source?: ReactVideoSource;
|
|
|
|
drm?: ReactVideoDrm;
|
|
|
|
style?: StyleProp<ViewStyle>;
|
|
|
|
adTagUrl?: string; // iOS
|
|
|
|
audioOnly?: boolean;
|
|
|
|
automaticallyWaitsToMinimizeStalling?: boolean; // iOS
|
|
|
|
backBufferDurationMs?: number; // Android
|
|
|
|
bufferConfig?: BufferConfig; // Android
|
2023-10-07 07:14:10 -06:00
|
|
|
chapters?: Chapters[]; // iOS
|
2023-10-06 10:39:14 -06:00
|
|
|
contentStartTime?: number; // Android
|
|
|
|
controls?: boolean;
|
|
|
|
currentPlaybackTime?: number; // Android
|
|
|
|
disableFocus?: boolean;
|
|
|
|
disableDisconnectError?: boolean; // Android
|
|
|
|
filter?: Filter; // iOS
|
2023-10-07 04:56:35 -06:00
|
|
|
filterEnabled?: boolean; // iOS
|
|
|
|
focusable?: boolean; // Android
|
2023-10-06 10:39:14 -06:00
|
|
|
fullscreen?: boolean; // iOS
|
|
|
|
fullscreenAutorotate?: boolean; // iOS
|
2023-10-07 04:56:35 -06:00
|
|
|
fullscreenOrientation?: 'all' | 'landscape' | 'portrait'; // iOS
|
2023-10-06 10:39:14 -06:00
|
|
|
hideShutterView?: boolean; // Android
|
2023-10-07 04:56:35 -06:00
|
|
|
ignoreSilentSwitch?: 'inherit' | 'ignore' | 'obey'; // iOS
|
|
|
|
minLoadRetryCount?: number; // Android
|
2023-10-06 10:39:14 -06:00
|
|
|
maxBitRate?: number;
|
|
|
|
mixWithOthers?: 'inherit' | 'mix' | 'duck'; // iOS
|
|
|
|
muted?: boolean;
|
|
|
|
paused?: boolean;
|
2023-10-07 04:56:35 -06:00
|
|
|
pictureInPicture?: boolean; // iOS
|
2023-10-06 10:39:14 -06:00
|
|
|
playInBackground?: boolean;
|
2023-10-07 04:56:35 -06:00
|
|
|
playWhenInactive?: boolean; // iOS
|
2023-10-06 10:39:14 -06:00
|
|
|
poster?: string;
|
2023-10-07 04:56:35 -06:00
|
|
|
posterResizeMode?:
|
|
|
|
| 'contain'
|
|
|
|
| 'center'
|
|
|
|
| 'cover'
|
|
|
|
| 'none'
|
|
|
|
| 'repeat'
|
|
|
|
| 'stretch';
|
|
|
|
preferredForwardBufferDuration?: number; // iOS
|
2023-10-06 10:39:14 -06:00
|
|
|
preventsDisplaySleepDuringVideoPlayback?: boolean;
|
|
|
|
progressUpdateInterval?: number;
|
|
|
|
rate?: number;
|
|
|
|
repeat?: boolean;
|
|
|
|
reportBandwidth?: boolean; //Android
|
|
|
|
resizeMode?: 'none' | 'contain' | 'cover' | 'stretch';
|
|
|
|
selectedAudioTrack?: SelectedTrack;
|
|
|
|
selectedTextTrack?: SelectedTrack;
|
|
|
|
selectedVideoTrack?: SelectedVideoTrack; // android
|
2023-10-07 04:56:35 -06:00
|
|
|
subtitleStyle?: SubtitleStyle; // android
|
2023-10-06 10:39:14 -06:00
|
|
|
textTracks?: TextTracks;
|
|
|
|
trackId?: string; // Android
|
2023-10-07 04:56:35 -06:00
|
|
|
useTextureView?: boolean; // Android
|
|
|
|
useSecureView?: boolean; // Android
|
2023-10-06 10:39:14 -06:00
|
|
|
volume?: number;
|
|
|
|
localSourceEncryptionKeyScheme?: string;
|
2023-10-10 01:47:56 -06:00
|
|
|
debug?: DebugConfig;
|
2023-10-07 04:56:35 -06:00
|
|
|
}
|