expo-libvlc-player 6.1.4 → 6.1.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.
|
@@ -134,8 +134,9 @@ class LibVlcPlayerView(
|
|
|
134
134
|
setDialogCallbacks(libVLC!!)
|
|
135
135
|
|
|
136
136
|
mediaPlayer = MediaPlayer(libVLC!!)
|
|
137
|
-
setPlayerListener(mediaPlayer!!)
|
|
138
137
|
attachPlayerLayout(playerLayout)
|
|
138
|
+
setPlayerListener(mediaPlayer!!)
|
|
139
|
+
setupPlayer()
|
|
139
140
|
|
|
140
141
|
try {
|
|
141
142
|
URI(source)
|
|
@@ -332,33 +333,35 @@ class LibVlcPlayerView(
|
|
|
332
333
|
}
|
|
333
334
|
|
|
334
335
|
fun setupPlayer() {
|
|
335
|
-
|
|
336
|
-
|
|
336
|
+
post {
|
|
337
|
+
mediaPlayer?.let { player ->
|
|
338
|
+
addPlayerSlaves()
|
|
337
339
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
340
|
+
if (scale != MediaPlayerConstants.DEFAULT_PLAYER_SCALE) {
|
|
341
|
+
player.setScale(scale)
|
|
342
|
+
}
|
|
341
343
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
344
|
+
if (rate != MediaPlayerConstants.DEFAULT_PLAYER_RATE) {
|
|
345
|
+
player.setRate(rate)
|
|
346
|
+
}
|
|
345
347
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
348
|
+
if (time != MediaPlayerConstants.DEFAULT_PLAYER_TIME) {
|
|
349
|
+
player.setTime(time.toLong())
|
|
350
|
+
}
|
|
349
351
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
352
|
+
if (volume != MediaPlayerConstants.MAX_PLAYER_VOLUME || mute) {
|
|
353
|
+
val newVolume =
|
|
354
|
+
if (mute) {
|
|
355
|
+
MediaPlayerConstants.MIN_PLAYER_VOLUME
|
|
356
|
+
} else {
|
|
357
|
+
volume
|
|
358
|
+
}
|
|
357
359
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
+
player.setVolume(newVolume)
|
|
361
|
+
}
|
|
360
362
|
|
|
361
|
-
|
|
363
|
+
time = MediaPlayerConstants.DEFAULT_PLAYER_TIME
|
|
364
|
+
}
|
|
362
365
|
}
|
|
363
366
|
}
|
|
364
367
|
|
|
@@ -745,12 +748,8 @@ fun LibVlcPlayerView.setPlayerListener(mediaPlayer: MediaPlayer?) {
|
|
|
745
748
|
if (type == Event.Playing) {
|
|
746
749
|
onPlaying(Unit)
|
|
747
750
|
|
|
748
|
-
setPlayerTracks()
|
|
749
|
-
|
|
750
751
|
if (firstPlay) {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
firstPlay = false
|
|
752
|
+
setPlayerTracks()
|
|
754
753
|
|
|
755
754
|
retryUntil { isLastAttempt ->
|
|
756
755
|
if (hasVideoOut || isLastAttempt) {
|
|
@@ -768,6 +767,8 @@ fun LibVlcPlayerView.setPlayerListener(mediaPlayer: MediaPlayer?) {
|
|
|
768
767
|
|
|
769
768
|
return@retryUntil hasVideoSize
|
|
770
769
|
}
|
|
770
|
+
|
|
771
|
+
firstPlay = false
|
|
771
772
|
}
|
|
772
773
|
}
|
|
773
774
|
|
|
@@ -780,6 +781,8 @@ fun LibVlcPlayerView.setPlayerListener(mediaPlayer: MediaPlayer?) {
|
|
|
780
781
|
|
|
781
782
|
resetPlayer()
|
|
782
783
|
|
|
784
|
+
firstPlay = true
|
|
785
|
+
|
|
783
786
|
if (repeat) {
|
|
784
787
|
player.play()
|
|
785
788
|
}
|
|
@@ -88,6 +88,7 @@ class LibVlcPlayerView: ExpoView {
|
|
|
88
88
|
mediaPlayer = VLCMediaPlayer(options: args)
|
|
89
89
|
mediaPlayer!.drawable = drawable
|
|
90
90
|
mediaPlayer!.delegate = self
|
|
91
|
+
setupPlayer()
|
|
91
92
|
|
|
92
93
|
let library = mediaPlayer!.libraryInstance
|
|
93
94
|
vlcDialog = VLCDialogProvider(library: library, customUI: dialogCustomUI)
|
|
@@ -214,30 +215,34 @@ class LibVlcPlayerView: ExpoView {
|
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
func setupPlayer() {
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
DispatchQueue.main.async { [weak self] in
|
|
219
|
+
guard let self else { return }
|
|
219
220
|
|
|
220
|
-
if
|
|
221
|
-
|
|
222
|
-
}
|
|
221
|
+
if let player = mediaPlayer {
|
|
222
|
+
addPlayerSlaves()
|
|
223
223
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
if scale != MediaPlayerConstants.defaultPlayerScale {
|
|
225
|
+
player.scaleFactor = scale
|
|
226
|
+
}
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
if rate != MediaPlayerConstants.defaultPlayerRate {
|
|
229
|
+
player.rate = rate
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if time != MediaPlayerConstants.defaultPlayerTime {
|
|
233
|
+
player.time = VLCTime(int: Int32(time))
|
|
234
|
+
}
|
|
231
235
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
+
if volume != MediaPlayerConstants.maxPlayerVolume || mute {
|
|
237
|
+
let newVolume = mute ?
|
|
238
|
+
MediaPlayerConstants.minPlayerVolume :
|
|
239
|
+
volume
|
|
236
240
|
|
|
237
|
-
|
|
238
|
-
|
|
241
|
+
player.audio?.volume = Int32(newVolume)
|
|
242
|
+
}
|
|
239
243
|
|
|
240
|
-
|
|
244
|
+
time = MediaPlayerConstants.defaultPlayerTime
|
|
245
|
+
}
|
|
241
246
|
}
|
|
242
247
|
}
|
|
243
248
|
|
|
@@ -566,12 +571,8 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
566
571
|
if newState == .playing {
|
|
567
572
|
onPlaying()
|
|
568
573
|
|
|
569
|
-
setPlayerTracks()
|
|
570
|
-
|
|
571
574
|
if firstPlay {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
firstPlay = false
|
|
575
|
+
setPlayerTracks()
|
|
575
576
|
|
|
576
577
|
retryUntil { [weak self] isLastAttempt in
|
|
577
578
|
guard let self else { return true }
|
|
@@ -593,6 +594,8 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
593
594
|
|
|
594
595
|
return hasVideoSize
|
|
595
596
|
}
|
|
597
|
+
|
|
598
|
+
firstPlay = false
|
|
596
599
|
}
|
|
597
600
|
}
|
|
598
601
|
|
|
@@ -603,6 +606,8 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
603
606
|
if newState == .stopped {
|
|
604
607
|
onStopped()
|
|
605
608
|
|
|
609
|
+
firstPlay = true
|
|
610
|
+
|
|
606
611
|
if shouldRepeat {
|
|
607
612
|
player.play()
|
|
608
613
|
}
|