-
Notifications
You must be signed in to change notification settings - Fork 183
/
index.d.ts
245 lines (205 loc) · 4.76 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
import type { Component } from "react";
import { StyleProp, ViewStyle } from "react-native";
/**
* Video aspect ratio type
*/
export type PlayerAspectRatio = "16:9" | "1:1" | "4:3" | "3:2" | "21:9" | "9:16";
/**
* Video resize mode
*/
export type PlayerResizeMode = "fill" | "contain" | "cover" | "none" | "scale-down";
/**
* VLC Player source configuration options
*/
export interface VLCPlayerSource {
/**
* Media source uri to render
*/
uri: string;
}
/**
* Represents a track type in playback
*/
export type Track = {
/**
* Track identification
*/
id: number;
/**
* Track name
*/
name: string;
};
/**
* Represents a full playback information
*/
export type VideoInfo = {
/**
* Total playback duration
*/
duration: number;
/**
* Playback target
*/
target: number;
/**
* Total playback video size
*/
videoSize: Record<"width" | "height", number>;
/**
* List of playback audio tracks
*/
audioTracks: Track[];
/**
* List of playback text tracks
*/
textTracks: Track[];
};
type OnPlayingEventProps = Pick<VideoInfo, "duration" | "target"> & {
seekable: boolean;
};
type OnProgressEventProps = Pick<VideoInfo, "duration" | "target"> & {
/**
* Current playback time
*/
currentTime: number;
/**
* Current playback position
*/
position: number;
/**
* Remaining time to end playback
*/
remainingTime: number;
};
type SimpleCallbackEventProps = Pick<VideoInfo, "target">;
export type VLCPlayerCallbackProps = {
/**
* Called when media starts playing returns
*
* @param event - Event properties
*/
onPlaying?: (event: OnPlayingEventProps) => void;
/**
* Callback containing position as a fraction, and duration, currentTime and remainingTime in seconds
*
* @param event - Event properties
*/
onProgress?: (event: OnProgressEventProps) => void;
/**
* Called when media is paused
*
* @param event - Event properties
*/
onPaused?: (event: SimpleCallbackEventProps) => void;
/**
* Called when media is stoped
*
* @param event - Event properties
*/
onStopped?: (event: SimpleCallbackEventProps) => void;
/**
* Called when media is buffering
*
* @param event - Event properties
*/
onBuffering?: (event: SimpleCallbackEventProps) => void;
/**
* Called when media playing ends
*
* @param event - Event properties
*/
onEnd?: (event: SimpleCallbackEventProps) => void;
/**
* Called when an error occurs whilst attempting to play media
*
* @param event - Event properties
*/
onError?: (event: SimpleCallbackEventProps) => void;
/**
* Called when video info is loaded, Callback containing `VideoInfo`
*
* @param event - Event properties
*/
onLoad?: (event: VideoInfo) => void;
};
export type VLCPlayerProps = VLCPlayerCallbackProps & {
/**
* Object that contains the uri of a video or song to play eg
*/
source: VLCPlayerSource;
/**
* local subtitle file path,if you want to hide subtitle,
* you can set this to an empty subtitle file,
* current we don't support a hide subtitle prop.
*/
subtitleUri?: string;
/**
* Set to `true` or `false` to pause or play the media
* @default false
*/
paused?: boolean;
/**
* Set to `true` or `false` to loop the media
* @default false
*/
repeat?: boolean;
/**
* Set the playback rate of the player
* @default 1
*/
rate?: number;
/**
* Set position to seek between 0 and 1
* (0 being the start, 1 being the end, use position from the progress object)
*/
seek?: number;
/**
* Set the volume of the player
*/
volume?: number;
/**
* Set to `true` or `false` to mute the player
* @default false
*/
muted?: boolean;
/**
* Set audioTrack id (number) (see onLoad callback VideoInfo.audioTracks)
*/
audioTrack?: number;
/**
* Set textTrack(subtitle) id (number) (see onLoad callback - VideoInfo.textTracks)
*/
textTrack?: number;
/**
* Set to `true` or `false` to allow playing in the background
* @default false
*/
playInBackground?: boolean;
/**
* Video aspect ratio
*/
videoAspectRatio?: PlayerAspectRatio;
/**
* Set to `true` or `false` to enable auto aspect ratio
* @default false
*/
autoAspectRatio?: boolean;
/**
* Set the behavior for the video size (fill, contain, cover, none, scale-down)
*/
resizeMode?: PlayerResizeMode;
/**
* React native view stylesheet styles
*/
style?: StyleProp<ViewStyle>;
};
/**
* A component that can be used to show a playback
*/
declare class VLCPlayer extends Component<VLCPlayerProps> {}
/**
* A component that renders a playback with additional
* features like fullscreen, controls, etc.
*/
declare class VlCPlayerView extends Component<any> {}