expo-libvlc-player 1.0.4 → 1.0.6

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 CHANGED
@@ -45,11 +45,11 @@ No additional configuration necessary.
45
45
 
46
46
  #### Black screen issue
47
47
 
48
- On Android, the `libvlcjni` player detaches from the View when the surface is destroyed after switching screens.
48
+ On Android, the `libvlcjni` player detaches from the View when surfaces are destroyed after switching screens.
49
49
 
50
50
  This causes nothing to be displayed when coming back to the screen as native resources are released automatically.
51
51
 
52
- The current workaround attaches the View when the surface is created but this results in a brief black screen.
52
+ The current workaround attaches the View once surfaces are created but this results in a brief black screen.
53
53
 
54
54
  ### Configure for iOS
55
55
 
@@ -122,22 +122,22 @@ See the [Example App](example/components/PlayerView.tsx) for additional usage.
122
122
 
123
123
  The `LibVlcPlayerView` extends React Native `ViewProps` and implements the following:
124
124
 
125
- | Prop | Description | Default |
126
- | ------------------ | ---------------------------------------------------------------------------------- | ----------- |
127
- | `source` | Sets the source of the media to be played | |
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
- | `tracks` | Sets the player audio, video and subtitle tracks. See [`Tracks`](#tracks) for more | `undefined` |
131
- | `volume` | Sets the player volume. Must be an integer between `0` and `100` | `100` |
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` |
136
- | `scale` | Sets the player scaling factor. Must be a float equal or greater than `0` | `0` |
137
- | `aspectRatio` | Sets the player aspect ratio. Must be a valid string or `null` for default | `undefined` |
138
- | `audioMixingMode` | Determines how the player will interact with other audio in the system | `"auto"` |
139
- | `playInBackground` | Determines whether the player should continue playing in the background | `false` |
140
- | `autoplay` | Determines whether the media should autoplay once created | `true` |
125
+ | Prop | Description | Default |
126
+ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------- | ----------- |
127
+ | `source` | Sets the source of the media to be played. Set to `null` to release the player | |
128
+ | `options` | Sets the VLC options to initialize the player with. See the [VLC Wiki](https://wiki.videolan.org/VLC_command-line_help/) for more | `[]` |
129
+ | `tracks` | Sets the player audio, video and subtitle tracks. See [`Tracks`](#tracks) for more | `undefined` |
130
+ | `slaves` | Sets the player audio and subtitle slaves. See [`Slave`](#slave) for more | `[]` |
131
+ | `scale` | Sets the player scaling factor. Must be a float equal or greater than `0` | `0` |
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 equal or greater than `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`. Previous value is set when `false` | `false` |
137
+ | `audioMixingMode` | Determines how the player will interact with other audio in the system | `"auto"` |
138
+ | `playInBackground` | Determines whether the player should continue playing in the background | `false` |
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 playing player event | [`MediaInfo`](#mediainfo) |
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": 0,
172
+ "audio": 1,
173
173
  "video": 1,
174
- "subtitle": 2
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": 0, "name": "English 5.1 Surround - [English]" }
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": 2, "name": "Track 1 - [Japanese]" }
195
+ { "id": 1, "name": "Track 1 - [Japanese]" }
196
196
  ]
197
197
  },
198
198
  "duration": 78920,
@@ -1,7 +1,7 @@
1
1
  apply plugin: "com.android.library"
2
2
 
3
3
  group = "expo.modules.libvlcplayer"
4
- version = "1.0.4"
4
+ version = "1.0.6"
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.4"
30
+ versionName "1.0.6"
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("volume") { view: LibVlcPlayerView, volume: Int? ->
65
- view.volume = volume ?: MAX_PLAYER_VOLUME
60
+ Prop("slaves") { view: LibVlcPlayerView, slaves: ArrayList<Slave>? ->
61
+ view.slaves = slaves ?: ArrayList<Slave>()
66
62
  }
67
63
 
68
- Prop("mute") { view: LibVlcPlayerView, mute: Boolean? ->
69
- view.mute = mute ?: false
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("repeat") { view: LibVlcPlayerView, repeat: Boolean? ->
81
- view.repeat = repeat ?: false
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("aspectRatio") { view: LibVlcPlayerView, aspectRatio: String? ->
89
- view.aspectRatio = aspectRatio
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()
@@ -243,13 +243,29 @@ class LibVlcPlayerView(
243
243
 
244
244
  if (source != null) {
245
245
  shouldCreate = value != old
246
- } else {
247
- destroyPlayer()
248
246
  }
249
247
 
250
248
  field = value
251
249
  }
252
250
 
251
+ fun setPlayerTracks() {
252
+ mediaPlayer?.let { player ->
253
+ val audioTrack = tracks?.audio ?: player.getAudioTrack()
254
+ val videoTrack = tracks?.video ?: player.getVideoTrack()
255
+ val spuTrack = tracks?.subtitle ?: player.getSpuTrack()
256
+
257
+ player.setAudioTrack(audioTrack)
258
+ player.setVideoTrack(videoTrack)
259
+ player.setSpuTrack(spuTrack)
260
+ }
261
+ }
262
+
263
+ var tracks: Tracks? = null
264
+ set(value) {
265
+ setPlayerTracks()
266
+ field = value
267
+ }
268
+
253
269
  fun addPlayerSlaves() {
254
270
  slaves.forEach { slave ->
255
271
  val type = slave.type
@@ -277,24 +293,26 @@ class LibVlcPlayerView(
277
293
  field = value
278
294
  }
279
295
 
280
- fun setPlayerTracks() {
281
- mediaPlayer?.let { player ->
282
- val audioTrack = tracks?.audio ?: player.getAudioTrack()
283
- val videoTrack = tracks?.video ?: player.getVideoTrack()
284
- val spuTrack = tracks?.subtitle ?: player.getSpuTrack()
296
+ var scale: Float = DEFAULT_PLAYER_SCALE
297
+ set(value) {
298
+ mediaPlayer?.setScale(value)
299
+ field = value
300
+ }
285
301
 
286
- player.setAudioTrack(audioTrack)
287
- player.setVideoTrack(videoTrack)
288
- player.setSpuTrack(spuTrack)
302
+ var aspectRatio: String? = null
303
+ set(value) {
304
+ mediaPlayer?.setAspectRatio(value)
305
+ field = value
289
306
  }
290
- }
291
307
 
292
- var tracks: Tracks? = null
308
+ var rate: Float = DEFAULT_PLAYER_RATE
293
309
  set(value) {
294
- setPlayerTracks()
310
+ mediaPlayer?.setRate(value)
295
311
  field = value
296
312
  }
297
313
 
314
+ var time: Int = DEFAULT_PLAYER_TIME
315
+
298
316
  var volume: Int = MAX_PLAYER_VOLUME
299
317
  set(value) {
300
318
  if (options.hasAudioOption()) {
@@ -316,7 +334,7 @@ class LibVlcPlayerView(
316
334
 
317
335
  var mute: Boolean = false
318
336
  set(value) {
319
- if (!value && options.hasAudioOption()) {
337
+ if (options.hasAudioOption() && !value) {
320
338
  val error = mapOf("error" to "Audio disabled via options")
321
339
  onEncounteredError(error)
322
340
  }
@@ -334,13 +352,19 @@ class LibVlcPlayerView(
334
352
  field = value
335
353
  }
336
354
 
337
- var rate: Float = DEFAULT_PLAYER_RATE
355
+ var audioMixingMode: AudioMixingMode = AudioMixingMode.AUTO
338
356
  set(value) {
339
- mediaPlayer?.setRate(value)
357
+ MediaPlayerManager.audioFocusManager.updateAudioFocus()
340
358
  field = value
341
359
  }
342
360
 
343
- var time: Int = DEFAULT_PLAYER_TIME
361
+ var playInBackground: Boolean = false
362
+ set(value) {
363
+ MediaPlayerManager.audioFocusManager.updateAudioFocus()
364
+ field = value
365
+ }
366
+
367
+ var autoplay: Boolean = true
344
368
 
345
369
  var repeat: Boolean = false
346
370
  set(value) {
@@ -352,32 +376,6 @@ class LibVlcPlayerView(
352
376
  field = value
353
377
  }
354
378
 
355
- var scale: Float = DEFAULT_PLAYER_SCALE
356
- set(value) {
357
- mediaPlayer?.setScale(value)
358
- field = value
359
- }
360
-
361
- var aspectRatio: String? = null
362
- set(value) {
363
- mediaPlayer?.setAspectRatio(value)
364
- field = value
365
- }
366
-
367
- var audioMixingMode: AudioMixingMode = AudioMixingMode.AUTO
368
- set(value) {
369
- MediaPlayerManager.audioFocusManager.updateAudioFocus()
370
- field = value
371
- }
372
-
373
- var playInBackground: Boolean = false
374
- set(value) {
375
- MediaPlayerManager.audioFocusManager.updateAudioFocus()
376
- field = value
377
- }
378
-
379
- var autoplay: Boolean = true
380
-
381
379
  fun play() {
382
380
  mediaPlayer?.play()
383
381
  }
@@ -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
- volume?: number;
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;
@@ -135,19 +135,36 @@ export interface LibVlcPlayerViewNativeProps {
135
135
  }
136
136
  export interface LibVlcPlayerViewProps extends ViewProps {
137
137
  /**
138
- * Sets the source of the media to be played
138
+ * Sets the source of the media to be played. Set to `null` to release the player
139
139
  */
140
140
  source: LibVlcSource;
141
141
  /**
142
- * https://wiki.videolan.org/VLC_command-line_help/
143
- *
144
142
  * Sets the VLC options to initialize the player with
145
143
  *
144
+ * https://wiki.videolan.org/VLC_command-line_help/
145
+ *
146
146
  * @example ["--network-caching=1000"]
147
147
  *
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,36 +185,21 @@ export interface LibVlcPlayerViewProps extends ViewProps {
168
185
  */
169
186
  slaves?: Slave[];
170
187
  /**
171
- * Sets the player audio, video and subtitle tracks
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 undefined
190
+ * @default 0
185
191
  */
186
- tracks?: Tracks;
192
+ scale?: number;
187
193
  /**
188
- * Sets the player volume. Must be an integer between `0` and `100`
194
+ * Sets the player aspect ratio. Must be a valid string or `null` for default
189
195
  *
190
- * @default 100
191
- */
192
- volume?: number;
193
- /**
194
- * Sets the player volume to `0` when `true`
196
+ * @example "16:9"
195
197
  *
196
- * @default false
198
+ * @default undefined
197
199
  */
198
- mute?: boolean;
200
+ aspectRatio?: string | null;
199
201
  /**
200
- * Sets the player rate. Must be a float number
202
+ * Sets the player rate. Must be a float equal or greater than `1`
201
203
  *
202
204
  * @default 1
203
205
  */
@@ -209,25 +211,17 @@ export interface LibVlcPlayerViewProps extends ViewProps {
209
211
  */
210
212
  time?: number;
211
213
  /**
212
- * Determines whether the player should repeat the media after playback ends
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 0
216
+ * @default 100
221
217
  */
222
- scale?: number;
218
+ volume?: number;
223
219
  /**
224
- * Sets the player aspect ratio. Must be a valid string or `null` to reset to default
225
- *
226
- * @example "16:9"
220
+ * Sets the player volume to `0` when `true`. Previous value is set when `false`
227
221
  *
228
- * @default undefined
222
+ * @default false
229
223
  */
230
- aspectRatio?: string | null;
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
  */
@@ -275,7 +275,7 @@ export interface LibVlcPlayerViewProps extends ViewProps {
275
275
  */
276
276
  onPositionChanged?: (event: Position) => void;
277
277
  /**
278
- * Called after the first playing player event
278
+ * Called after the first `Playing` player event
279
279
  */
280
280
  onFirstPlay?: (event: MediaInfo) => void;
281
281
  /**
@@ -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,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,KAAK,EAAE,KAAK,EAA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B;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,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 slaves?: Slave[];\n tracks?: Tracks;\n volume?: number;\n mute?: boolean;\n rate?: number;\n time?: number;\n repeat?: boolean;\n scale?: number;\n aspectRatio?: string | null;\n audioMixingMode?: AudioMixingMode;\n playInBackground?: boolean;\n autoplay?: 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 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 audio, video and subtitle tracks\n *\n * @example\n * ```tsx\n * <LibVlcPlayerView\n * tracks={{\n * audio: 0,\n * video: 1,\n * subtitle: 2,\n * }}\n * />\n * ```\n *\n * @default undefined\n */\n tracks?: Tracks;\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 * 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 * Determines whether the player should repeat the media after playback ends\n *\n * @default false\n */\n repeat?: boolean;\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 * 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 * 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"]}
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. Set to `null` to release the player\n */\n source: LibVlcSource;\n /**\n * Sets the VLC options to initialize the player with\n *\n * https://wiki.videolan.org/VLC_command-line_help/\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` for 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 equal or greater than `1`\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`. Previous value is set when `false`\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("volume") { (view: LibVlcPlayerView, volume: Int?) in
53
- view.volume = volume ?? maxPlayerVolume
48
+ Prop("slaves") { (view: LibVlcPlayerView, slaves: [Slave]?) in
49
+ view.slaves = slaves ?? [Slave]()
54
50
  }
55
51
 
56
- Prop("mute") { (view: LibVlcPlayerView, mute: Bool?) in
57
- view.mute = mute ?? false
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("repeat") { (view: LibVlcPlayerView, shouldRepeat: Bool?) in
69
- view.shouldRepeat = shouldRepeat ?? false
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("aspectRatio") { (view: LibVlcPlayerView, aspectRatio: String?) in
77
- view.aspectRatio = aspectRatio
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
  }
@@ -196,12 +196,28 @@ class LibVlcPlayerView: ExpoView {
196
196
  didSet {
197
197
  if source != nil {
198
198
  shouldCreate = options != oldValue
199
- } else {
200
- destroyPlayer()
201
199
  }
202
200
  }
203
201
  }
204
202
 
203
+ func setPlayerTracks() {
204
+ guard let player = mediaPlayer else { return }
205
+
206
+ let audioTrackIndex = tracks?.audio ?? Int(player.currentAudioTrackIndex)
207
+ let videoTrackIndex = tracks?.video ?? Int(player.currentVideoTrackIndex)
208
+ let videoSubTitleIndex = tracks?.subtitle ?? Int(player.currentVideoSubTitleIndex)
209
+
210
+ player.currentAudioTrackIndex = Int32(audioTrackIndex)
211
+ player.currentVideoTrackIndex = Int32(videoTrackIndex)
212
+ player.currentVideoSubTitleIndex = Int32(videoSubTitleIndex)
213
+ }
214
+
215
+ var tracks: Tracks? {
216
+ didSet {
217
+ setPlayerTracks()
218
+ }
219
+ }
220
+
205
221
  func addPlayerSlaves() {
206
222
  for slave in slaves {
207
223
  let source = slave.source
@@ -227,24 +243,33 @@ class LibVlcPlayerView: ExpoView {
227
243
  }
228
244
  }
229
245
 
230
- func setPlayerTracks() {
231
- guard let player = mediaPlayer else { return }
246
+ var scale: Float = defaultPlayerScale {
247
+ didSet {
248
+ mediaPlayer?.scaleFactor = scale
249
+ }
250
+ }
232
251
 
233
- let audioTrackIndex = tracks?.audio ?? Int(player.currentAudioTrackIndex)
234
- let videoTrackIndex = tracks?.video ?? Int(player.currentVideoTrackIndex)
235
- let videoSubTitleIndex = tracks?.subtitle ?? Int(player.currentVideoSubTitleIndex)
252
+ var aspectRatio: String? {
253
+ didSet {
254
+ guard let aspectRatio = aspectRatio else {
255
+ mediaPlayer?.videoAspectRatio = nil
256
+ return
257
+ }
236
258
 
237
- player.currentAudioTrackIndex = Int32(audioTrackIndex)
238
- player.currentVideoTrackIndex = Int32(videoTrackIndex)
239
- player.currentVideoSubTitleIndex = Int32(videoSubTitleIndex)
259
+ aspectRatio.withCString { cString in
260
+ mediaPlayer?.videoAspectRatio = UnsafeMutablePointer(mutating: cString)
261
+ }
262
+ }
240
263
  }
241
264
 
242
- var tracks: Tracks? {
265
+ var rate: Float = defaultPlayerRate {
243
266
  didSet {
244
- setPlayerTracks()
267
+ mediaPlayer?.rate = rate
245
268
  }
246
269
  }
247
270
 
271
+ var time: Int = defaultPlayerTime
272
+
248
273
  var volume: Int = maxPlayerVolume {
249
274
  didSet {
250
275
  if options.hasAudioOption() {
@@ -265,7 +290,7 @@ class LibVlcPlayerView: ExpoView {
265
290
 
266
291
  var mute: Bool = false {
267
292
  didSet {
268
- if !mute, options.hasAudioOption() {
293
+ if options.hasAudioOption(), !mute {
269
294
  let error = ["error": "Audio disabled via options"]
270
295
  onEncounteredError(error)
271
296
  }
@@ -279,42 +304,6 @@ class LibVlcPlayerView: ExpoView {
279
304
  }
280
305
  }
281
306
 
282
- var rate: Float = defaultPlayerRate {
283
- didSet {
284
- mediaPlayer?.rate = rate
285
- }
286
- }
287
-
288
- var time: Int = defaultPlayerTime
289
-
290
- var shouldRepeat: Bool = false {
291
- didSet {
292
- if options.hasRepeatOption() {
293
- let error = ["error": "Repeat enabled via options"]
294
- onEncounteredError(error)
295
- }
296
- }
297
- }
298
-
299
- var scale: Float = defaultPlayerScale {
300
- didSet {
301
- mediaPlayer?.scaleFactor = scale
302
- }
303
- }
304
-
305
- var aspectRatio: String? {
306
- didSet {
307
- guard let aspectRatio = aspectRatio else {
308
- mediaPlayer?.videoAspectRatio = nil
309
- return
310
- }
311
-
312
- aspectRatio.withCString { cString in
313
- mediaPlayer?.videoAspectRatio = UnsafeMutablePointer(mutating: cString)
314
- }
315
- }
316
- }
317
-
318
307
  var audioMixingMode: AudioMixingMode = .auto {
319
308
  didSet {
320
309
  MediaPlayerManager.shared.setAppropriateAudioSession()
@@ -329,6 +318,15 @@ class LibVlcPlayerView: ExpoView {
329
318
 
330
319
  var autoplay: Bool = true
331
320
 
321
+ var shouldRepeat: Bool = false {
322
+ didSet {
323
+ if options.hasRepeatOption() {
324
+ let error = ["error": "Repeat enabled via options"]
325
+ onEncounteredError(error)
326
+ }
327
+ }
328
+ }
329
+
332
330
  func play() {
333
331
  mediaPlayer?.play()
334
332
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-libvlc-player",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "LibVLC Player for Expo",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -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
- volume?: number;
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;
@@ -153,19 +153,36 @@ export interface LibVlcPlayerViewNativeProps {
153
153
 
154
154
  export interface LibVlcPlayerViewProps extends ViewProps {
155
155
  /**
156
- * Sets the source of the media to be played
156
+ * Sets the source of the media to be played. Set to `null` to release the player
157
157
  */
158
158
  source: LibVlcSource;
159
159
  /**
160
- * https://wiki.videolan.org/VLC_command-line_help/
161
- *
162
160
  * Sets the VLC options to initialize the player with
163
161
  *
162
+ * https://wiki.videolan.org/VLC_command-line_help/
163
+ *
164
164
  * @example ["--network-caching=1000"]
165
165
  *
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,36 +203,21 @@ export interface LibVlcPlayerViewProps extends ViewProps {
186
203
  */
187
204
  slaves?: Slave[];
188
205
  /**
189
- * Sets the player audio, video and subtitle tracks
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 undefined
208
+ * @default 0
203
209
  */
204
- tracks?: Tracks;
210
+ scale?: number;
205
211
  /**
206
- * Sets the player volume. Must be an integer between `0` and `100`
212
+ * Sets the player aspect ratio. Must be a valid string or `null` for default
207
213
  *
208
- * @default 100
209
- */
210
- volume?: number;
211
- /**
212
- * Sets the player volume to `0` when `true`
214
+ * @example "16:9"
213
215
  *
214
- * @default false
216
+ * @default undefined
215
217
  */
216
- mute?: boolean;
218
+ aspectRatio?: string | null;
217
219
  /**
218
- * Sets the player rate. Must be a float number
220
+ * Sets the player rate. Must be a float equal or greater than `1`
219
221
  *
220
222
  * @default 1
221
223
  */
@@ -227,25 +229,17 @@ export interface LibVlcPlayerViewProps extends ViewProps {
227
229
  */
228
230
  time?: number;
229
231
  /**
230
- * Determines whether the player should repeat the media after playback ends
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 0
234
+ * @default 100
239
235
  */
240
- scale?: number;
236
+ volume?: number;
241
237
  /**
242
- * Sets the player aspect ratio. Must be a valid string or `null` to reset to default
243
- *
244
- * @example "16:9"
238
+ * Sets the player volume to `0` when `true`. Previous value is set when `false`
245
239
  *
246
- * @default undefined
240
+ * @default false
247
241
  */
248
- aspectRatio?: string | null;
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
  */
@@ -293,7 +293,7 @@ export interface LibVlcPlayerViewProps extends ViewProps {
293
293
  */
294
294
  onPositionChanged?: (event: Position) => void;
295
295
  /**
296
- * Called after the first playing player event
296
+ * Called after the first `Playing` player event
297
297
  */
298
298
  onFirstPlay?: (event: MediaInfo) => void;
299
299
  /**