expo-libvlc-player 1.0.4 → 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 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
- | `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` |
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 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.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.4"
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("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()
@@ -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
- 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()
298
+ var scale: Float = DEFAULT_PLAYER_SCALE
299
+ set(value) {
300
+ mediaPlayer?.setScale(value)
301
+ field = value
302
+ }
285
303
 
286
- player.setAudioTrack(audioTrack)
287
- player.setVideoTrack(videoTrack)
288
- player.setSpuTrack(spuTrack)
304
+ var aspectRatio: String? = null
305
+ set(value) {
306
+ mediaPlayer?.setAspectRatio(value)
307
+ field = value
289
308
  }
290
- }
291
309
 
292
- var tracks: Tracks? = null
310
+ var rate: Float = DEFAULT_PLAYER_RATE
293
311
  set(value) {
294
- setPlayerTracks()
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()) {
@@ -316,7 +336,7 @@ class LibVlcPlayerView(
316
336
 
317
337
  var mute: Boolean = false
318
338
  set(value) {
319
- if (!value && options.hasAudioOption()) {
339
+ if (options.hasAudioOption() && !value) {
320
340
  val error = mapOf("error" to "Audio disabled via options")
321
341
  onEncounteredError(error)
322
342
  }
@@ -334,13 +354,19 @@ class LibVlcPlayerView(
334
354
  field = value
335
355
  }
336
356
 
337
- var rate: Float = DEFAULT_PLAYER_RATE
357
+ var audioMixingMode: AudioMixingMode = AudioMixingMode.AUTO
338
358
  set(value) {
339
- mediaPlayer?.setRate(value)
359
+ MediaPlayerManager.audioFocusManager.updateAudioFocus()
340
360
  field = value
341
361
  }
342
362
 
343
- var time: Int = DEFAULT_PLAYER_TIME
363
+ var playInBackground: Boolean = false
364
+ set(value) {
365
+ MediaPlayerManager.audioFocusManager.updateAudioFocus()
366
+ field = value
367
+ }
368
+
369
+ var autoplay: Boolean = true
344
370
 
345
371
  var repeat: Boolean = false
346
372
  set(value) {
@@ -352,32 +378,6 @@ class LibVlcPlayerView(
352
378
  field = value
353
379
  }
354
380
 
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
381
  fun play() {
382
382
  mediaPlayer?.play()
383
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
- 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;
@@ -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 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` to reset to 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
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
- * 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`
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
  */
@@ -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,CA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;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\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("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
  }
@@ -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
- func setPlayerTracks() {
231
- guard let player = mediaPlayer else { return }
248
+ var scale: Float = defaultPlayerScale {
249
+ didSet {
250
+ mediaPlayer?.scaleFactor = scale
251
+ }
252
+ }
232
253
 
233
- let audioTrackIndex = tracks?.audio ?? Int(player.currentAudioTrackIndex)
234
- let videoTrackIndex = tracks?.video ?? Int(player.currentVideoTrackIndex)
235
- let videoSubTitleIndex = tracks?.subtitle ?? Int(player.currentVideoSubTitleIndex)
254
+ var aspectRatio: String? {
255
+ didSet {
256
+ guard let aspectRatio = aspectRatio else {
257
+ mediaPlayer?.videoAspectRatio = nil
258
+ return
259
+ }
236
260
 
237
- player.currentAudioTrackIndex = Int32(audioTrackIndex)
238
- player.currentVideoTrackIndex = Int32(videoTrackIndex)
239
- player.currentVideoSubTitleIndex = Int32(videoSubTitleIndex)
261
+ aspectRatio.withCString { cString in
262
+ mediaPlayer?.videoAspectRatio = UnsafeMutablePointer(mutating: cString)
263
+ }
264
+ }
240
265
  }
241
266
 
242
- var tracks: Tracks? {
267
+ var rate: Float = defaultPlayerRate {
243
268
  didSet {
244
- setPlayerTracks()
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() {
@@ -265,7 +292,7 @@ class LibVlcPlayerView: ExpoView {
265
292
 
266
293
  var mute: Bool = false {
267
294
  didSet {
268
- if !mute, options.hasAudioOption() {
295
+ if options.hasAudioOption(), !mute {
269
296
  let error = ["error": "Audio disabled via options"]
270
297
  onEncounteredError(error)
271
298
  }
@@ -279,42 +306,6 @@ class LibVlcPlayerView: ExpoView {
279
306
  }
280
307
  }
281
308
 
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
309
  var audioMixingMode: AudioMixingMode = .auto {
319
310
  didSet {
320
311
  MediaPlayerManager.shared.setAppropriateAudioSession()
@@ -329,6 +320,15 @@ class LibVlcPlayerView: ExpoView {
329
320
 
330
321
  var autoplay: Bool = true
331
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
+
332
332
  func play() {
333
333
  mediaPlayer?.play()
334
334
  }
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.5",
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;
@@ -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 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` to reset to 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
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
- * 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`
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
  */