expo-libvlc-player 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/libvlcplayer/LibVlcPlayerModule.kt +16 -16
- package/android/src/main/java/expo/modules/libvlcplayer/LibVlcPlayerView.kt +51 -47
- package/build/LibVlcPlayer.types.d.ts +42 -42
- package/build/LibVlcPlayer.types.d.ts.map +1 -1
- package/build/LibVlcPlayer.types.js.map +1 -1
- package/ios/LibVlcPlayerModule.swift +16 -16
- package/ios/LibVlcPlayerView.swift +55 -51
- package/ios/MediaPlayerManager.swift +2 -3
- package/package.json +1 -1
- package/src/LibVlcPlayer.types.ts +42 -42
package/README.md
CHANGED
|
@@ -126,18 +126,18 @@ The `LibVlcPlayerView` extends React Native `ViewProps` and implements the follo
|
|
|
126
126
|
| ------------------ | ---------------------------------------------------------------------------------- | ----------- |
|
|
127
127
|
| `source` | Sets the source of the media to be played | |
|
|
128
128
|
| `options` | Sets the VLC options to initialize the player with | `[]` |
|
|
129
|
-
| `slaves` | Sets the player audio and subtitle slaves. See [`Slave`](#slave) for more | `[]` |
|
|
130
129
|
| `tracks` | Sets the player audio, video and subtitle tracks. See [`Tracks`](#tracks) for more | `undefined` |
|
|
131
|
-
| `
|
|
132
|
-
| `mute` | Sets the player volume to `0` when `true` | `false` |
|
|
133
|
-
| `rate` | Sets the player rate. Must be a float between `0` and `1` | `1` |
|
|
134
|
-
| `time` | Sets the initial player time. Must be an integer in milliseconds | `0` |
|
|
135
|
-
| `repeat` | Determines whether the player should repeat the media after playback ends | `false` |
|
|
130
|
+
| `slaves` | Sets the player audio and subtitle slaves. See [`Slave`](#slave) for more | `[]` |
|
|
136
131
|
| `scale` | Sets the player scaling factor. Must be a float equal or greater than `0` | `0` |
|
|
137
132
|
| `aspectRatio` | Sets the player aspect ratio. Must be a valid string or `null` for default | `undefined` |
|
|
133
|
+
| `rate` | Sets the player rate. Must be a float between `0` and `1` | `1` |
|
|
134
|
+
| `time` | Sets the initial player time. Must be an integer in milliseconds | `0` |
|
|
135
|
+
| `volume` | Sets the player volume. Must be an integer between `0` and `100` | `100` |
|
|
136
|
+
| `mute` | Sets the player volume to `0` when `true` | `false` |
|
|
138
137
|
| `audioMixingMode` | Determines how the player will interact with other audio in the system | `"auto"` |
|
|
139
138
|
| `playInBackground` | Determines whether the player should continue playing in the background | `false` |
|
|
140
139
|
| `autoplay` | Determines whether the media should autoplay once created | `true` |
|
|
140
|
+
| `repeat` | Determines whether the media should repeat once ended | `false` |
|
|
141
141
|
|
|
142
142
|
#### Callback props
|
|
143
143
|
|
|
@@ -150,7 +150,7 @@ The `LibVlcPlayerView` extends React Native `ViewProps` and implements the follo
|
|
|
150
150
|
| `onEndReached` | Called after the `EndReached` player event | |
|
|
151
151
|
| `onEncounteredError` | Called after the `EncounteredError` player event | `{ error: string }` |
|
|
152
152
|
| `onPositionChanged` | Called after the `PositionChanged` player event | `{ position: number }` |
|
|
153
|
-
| `onFirstPlay` | Called after the first
|
|
153
|
+
| `onFirstPlay` | Called after the first `Playing` player event | [`MediaInfo`](#mediainfo) |
|
|
154
154
|
| `onBackground` | Called after the player enters the background | |
|
|
155
155
|
|
|
156
156
|
### Player types
|
|
@@ -169,9 +169,9 @@ The `LibVlcPlayerView` extends React Native `ViewProps` and implements the follo
|
|
|
169
169
|
|
|
170
170
|
```json
|
|
171
171
|
{
|
|
172
|
-
"audio":
|
|
172
|
+
"audio": 1,
|
|
173
173
|
"video": 1,
|
|
174
|
-
"subtitle":
|
|
174
|
+
"subtitle": -1
|
|
175
175
|
}
|
|
176
176
|
```
|
|
177
177
|
|
|
@@ -184,7 +184,7 @@ The `LibVlcPlayerView` extends React Native `ViewProps` and implements the follo
|
|
|
184
184
|
"tracks": {
|
|
185
185
|
"audio": [
|
|
186
186
|
{ "id": -1, "name": "Disable" },
|
|
187
|
-
{ "id":
|
|
187
|
+
{ "id": 1, "name": "Track 1 - [English]" }
|
|
188
188
|
],
|
|
189
189
|
"video": [
|
|
190
190
|
{ "id": -1, "name": "Disable" },
|
|
@@ -192,7 +192,7 @@ The `LibVlcPlayerView` extends React Native `ViewProps` and implements the follo
|
|
|
192
192
|
],
|
|
193
193
|
"subtitle": [
|
|
194
194
|
{ "id": -1, "name": "Disable" },
|
|
195
|
-
{ "id":
|
|
195
|
+
{ "id": 1, "name": "Track 1 - [Japanese]" }
|
|
196
196
|
]
|
|
197
197
|
},
|
|
198
198
|
"duration": 78920,
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: "com.android.library"
|
|
2
2
|
|
|
3
3
|
group = "expo.modules.libvlcplayer"
|
|
4
|
-
version = "1.0.
|
|
4
|
+
version = "1.0.5"
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -27,7 +27,7 @@ android {
|
|
|
27
27
|
namespace "expo.modules.libvlcplayer"
|
|
28
28
|
defaultConfig {
|
|
29
29
|
versionCode 1
|
|
30
|
-
versionName "1.0.
|
|
30
|
+
versionName "1.0.5"
|
|
31
31
|
consumerProguardFiles("proguard-rules.pro")
|
|
32
32
|
}
|
|
33
33
|
lintOptions {
|
|
@@ -53,20 +53,20 @@ class LibVlcPlayerModule : Module() {
|
|
|
53
53
|
view.options = options ?: ArrayList<String>()
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
Prop("slaves") { view: LibVlcPlayerView, slaves: ArrayList<Slave>? ->
|
|
57
|
-
view.slaves = slaves ?: ArrayList<Slave>()
|
|
58
|
-
}
|
|
59
|
-
|
|
60
56
|
Prop("tracks") { view: LibVlcPlayerView, tracks: Tracks? ->
|
|
61
57
|
view.tracks = tracks
|
|
62
58
|
}
|
|
63
59
|
|
|
64
|
-
Prop("
|
|
65
|
-
view.
|
|
60
|
+
Prop("slaves") { view: LibVlcPlayerView, slaves: ArrayList<Slave>? ->
|
|
61
|
+
view.slaves = slaves ?: ArrayList<Slave>()
|
|
66
62
|
}
|
|
67
63
|
|
|
68
|
-
Prop("
|
|
69
|
-
view.
|
|
64
|
+
Prop("scale") { view: LibVlcPlayerView, scale: Float? ->
|
|
65
|
+
view.scale = scale ?: DEFAULT_PLAYER_SCALE
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Prop("aspectRatio") { view: LibVlcPlayerView, aspectRatio: String? ->
|
|
69
|
+
view.aspectRatio = aspectRatio
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
Prop("rate") { view: LibVlcPlayerView, rate: Float? ->
|
|
@@ -77,16 +77,12 @@ class LibVlcPlayerModule : Module() {
|
|
|
77
77
|
view.time = time ?: DEFAULT_PLAYER_TIME
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
Prop("
|
|
81
|
-
view.
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
Prop("scale") { view: LibVlcPlayerView, scale: Float? ->
|
|
85
|
-
view.scale = scale ?: DEFAULT_PLAYER_SCALE
|
|
80
|
+
Prop("volume") { view: LibVlcPlayerView, volume: Int? ->
|
|
81
|
+
view.volume = volume ?: MAX_PLAYER_VOLUME
|
|
86
82
|
}
|
|
87
83
|
|
|
88
|
-
Prop("
|
|
89
|
-
view.
|
|
84
|
+
Prop("mute") { view: LibVlcPlayerView, mute: Boolean? ->
|
|
85
|
+
view.mute = mute ?: false
|
|
90
86
|
}
|
|
91
87
|
|
|
92
88
|
Prop("audioMixingMode") { view: LibVlcPlayerView, audioMixingMode: AudioMixingMode? ->
|
|
@@ -101,6 +97,10 @@ class LibVlcPlayerModule : Module() {
|
|
|
101
97
|
view.autoplay = autoplay ?: true
|
|
102
98
|
}
|
|
103
99
|
|
|
100
|
+
Prop("repeat") { view: LibVlcPlayerView, repeat: Boolean? ->
|
|
101
|
+
view.repeat = repeat ?: false
|
|
102
|
+
}
|
|
103
|
+
|
|
104
104
|
OnViewDestroys { view: LibVlcPlayerView ->
|
|
105
105
|
MediaPlayerManager.unregisterPlayerView(view)
|
|
106
106
|
view.destroyPlayer()
|
|
@@ -250,6 +250,24 @@ class LibVlcPlayerView(
|
|
|
250
250
|
field = value
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
fun setPlayerTracks() {
|
|
254
|
+
mediaPlayer?.let { player ->
|
|
255
|
+
val audioTrack = tracks?.audio ?: player.getAudioTrack()
|
|
256
|
+
val videoTrack = tracks?.video ?: player.getVideoTrack()
|
|
257
|
+
val spuTrack = tracks?.subtitle ?: player.getSpuTrack()
|
|
258
|
+
|
|
259
|
+
player.setAudioTrack(audioTrack)
|
|
260
|
+
player.setVideoTrack(videoTrack)
|
|
261
|
+
player.setSpuTrack(spuTrack)
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
var tracks: Tracks? = null
|
|
266
|
+
set(value) {
|
|
267
|
+
setPlayerTracks()
|
|
268
|
+
field = value
|
|
269
|
+
}
|
|
270
|
+
|
|
253
271
|
fun addPlayerSlaves() {
|
|
254
272
|
slaves.forEach { slave ->
|
|
255
273
|
val type = slave.type
|
|
@@ -277,24 +295,26 @@ class LibVlcPlayerView(
|
|
|
277
295
|
field = value
|
|
278
296
|
}
|
|
279
297
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
298
|
+
var scale: Float = DEFAULT_PLAYER_SCALE
|
|
299
|
+
set(value) {
|
|
300
|
+
mediaPlayer?.setScale(value)
|
|
301
|
+
field = value
|
|
302
|
+
}
|
|
285
303
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
304
|
+
var aspectRatio: String? = null
|
|
305
|
+
set(value) {
|
|
306
|
+
mediaPlayer?.setAspectRatio(value)
|
|
307
|
+
field = value
|
|
289
308
|
}
|
|
290
|
-
}
|
|
291
309
|
|
|
292
|
-
var
|
|
310
|
+
var rate: Float = DEFAULT_PLAYER_RATE
|
|
293
311
|
set(value) {
|
|
294
|
-
|
|
312
|
+
mediaPlayer?.setRate(value)
|
|
295
313
|
field = value
|
|
296
314
|
}
|
|
297
315
|
|
|
316
|
+
var time: Int = DEFAULT_PLAYER_TIME
|
|
317
|
+
|
|
298
318
|
var volume: Int = MAX_PLAYER_VOLUME
|
|
299
319
|
set(value) {
|
|
300
320
|
if (options.hasAudioOption()) {
|
|
@@ -302,26 +322,30 @@ class LibVlcPlayerView(
|
|
|
302
322
|
onEncounteredError(error)
|
|
303
323
|
}
|
|
304
324
|
|
|
305
|
-
val
|
|
306
|
-
userVolume =
|
|
325
|
+
val newVolume = value.coerceIn(MIN_PLAYER_VOLUME, MAX_PLAYER_VOLUME)
|
|
326
|
+
userVolume = newVolume
|
|
307
327
|
|
|
308
|
-
mediaPlayer?.
|
|
328
|
+
mediaPlayer?.let { player ->
|
|
329
|
+
if (player.getVolume() > MIN_PLAYER_VOLUME) {
|
|
330
|
+
player.setVolume(newVolume)
|
|
331
|
+
}
|
|
332
|
+
}
|
|
309
333
|
|
|
310
334
|
field = value
|
|
311
335
|
}
|
|
312
336
|
|
|
313
337
|
var mute: Boolean = false
|
|
314
338
|
set(value) {
|
|
315
|
-
if (options.hasAudioOption()) {
|
|
339
|
+
if (options.hasAudioOption() && !value) {
|
|
316
340
|
val error = mapOf("error" to "Audio disabled via options")
|
|
317
341
|
onEncounteredError(error)
|
|
318
342
|
}
|
|
319
343
|
|
|
320
344
|
val newVolume =
|
|
321
|
-
if (
|
|
322
|
-
userVolume.coerceIn(PLAYER_VOLUME_STEP, MAX_PLAYER_VOLUME)
|
|
323
|
-
} else {
|
|
345
|
+
if (value) {
|
|
324
346
|
MIN_PLAYER_VOLUME
|
|
347
|
+
} else {
|
|
348
|
+
userVolume
|
|
325
349
|
}
|
|
326
350
|
|
|
327
351
|
mediaPlayer?.setVolume(newVolume)
|
|
@@ -330,13 +354,19 @@ class LibVlcPlayerView(
|
|
|
330
354
|
field = value
|
|
331
355
|
}
|
|
332
356
|
|
|
333
|
-
var
|
|
357
|
+
var audioMixingMode: AudioMixingMode = AudioMixingMode.AUTO
|
|
334
358
|
set(value) {
|
|
335
|
-
|
|
359
|
+
MediaPlayerManager.audioFocusManager.updateAudioFocus()
|
|
336
360
|
field = value
|
|
337
361
|
}
|
|
338
362
|
|
|
339
|
-
var
|
|
363
|
+
var playInBackground: Boolean = false
|
|
364
|
+
set(value) {
|
|
365
|
+
MediaPlayerManager.audioFocusManager.updateAudioFocus()
|
|
366
|
+
field = value
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
var autoplay: Boolean = true
|
|
340
370
|
|
|
341
371
|
var repeat: Boolean = false
|
|
342
372
|
set(value) {
|
|
@@ -348,32 +378,6 @@ class LibVlcPlayerView(
|
|
|
348
378
|
field = value
|
|
349
379
|
}
|
|
350
380
|
|
|
351
|
-
var scale: Float = DEFAULT_PLAYER_SCALE
|
|
352
|
-
set(value) {
|
|
353
|
-
mediaPlayer?.setScale(value)
|
|
354
|
-
field = value
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
var aspectRatio: String? = null
|
|
358
|
-
set(value) {
|
|
359
|
-
mediaPlayer?.setAspectRatio(value)
|
|
360
|
-
field = value
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
var audioMixingMode: AudioMixingMode = AudioMixingMode.AUTO
|
|
364
|
-
set(value) {
|
|
365
|
-
MediaPlayerManager.audioFocusManager.updateAudioFocus()
|
|
366
|
-
field = value
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
var playInBackground: Boolean = false
|
|
370
|
-
set(value) {
|
|
371
|
-
MediaPlayerManager.audioFocusManager.updateAudioFocus()
|
|
372
|
-
field = value
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
var autoplay: Boolean = true
|
|
376
|
-
|
|
377
381
|
fun play() {
|
|
378
382
|
mediaPlayer?.play()
|
|
379
383
|
}
|
|
@@ -111,18 +111,18 @@ export interface LibVlcPlayerViewNativeProps {
|
|
|
111
111
|
ref?: React.Ref<LibVlcPlayerViewRef>;
|
|
112
112
|
source?: LibVlcSource;
|
|
113
113
|
options?: string[];
|
|
114
|
-
slaves?: Slave[];
|
|
115
114
|
tracks?: Tracks;
|
|
116
|
-
|
|
117
|
-
mute?: boolean;
|
|
118
|
-
rate?: number;
|
|
119
|
-
time?: number;
|
|
120
|
-
repeat?: boolean;
|
|
115
|
+
slaves?: Slave[];
|
|
121
116
|
scale?: number;
|
|
122
117
|
aspectRatio?: string | null;
|
|
118
|
+
rate?: number;
|
|
119
|
+
time?: number;
|
|
120
|
+
volume?: number;
|
|
121
|
+
mute?: boolean;
|
|
123
122
|
audioMixingMode?: AudioMixingMode;
|
|
124
123
|
playInBackground?: boolean;
|
|
125
124
|
autoplay?: boolean;
|
|
125
|
+
repeat?: boolean;
|
|
126
126
|
onBuffering?: BufferingListener;
|
|
127
127
|
onPlaying?: PlayingListener;
|
|
128
128
|
onPaused?: PausedListener;
|
|
@@ -148,6 +148,23 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
148
148
|
* @default []
|
|
149
149
|
*/
|
|
150
150
|
options?: string[];
|
|
151
|
+
/**
|
|
152
|
+
* Sets the player audio, video and subtitle tracks
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```tsx
|
|
156
|
+
* <LibVlcPlayerView
|
|
157
|
+
* tracks={{
|
|
158
|
+
* audio: 1,
|
|
159
|
+
* video: 1,
|
|
160
|
+
* subtitle: -1,
|
|
161
|
+
* }}
|
|
162
|
+
* />
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* @default undefined
|
|
166
|
+
*/
|
|
167
|
+
tracks?: Tracks;
|
|
151
168
|
/**
|
|
152
169
|
* Sets the player audio and subtitle slaves
|
|
153
170
|
*
|
|
@@ -168,34 +185,19 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
168
185
|
*/
|
|
169
186
|
slaves?: Slave[];
|
|
170
187
|
/**
|
|
171
|
-
* Sets the player
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* ```tsx
|
|
175
|
-
* <LibVlcPlayerView
|
|
176
|
-
* tracks={{
|
|
177
|
-
* audio: 0,
|
|
178
|
-
* video: 1,
|
|
179
|
-
* subtitle: 2,
|
|
180
|
-
* }}
|
|
181
|
-
* />
|
|
182
|
-
* ```
|
|
188
|
+
* Sets the player scaling factor. Must be a float equal or greater than `0`
|
|
183
189
|
*
|
|
184
|
-
* @default
|
|
190
|
+
* @default 0
|
|
185
191
|
*/
|
|
186
|
-
|
|
192
|
+
scale?: number;
|
|
187
193
|
/**
|
|
188
|
-
* Sets the player
|
|
194
|
+
* Sets the player aspect ratio. Must be a valid string or `null` to reset to default
|
|
189
195
|
*
|
|
190
|
-
* @
|
|
191
|
-
*/
|
|
192
|
-
volume?: number;
|
|
193
|
-
/**
|
|
194
|
-
* Sets the player volume to `0` when `true`
|
|
196
|
+
* @example "16:9"
|
|
195
197
|
*
|
|
196
|
-
* @default
|
|
198
|
+
* @default undefined
|
|
197
199
|
*/
|
|
198
|
-
|
|
200
|
+
aspectRatio?: string | null;
|
|
199
201
|
/**
|
|
200
202
|
* Sets the player rate. Must be a float number
|
|
201
203
|
*
|
|
@@ -209,25 +211,17 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
209
211
|
*/
|
|
210
212
|
time?: number;
|
|
211
213
|
/**
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
* @default false
|
|
215
|
-
*/
|
|
216
|
-
repeat?: boolean;
|
|
217
|
-
/**
|
|
218
|
-
* Sets the player scaling factor. Must be a float equal or greater than `0`
|
|
214
|
+
* Sets the player volume. Must be an integer between `0` and `100`
|
|
219
215
|
*
|
|
220
|
-
* @default
|
|
216
|
+
* @default 100
|
|
221
217
|
*/
|
|
222
|
-
|
|
218
|
+
volume?: number;
|
|
223
219
|
/**
|
|
224
|
-
* Sets the player
|
|
225
|
-
*
|
|
226
|
-
* @example "16:9"
|
|
220
|
+
* Sets the player volume to `0` when `true`
|
|
227
221
|
*
|
|
228
|
-
* @default
|
|
222
|
+
* @default false
|
|
229
223
|
*/
|
|
230
|
-
|
|
224
|
+
mute?: boolean;
|
|
231
225
|
/**
|
|
232
226
|
* Determines how the player will interact with other audio playing in the system
|
|
233
227
|
*
|
|
@@ -246,6 +240,12 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
246
240
|
* @default true
|
|
247
241
|
*/
|
|
248
242
|
autoplay?: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Determines whether the media should repeat once ended
|
|
245
|
+
*
|
|
246
|
+
* @default false
|
|
247
|
+
*/
|
|
248
|
+
repeat?: boolean;
|
|
249
249
|
/**
|
|
250
250
|
* Called after the `Buffering` player event
|
|
251
251
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibVlcPlayer.types.d.ts","sourceRoot":"","sources":["../src/LibVlcPlayer.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAElD,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;AAE7C,MAAM,WAAW,KAAK;IACpB,MAAM,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MAAM,IAAI,CAAC;IAC1B;;OAEG;IACH,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAC5C;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LibVlcPlayer.types.js","sourceRoot":"","sources":["../src/LibVlcPlayer.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from \"react-native\";\n\nexport interface LibVlcPlayerViewRef {\n /**\n * Starts playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly play: () => Promise<void>;\n /**\n * Pauses playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly pause: () => Promise<void>;\n /**\n * Stops playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly stop: () => Promise<void>;\n /**\n * Sets the position of the current player\n *\n * @param position - Must be a float between `0` and `1`\n *\n * @returns A promise which resolves to `void`\n */\n readonly seek: (position: number) => Promise<void>;\n}\n\nexport type LibVlcSource = string | number | null;\n\nexport type SlaveType = \"audio\" | \"subtitle\";\n\nexport interface Slave {\n source: NonNullable<LibVlcSource>;\n type: SlaveType;\n selected?: boolean;\n}\n\nexport interface Track {\n id: number;\n name: string;\n}\n\nexport interface Tracks {\n audio?: number;\n video?: number;\n subtitle?: number;\n}\n\nexport interface MediaTracks {\n audio: Track[];\n video: Track[];\n subtitle: Track[];\n}\n\nexport interface MediaInfo {\n width: number;\n height: number;\n tracks: MediaTracks;\n duration: number;\n seekable: boolean;\n}\n\nexport type AudioMixingMode =\n | \"mixWithOthers\"\n | \"duckOthers\"\n | \"auto\"\n | \"doNotMix\";\n\n/**\n * @hidden\n */\nexport type BufferingListener = () => void;\n\n/**\n * @hidden\n */\nexport type PlayingListener = () => void;\n\n/**\n * @hidden\n */\nexport type PausedListener = () => void;\n\n/**\n * @hidden\n */\nexport type StoppedListener = () => void;\n\n/**\n * @hidden\n */\nexport type EndReachedListener = () => void;\n\n/**\n * @hidden\n */\nexport type EncounteredErrorListener = (event: { nativeEvent: Error }) => void;\n\nexport type Error = { error: string };\n\n/**\n * @hidden\n */\nexport type PositionChangedListener = (event: {\n nativeEvent: Position;\n}) => void;\n\nexport type Position = { position: number };\n\n/**\n * @hidden\n */\nexport type FirstPlayListener = (event: { nativeEvent: MediaInfo }) => void;\n\n/**\n * @hidden\n */\nexport type BackgroundListener = () => void;\n\n/**\n * @hidden\n */\nexport interface LibVlcPlayerViewNativeProps {\n ref?: React.Ref<LibVlcPlayerViewRef>;\n source?: LibVlcSource;\n options?: string[];\n
|
|
1
|
+
{"version":3,"file":"LibVlcPlayer.types.js","sourceRoot":"","sources":["../src/LibVlcPlayer.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from \"react-native\";\n\nexport interface LibVlcPlayerViewRef {\n /**\n * Starts playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly play: () => Promise<void>;\n /**\n * Pauses playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly pause: () => Promise<void>;\n /**\n * Stops playback of the current player\n *\n * @returns A promise which resolves to `void`\n */\n readonly stop: () => Promise<void>;\n /**\n * Sets the position of the current player\n *\n * @param position - Must be a float between `0` and `1`\n *\n * @returns A promise which resolves to `void`\n */\n readonly seek: (position: number) => Promise<void>;\n}\n\nexport type LibVlcSource = string | number | null;\n\nexport type SlaveType = \"audio\" | \"subtitle\";\n\nexport interface Slave {\n source: NonNullable<LibVlcSource>;\n type: SlaveType;\n selected?: boolean;\n}\n\nexport interface Track {\n id: number;\n name: string;\n}\n\nexport interface Tracks {\n audio?: number;\n video?: number;\n subtitle?: number;\n}\n\nexport interface MediaTracks {\n audio: Track[];\n video: Track[];\n subtitle: Track[];\n}\n\nexport interface MediaInfo {\n width: number;\n height: number;\n tracks: MediaTracks;\n duration: number;\n seekable: boolean;\n}\n\nexport type AudioMixingMode =\n | \"mixWithOthers\"\n | \"duckOthers\"\n | \"auto\"\n | \"doNotMix\";\n\n/**\n * @hidden\n */\nexport type BufferingListener = () => void;\n\n/**\n * @hidden\n */\nexport type PlayingListener = () => void;\n\n/**\n * @hidden\n */\nexport type PausedListener = () => void;\n\n/**\n * @hidden\n */\nexport type StoppedListener = () => void;\n\n/**\n * @hidden\n */\nexport type EndReachedListener = () => void;\n\n/**\n * @hidden\n */\nexport type EncounteredErrorListener = (event: { nativeEvent: Error }) => void;\n\nexport type Error = { error: string };\n\n/**\n * @hidden\n */\nexport type PositionChangedListener = (event: {\n nativeEvent: Position;\n}) => void;\n\nexport type Position = { position: number };\n\n/**\n * @hidden\n */\nexport type FirstPlayListener = (event: { nativeEvent: MediaInfo }) => void;\n\n/**\n * @hidden\n */\nexport type BackgroundListener = () => void;\n\n/**\n * @hidden\n */\nexport interface LibVlcPlayerViewNativeProps {\n ref?: React.Ref<LibVlcPlayerViewRef>;\n source?: LibVlcSource;\n options?: string[];\n tracks?: Tracks;\n slaves?: Slave[];\n scale?: number;\n aspectRatio?: string | null;\n rate?: number;\n time?: number;\n volume?: number;\n mute?: boolean;\n audioMixingMode?: AudioMixingMode;\n playInBackground?: boolean;\n autoplay?: boolean;\n repeat?: boolean;\n onBuffering?: BufferingListener;\n onPlaying?: PlayingListener;\n onPaused?: PausedListener;\n onStopped?: StoppedListener;\n onEndReached?: EndReachedListener;\n onEncounteredError?: EncounteredErrorListener;\n onPositionChanged?: PositionChangedListener;\n onFirstPlay?: FirstPlayListener;\n onBackground?: BackgroundListener;\n}\n\nexport interface LibVlcPlayerViewProps extends ViewProps {\n /**\n * Sets the source of the media to be played\n */\n source: LibVlcSource;\n /**\n * https://wiki.videolan.org/VLC_command-line_help/\n *\n * Sets the VLC options to initialize the player with\n *\n * @example [\"--network-caching=1000\"]\n *\n * @default []\n */\n options?: string[];\n /**\n * Sets the player audio, video and subtitle tracks\n *\n * @example\n * ```tsx\n * <LibVlcPlayerView\n * tracks={{\n * audio: 1,\n * video: 1,\n * subtitle: -1,\n * }}\n * />\n * ```\n *\n * @default undefined\n */\n tracks?: Tracks;\n /**\n * Sets the player audio and subtitle slaves\n *\n * @example\n * ```tsx\n * <LibVlcPlayerView\n * slaves={[\n * {\n * source: \"file://path/to/subtitle.srt\",\n * type: \"subtitle\",\n * selected: true\n * },\n * ]}\n * />\n * ```\n *\n * @default []\n */\n slaves?: Slave[];\n /**\n * Sets the player scaling factor. Must be a float equal or greater than `0`\n *\n * @default 0\n */\n scale?: number;\n /**\n * Sets the player aspect ratio. Must be a valid string or `null` to reset to default\n *\n * @example \"16:9\"\n *\n * @default undefined\n */\n aspectRatio?: string | null;\n /**\n * Sets the player rate. Must be a float number\n *\n * @default 1\n */\n rate?: number;\n /**\n * Sets the initial player time. Must be an integer in milliseconds\n *\n * @default 0\n */\n time?: number;\n /**\n * Sets the player volume. Must be an integer between `0` and `100`\n *\n * @default 100\n */\n volume?: number;\n /**\n * Sets the player volume to `0` when `true`\n *\n * @default false\n */\n mute?: boolean;\n /**\n * Determines how the player will interact with other audio playing in the system\n *\n * @default \"auto\"\n */\n audioMixingMode?: AudioMixingMode;\n /**\n * Determines whether the player should continue playing after entering the background\n *\n * @default false\n */\n playInBackground?: boolean;\n /**\n * Determines whether the media should autoplay once created\n *\n * @default true\n */\n autoplay?: boolean;\n /**\n * Determines whether the media should repeat once ended\n *\n * @default false\n */\n repeat?: boolean;\n /**\n * Called after the `Buffering` player event\n */\n onBuffering?: () => void;\n /**\n * Called after the `Playing` player event\n */\n onPlaying?: () => void;\n /**\n * Called after the `Paused` player event\n */\n onPaused?: () => void;\n /**\n * Called after the `Stopped` player event\n */\n onStopped?: () => void;\n /**\n * Called after the `EndReached` player event\n */\n onEndReached?: () => void;\n /**\n * Called after the `EncounteredError` player event\n */\n onEncounteredError?: (event: Error) => void;\n /**\n * Called after the `PositionChanged` player event\n */\n onPositionChanged?: (event: Position) => void;\n /**\n * Called after the first playing player event\n */\n onFirstPlay?: (event: MediaInfo) => void;\n /**\n * Called after the player enters the background\n */\n onBackground?: () => void;\n}\n"]}
|
|
@@ -41,20 +41,20 @@ public class LibVlcPlayerModule: Module {
|
|
|
41
41
|
view.options = options ?? [String]()
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
Prop("slaves") { (view: LibVlcPlayerView, slaves: [Slave]?) in
|
|
45
|
-
view.slaves = slaves ?? [Slave]()
|
|
46
|
-
}
|
|
47
|
-
|
|
48
44
|
Prop("tracks") { (view: LibVlcPlayerView, tracks: Tracks?) in
|
|
49
45
|
view.tracks = tracks
|
|
50
46
|
}
|
|
51
47
|
|
|
52
|
-
Prop("
|
|
53
|
-
view.
|
|
48
|
+
Prop("slaves") { (view: LibVlcPlayerView, slaves: [Slave]?) in
|
|
49
|
+
view.slaves = slaves ?? [Slave]()
|
|
54
50
|
}
|
|
55
51
|
|
|
56
|
-
Prop("
|
|
57
|
-
view.
|
|
52
|
+
Prop("scale") { (view: LibVlcPlayerView, scale: Float?) in
|
|
53
|
+
view.scale = scale ?? defaultPlayerScale
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Prop("aspectRatio") { (view: LibVlcPlayerView, aspectRatio: String?) in
|
|
57
|
+
view.aspectRatio = aspectRatio
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
Prop("rate") { (view: LibVlcPlayerView, rate: Float?) in
|
|
@@ -65,16 +65,12 @@ public class LibVlcPlayerModule: Module {
|
|
|
65
65
|
view.time = time ?? defaultPlayerTime
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
Prop("
|
|
69
|
-
view.
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
Prop("scale") { (view: LibVlcPlayerView, scale: Float?) in
|
|
73
|
-
view.scale = scale ?? defaultPlayerScale
|
|
68
|
+
Prop("volume") { (view: LibVlcPlayerView, volume: Int?) in
|
|
69
|
+
view.volume = volume ?? maxPlayerVolume
|
|
74
70
|
}
|
|
75
71
|
|
|
76
|
-
Prop("
|
|
77
|
-
view.
|
|
72
|
+
Prop("mute") { (view: LibVlcPlayerView, mute: Bool?) in
|
|
73
|
+
view.mute = mute ?? false
|
|
78
74
|
}
|
|
79
75
|
|
|
80
76
|
Prop("audioMixingMode") { (view: LibVlcPlayerView, audioMixingMode: AudioMixingMode?) in
|
|
@@ -89,6 +85,10 @@ public class LibVlcPlayerModule: Module {
|
|
|
89
85
|
view.autoplay = autoplay ?? true
|
|
90
86
|
}
|
|
91
87
|
|
|
88
|
+
Prop("repeat") { (view: LibVlcPlayerView, shouldRepeat: Bool?) in
|
|
89
|
+
view.shouldRepeat = shouldRepeat ?? false
|
|
90
|
+
}
|
|
91
|
+
|
|
92
92
|
OnViewDidUpdateProps { (view: LibVlcPlayerView) in
|
|
93
93
|
view.createPlayer()
|
|
94
94
|
}
|
|
@@ -202,6 +202,24 @@ class LibVlcPlayerView: ExpoView {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
func setPlayerTracks() {
|
|
206
|
+
guard let player = mediaPlayer else { return }
|
|
207
|
+
|
|
208
|
+
let audioTrackIndex = tracks?.audio ?? Int(player.currentAudioTrackIndex)
|
|
209
|
+
let videoTrackIndex = tracks?.video ?? Int(player.currentVideoTrackIndex)
|
|
210
|
+
let videoSubTitleIndex = tracks?.subtitle ?? Int(player.currentVideoSubTitleIndex)
|
|
211
|
+
|
|
212
|
+
player.currentAudioTrackIndex = Int32(audioTrackIndex)
|
|
213
|
+
player.currentVideoTrackIndex = Int32(videoTrackIndex)
|
|
214
|
+
player.currentVideoSubTitleIndex = Int32(videoSubTitleIndex)
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
var tracks: Tracks? {
|
|
218
|
+
didSet {
|
|
219
|
+
setPlayerTracks()
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
205
223
|
func addPlayerSlaves() {
|
|
206
224
|
for slave in slaves {
|
|
207
225
|
let source = slave.source
|
|
@@ -227,24 +245,33 @@ class LibVlcPlayerView: ExpoView {
|
|
|
227
245
|
}
|
|
228
246
|
}
|
|
229
247
|
|
|
230
|
-
|
|
231
|
-
|
|
248
|
+
var scale: Float = defaultPlayerScale {
|
|
249
|
+
didSet {
|
|
250
|
+
mediaPlayer?.scaleFactor = scale
|
|
251
|
+
}
|
|
252
|
+
}
|
|
232
253
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
254
|
+
var aspectRatio: String? {
|
|
255
|
+
didSet {
|
|
256
|
+
guard let aspectRatio = aspectRatio else {
|
|
257
|
+
mediaPlayer?.videoAspectRatio = nil
|
|
258
|
+
return
|
|
259
|
+
}
|
|
236
260
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
261
|
+
aspectRatio.withCString { cString in
|
|
262
|
+
mediaPlayer?.videoAspectRatio = UnsafeMutablePointer(mutating: cString)
|
|
263
|
+
}
|
|
264
|
+
}
|
|
240
265
|
}
|
|
241
266
|
|
|
242
|
-
var
|
|
267
|
+
var rate: Float = defaultPlayerRate {
|
|
243
268
|
didSet {
|
|
244
|
-
|
|
269
|
+
mediaPlayer?.rate = rate
|
|
245
270
|
}
|
|
246
271
|
}
|
|
247
272
|
|
|
273
|
+
var time: Int = defaultPlayerTime
|
|
274
|
+
|
|
248
275
|
var volume: Int = maxPlayerVolume {
|
|
249
276
|
didSet {
|
|
250
277
|
if options.hasAudioOption() {
|
|
@@ -255,62 +282,30 @@ class LibVlcPlayerView: ExpoView {
|
|
|
255
282
|
let newVolume = max(minPlayerVolume, min(maxPlayerVolume, volume))
|
|
256
283
|
userVolume = newVolume
|
|
257
284
|
|
|
258
|
-
mediaPlayer
|
|
285
|
+
if let player = mediaPlayer, let audio = player.audio {
|
|
286
|
+
if audio.volume > minPlayerVolume {
|
|
287
|
+
audio.volume = Int32(newVolume)
|
|
288
|
+
}
|
|
289
|
+
}
|
|
259
290
|
}
|
|
260
291
|
}
|
|
261
292
|
|
|
262
293
|
var mute: Bool = false {
|
|
263
294
|
didSet {
|
|
264
|
-
if options.hasAudioOption() {
|
|
295
|
+
if options.hasAudioOption(), !mute {
|
|
265
296
|
let error = ["error": "Audio disabled via options"]
|
|
266
297
|
onEncounteredError(error)
|
|
267
298
|
}
|
|
268
299
|
|
|
269
|
-
let newVolume =
|
|
270
|
-
|
|
271
|
-
|
|
300
|
+
let newVolume = mute ?
|
|
301
|
+
minPlayerVolume :
|
|
302
|
+
userVolume
|
|
272
303
|
|
|
273
304
|
mediaPlayer?.audio?.volume = Int32(newVolume)
|
|
274
305
|
MediaPlayerManager.shared.setAppropriateAudioSession()
|
|
275
306
|
}
|
|
276
307
|
}
|
|
277
308
|
|
|
278
|
-
var rate: Float = defaultPlayerRate {
|
|
279
|
-
didSet {
|
|
280
|
-
mediaPlayer?.rate = rate
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
var time: Int = defaultPlayerTime
|
|
285
|
-
|
|
286
|
-
var shouldRepeat: Bool = false {
|
|
287
|
-
didSet {
|
|
288
|
-
if options.hasRepeatOption() {
|
|
289
|
-
let error = ["error": "Repeat enabled via options"]
|
|
290
|
-
onEncounteredError(error)
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
var scale: Float = defaultPlayerScale {
|
|
296
|
-
didSet {
|
|
297
|
-
mediaPlayer?.scaleFactor = scale
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
var aspectRatio: String? {
|
|
302
|
-
didSet {
|
|
303
|
-
guard let aspectRatio = aspectRatio else {
|
|
304
|
-
mediaPlayer?.videoAspectRatio = nil
|
|
305
|
-
return
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
aspectRatio.withCString { cString in
|
|
309
|
-
mediaPlayer?.videoAspectRatio = UnsafeMutablePointer(mutating: cString)
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
309
|
var audioMixingMode: AudioMixingMode = .auto {
|
|
315
310
|
didSet {
|
|
316
311
|
MediaPlayerManager.shared.setAppropriateAudioSession()
|
|
@@ -325,6 +320,15 @@ class LibVlcPlayerView: ExpoView {
|
|
|
325
320
|
|
|
326
321
|
var autoplay: Bool = true
|
|
327
322
|
|
|
323
|
+
var shouldRepeat: Bool = false {
|
|
324
|
+
didSet {
|
|
325
|
+
if options.hasRepeatOption() {
|
|
326
|
+
let error = ["error": "Repeat enabled via options"]
|
|
327
|
+
onEncounteredError(error)
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
328
332
|
func play() {
|
|
329
333
|
mediaPlayer?.play()
|
|
330
334
|
}
|
|
@@ -49,9 +49,8 @@ class MediaPlayerManager {
|
|
|
49
49
|
var audioSessionCategoryOptions: AVAudioSession.CategoryOptions = audioSession.categoryOptions
|
|
50
50
|
|
|
51
51
|
let isOutputtingAudio = playerViews.allObjects.contains { view in
|
|
52
|
-
guard let player = view.mediaPlayer else { return false }
|
|
53
|
-
|
|
54
|
-
return player.isPlaying && player.audio?.isMuted == false
|
|
52
|
+
guard let player = view.mediaPlayer, let audio = player.audio else { return false }
|
|
53
|
+
return player.isPlaying && audio.volume > minPlayerVolume
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
let shouldMixOverride = audioMixingMode == .mixWithOthers
|
package/package.json
CHANGED
|
@@ -128,18 +128,18 @@ export interface LibVlcPlayerViewNativeProps {
|
|
|
128
128
|
ref?: React.Ref<LibVlcPlayerViewRef>;
|
|
129
129
|
source?: LibVlcSource;
|
|
130
130
|
options?: string[];
|
|
131
|
-
slaves?: Slave[];
|
|
132
131
|
tracks?: Tracks;
|
|
133
|
-
|
|
134
|
-
mute?: boolean;
|
|
135
|
-
rate?: number;
|
|
136
|
-
time?: number;
|
|
137
|
-
repeat?: boolean;
|
|
132
|
+
slaves?: Slave[];
|
|
138
133
|
scale?: number;
|
|
139
134
|
aspectRatio?: string | null;
|
|
135
|
+
rate?: number;
|
|
136
|
+
time?: number;
|
|
137
|
+
volume?: number;
|
|
138
|
+
mute?: boolean;
|
|
140
139
|
audioMixingMode?: AudioMixingMode;
|
|
141
140
|
playInBackground?: boolean;
|
|
142
141
|
autoplay?: boolean;
|
|
142
|
+
repeat?: boolean;
|
|
143
143
|
onBuffering?: BufferingListener;
|
|
144
144
|
onPlaying?: PlayingListener;
|
|
145
145
|
onPaused?: PausedListener;
|
|
@@ -166,6 +166,23 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
166
166
|
* @default []
|
|
167
167
|
*/
|
|
168
168
|
options?: string[];
|
|
169
|
+
/**
|
|
170
|
+
* Sets the player audio, video and subtitle tracks
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```tsx
|
|
174
|
+
* <LibVlcPlayerView
|
|
175
|
+
* tracks={{
|
|
176
|
+
* audio: 1,
|
|
177
|
+
* video: 1,
|
|
178
|
+
* subtitle: -1,
|
|
179
|
+
* }}
|
|
180
|
+
* />
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* @default undefined
|
|
184
|
+
*/
|
|
185
|
+
tracks?: Tracks;
|
|
169
186
|
/**
|
|
170
187
|
* Sets the player audio and subtitle slaves
|
|
171
188
|
*
|
|
@@ -186,34 +203,19 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
186
203
|
*/
|
|
187
204
|
slaves?: Slave[];
|
|
188
205
|
/**
|
|
189
|
-
* Sets the player
|
|
190
|
-
*
|
|
191
|
-
* @example
|
|
192
|
-
* ```tsx
|
|
193
|
-
* <LibVlcPlayerView
|
|
194
|
-
* tracks={{
|
|
195
|
-
* audio: 0,
|
|
196
|
-
* video: 1,
|
|
197
|
-
* subtitle: 2,
|
|
198
|
-
* }}
|
|
199
|
-
* />
|
|
200
|
-
* ```
|
|
206
|
+
* Sets the player scaling factor. Must be a float equal or greater than `0`
|
|
201
207
|
*
|
|
202
|
-
* @default
|
|
208
|
+
* @default 0
|
|
203
209
|
*/
|
|
204
|
-
|
|
210
|
+
scale?: number;
|
|
205
211
|
/**
|
|
206
|
-
* Sets the player
|
|
212
|
+
* Sets the player aspect ratio. Must be a valid string or `null` to reset to default
|
|
207
213
|
*
|
|
208
|
-
* @
|
|
209
|
-
*/
|
|
210
|
-
volume?: number;
|
|
211
|
-
/**
|
|
212
|
-
* Sets the player volume to `0` when `true`
|
|
214
|
+
* @example "16:9"
|
|
213
215
|
*
|
|
214
|
-
* @default
|
|
216
|
+
* @default undefined
|
|
215
217
|
*/
|
|
216
|
-
|
|
218
|
+
aspectRatio?: string | null;
|
|
217
219
|
/**
|
|
218
220
|
* Sets the player rate. Must be a float number
|
|
219
221
|
*
|
|
@@ -227,25 +229,17 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
227
229
|
*/
|
|
228
230
|
time?: number;
|
|
229
231
|
/**
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* @default false
|
|
233
|
-
*/
|
|
234
|
-
repeat?: boolean;
|
|
235
|
-
/**
|
|
236
|
-
* Sets the player scaling factor. Must be a float equal or greater than `0`
|
|
232
|
+
* Sets the player volume. Must be an integer between `0` and `100`
|
|
237
233
|
*
|
|
238
|
-
* @default
|
|
234
|
+
* @default 100
|
|
239
235
|
*/
|
|
240
|
-
|
|
236
|
+
volume?: number;
|
|
241
237
|
/**
|
|
242
|
-
* Sets the player
|
|
243
|
-
*
|
|
244
|
-
* @example "16:9"
|
|
238
|
+
* Sets the player volume to `0` when `true`
|
|
245
239
|
*
|
|
246
|
-
* @default
|
|
240
|
+
* @default false
|
|
247
241
|
*/
|
|
248
|
-
|
|
242
|
+
mute?: boolean;
|
|
249
243
|
/**
|
|
250
244
|
* Determines how the player will interact with other audio playing in the system
|
|
251
245
|
*
|
|
@@ -264,6 +258,12 @@ export interface LibVlcPlayerViewProps extends ViewProps {
|
|
|
264
258
|
* @default true
|
|
265
259
|
*/
|
|
266
260
|
autoplay?: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Determines whether the media should repeat once ended
|
|
263
|
+
*
|
|
264
|
+
* @default false
|
|
265
|
+
*/
|
|
266
|
+
repeat?: boolean;
|
|
267
267
|
/**
|
|
268
268
|
* Called after the `Buffering` player event
|
|
269
269
|
*/
|