forked from TheWidlarzGroup/react-native-video
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
218 lines (198 loc) · 6.07 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
// Type definitions for react-native-new-video 1.0
// Project: https://github.com/yanjiaxuan/react-native-new-video
// TypeScript Version: 2.8
import * as React from 'react';
import { ViewProps } from 'react-native';
export interface OnLoadData {
canPlayFastForward: boolean;
canPlayReverse: boolean;
canPlaySlowForward: boolean;
canPlaySlowReverse: boolean;
canStepBackward: boolean;
canStepForward: boolean;
currentTime: number;
duration: number;
naturalSize: {
height: number;
width: number;
orientation: 'portrait' | 'landscape';
};
}
export interface OnProgressData {
currentTime: number;
playableDuration: number;
seekableDuration: number;
}
export interface OnBandwidthUpdateData {
bitrate: number;
}
export interface LoadError {
error: {
'': string;
errorString: string;
};
}
export interface OnSeekData {
currentTime: number;
seekTime: number;
target?: number;
}
export interface OnPlaybackRateData {
playbackRate: number;
}
export interface OnPictureInPictureStatusData {
isActive: boolean;
}
export interface OnExternalPlaybackChangeData {
isExternalPlaybackActive: boolean;
}
export interface OnBufferData {
isBuffering: boolean;
}
export interface DRMSettings {
type: DRMType;
licenseServer?: string;
headers?: { [key: string]: string };
contentId?: string;
certificateUrl?: string;
base64Certificate?: boolean;
getLicense?(): Promise<string>;
}
export const TextTrackType: {
SRT: 'application/x-subrip';
TTML: 'application/ttml+xml';
VTT: 'text/vtt';
};
export enum FilterType {
NONE = '',
INVERT = 'CIColorInvert',
MONOCHROME = 'CIColorMonochrome',
POSTERIZE = 'CIColorPosterize',
FALSE = 'CIFalseColor',
MAXIMUMCOMPONENT = 'CIMaximumComponent',
MINIMUMCOMPONENT = 'CIMinimumComponent',
CHROME = 'CIPhotoEffectChrome',
FADE = 'CIPhotoEffectFade',
INSTANT = 'CIPhotoEffectInstant',
MONO = 'CIPhotoEffectMono',
NOIR = 'CIPhotoEffectNoir',
PROCESS = 'CIPhotoEffectProcess',
TONAL = 'CIPhotoEffectTonal',
TRANSFER = 'CIPhotoEffectTransfer',
SEPIA = 'CISepiaTone',
}
export enum DRMType {
WIDEVINE = 'widevine',
PLAYREADY = 'playready',
CLEARKEY = 'clearkey',
FAIRPLAY = 'fairplay',
}
export interface VideoProperties extends ViewProps {
filter?: FilterType;
filterEnable?: boolean;
/* Native only */
src?: any;
seek?: number;
fullscreen?: boolean;
fullscreenOrientation?: 'all' | 'landscape' | 'portrait';
fullscreenAutorotate?: boolean;
onVideoLoadStart?(): void;
onVideoLoad?(): void;
onVideoBuffer?(): void;
onVideoError?(): void;
onVideoProgress?(): void;
onVideoSeek?(): void;
onVideoEnd?(): void;
onTimedMetadata?(): void;
onVideoFullscreenPlayerWillPresent?(): void;
onVideoFullscreenPlayerDidPresent?(): void;
onVideoFullscreenPlayerWillDismiss?(): void;
onVideoFullscreenPlayerDidDismiss?(): void;
/* Wrapper component */
// Opaque type returned by require('./video.mp4')
source: { uri?: string, headers?: {[key: string]: string } } | number;
minLoadRetryCount?: number;
maxBitRate?: number;
resizeMode?: "stretch" | "contain" | "cover" | "none"; // via Image#resizeMode
posterResizeMode?: "stretch" | "contain" | "cover" | "none"; // via Image#resizeMode
poster?: string;
repeat?: boolean;
automaticallyWaitsToMinimizeStalling?: boolean;
paused?: boolean;
muted?: boolean;
volume?: number;
bufferConfig?: {
minBufferMs?: number;
maxBufferMs?: number;
bufferForPlaybackMs?: number;
bufferForPlaybackAfterRebufferMs?: number;
};
stereoPan?: number;
rate?: number;
pictureInPicture?: boolean;
playInBackground?: boolean;
playWhenInactive?: boolean;
ignoreSilentSwitch?: 'ignore' | 'obey';
mixWithOthers?: 'inherit' | 'mix' | 'duck';
reportBandwidth?: boolean;
disableFocus?: boolean;
controls?: boolean;
currentTime?: number;
progressUpdateInterval?: number;
useTextureView?: boolean;
hideShutterView?: boolean;
allowsExternalPlayback?: boolean;
audioOnly?: boolean;
preventsDisplaySleepDuringVideoPlayback?: boolean;
drm?: DRMSettings;
onLoadStart?(): void;
onLoad?(data: OnLoadData): void;
onBuffer?(data: OnBufferData): void;
onError?(error: LoadError): void;
onProgress?(data: OnProgressData): void;
onBandwidthUpdate?(data: OnBandwidthUpdateData): void;
onSeek?(data: OnSeekData): void;
onEnd?(): void;
onFullscreenPlayerWillPresent?(): void;
onFullscreenPlayerDidPresent?(): void;
onFullscreenPlayerWillDismiss?(): void;
onFullscreenPlayerDidDismiss?(): void;
onReadyForDisplay?(): void;
onPlaybackStalled?(): void;
onPlaybackResume?(): void;
onPlaybackRateChange?(data: OnPlaybackRateData): void;
onAudioFocusChanged?(): void;
onAudioBecomingNoisy?(): void;
onPictureInPictureStatusChanged?(data: OnPictureInPictureStatusData): void;
onRestoreUserInterfaceForPictureInPictureStop?(): void;
onExternalPlaybackChange?(data: OnExternalPlaybackChangeData): void;
selectedAudioTrack?: {
type: 'system' | 'disabled' | 'title' | 'language' | 'index';
value?: string | number;
};
selectedTextTrack?: {
type: 'system' | 'disabled' | 'title' | 'language' | 'index';
value?: string | number;
};
selectedVideoTrack?: {
type: 'auto' | 'disabled' | 'resolution' | 'index';
value?: string | number;
};
textTracks?: Array<{
title?: string;
language?: string;
type: 'application/x-subrip' | 'application/ttml+xml' | 'text/vtt';
uri: string;
}>;
/* Required by react-native */
scaleX?: number;
scaleY?: number;
translateX?: number;
translateY?: number;
rotation?: number;
}
export default class Video extends React.Component<VideoProperties> {
seek(time: number, tolerance?: number): void;
presentFullscreenPlayer(): void;
dismissFullscreenPlayer(): void;
}