expo-libvlc-player 3.4.2 → 3.4.3
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/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/libvlcplayer/LibVlcPlayerView.kt +8 -16
- package/android/src/main/java/expo/modules/libvlcplayer/MediaPlayerListener.kt +9 -22
- package/ios/AudioSessionManager.swift +0 -1
- package/ios/LibVlcPlayerView.swift +8 -16
- package/ios/MediaPlayerDelegate.swift +8 -20
- package/package.json +1 -1
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 = "3.4.
|
|
4
|
+
version = "3.4.3"
|
|
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 "3.4.
|
|
30
|
+
versionName "3.4.3"
|
|
31
31
|
consumerProguardFiles("proguard-rules.pro")
|
|
32
32
|
}
|
|
33
33
|
lintOptions {
|
|
@@ -121,8 +121,7 @@ class LibVlcPlayerView(
|
|
|
121
121
|
try {
|
|
122
122
|
URI(source)
|
|
123
123
|
} catch (_: Exception) {
|
|
124
|
-
|
|
125
|
-
onEncounteredError(error)
|
|
124
|
+
onEncounteredError(mapOf("error" to "Invalid source, media could not be set"))
|
|
126
125
|
return
|
|
127
126
|
}
|
|
128
127
|
|
|
@@ -195,8 +194,7 @@ class LibVlcPlayerView(
|
|
|
195
194
|
try {
|
|
196
195
|
URI(source)
|
|
197
196
|
} catch (_: Exception) {
|
|
198
|
-
|
|
199
|
-
onEncounteredError(error)
|
|
197
|
+
onEncounteredError(mapOf("error" to "Invalid slave, $type could not be added"))
|
|
200
198
|
return@forEach
|
|
201
199
|
}
|
|
202
200
|
|
|
@@ -425,8 +423,7 @@ class LibVlcPlayerView(
|
|
|
425
423
|
field = value
|
|
426
424
|
|
|
427
425
|
if (options.hasAudioOption()) {
|
|
428
|
-
|
|
429
|
-
onEncounteredError(error)
|
|
426
|
+
onEncounteredError(mapOf("error" to "Audio disabled via options"))
|
|
430
427
|
}
|
|
431
428
|
|
|
432
429
|
val newVolume = value.coerceIn(MIN_PLAYER_VOLUME, MAX_PLAYER_VOLUME)
|
|
@@ -443,8 +440,7 @@ class LibVlcPlayerView(
|
|
|
443
440
|
field = value
|
|
444
441
|
|
|
445
442
|
if (options.hasAudioOption()) {
|
|
446
|
-
|
|
447
|
-
onEncounteredError(error)
|
|
443
|
+
onEncounteredError(mapOf("error" to "Audio disabled via options"))
|
|
448
444
|
}
|
|
449
445
|
|
|
450
446
|
val newVolume =
|
|
@@ -475,8 +471,7 @@ class LibVlcPlayerView(
|
|
|
475
471
|
field = value
|
|
476
472
|
|
|
477
473
|
if (options.hasRepeatOption()) {
|
|
478
|
-
|
|
479
|
-
onEncounteredError(error)
|
|
474
|
+
onEncounteredError(mapOf("error" to "Repeat enabled via options"))
|
|
480
475
|
}
|
|
481
476
|
}
|
|
482
477
|
|
|
@@ -538,8 +533,7 @@ class LibVlcPlayerView(
|
|
|
538
533
|
val success = player.record(path)
|
|
539
534
|
|
|
540
535
|
if (!success) {
|
|
541
|
-
|
|
542
|
-
onEncounteredError(error)
|
|
536
|
+
onEncounteredError(mapOf("error" to "Media could not be recorded"))
|
|
543
537
|
|
|
544
538
|
player.record(null)
|
|
545
539
|
}
|
|
@@ -575,14 +569,12 @@ class LibVlcPlayerView(
|
|
|
575
569
|
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream)
|
|
576
570
|
}
|
|
577
571
|
|
|
578
|
-
|
|
579
|
-
onSnapshotTaken(path)
|
|
572
|
+
onSnapshotTaken(mapOf("path" to snapshotPath))
|
|
580
573
|
},
|
|
581
574
|
Handler(Looper.getMainLooper()),
|
|
582
575
|
)
|
|
583
576
|
} catch (_: Exception) {
|
|
584
|
-
|
|
585
|
-
onEncounteredError(error)
|
|
577
|
+
onEncounteredError(mapOf("error" to "Media snapshot could not be taken"))
|
|
586
578
|
}
|
|
587
579
|
}
|
|
588
580
|
}
|
|
@@ -21,9 +21,7 @@ fun LibVlcPlayerView.setMediaPlayerListener() {
|
|
|
21
21
|
|
|
22
22
|
setupPlayer()
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
onFirstPlay(mediaInfo)
|
|
24
|
+
onFirstPlay(getMediaInfo())
|
|
27
25
|
|
|
28
26
|
firstPlay = false
|
|
29
27
|
}
|
|
@@ -64,8 +62,7 @@ fun LibVlcPlayerView.setMediaPlayerListener() {
|
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
Event.EncounteredError -> {
|
|
67
|
-
|
|
68
|
-
onEncounteredError(error)
|
|
65
|
+
onEncounteredError(mapOf("error" to "Media player encountered an error"))
|
|
69
66
|
|
|
70
67
|
MediaPlayerManager.keepAwakeManager.deactivateKeepAwake()
|
|
71
68
|
MediaPlayerManager.audioFocusManager.updateAudioFocus()
|
|
@@ -75,14 +72,11 @@ fun LibVlcPlayerView.setMediaPlayerListener() {
|
|
|
75
72
|
}
|
|
76
73
|
|
|
77
74
|
Event.TimeChanged -> {
|
|
78
|
-
|
|
79
|
-
onTimeChanged(time)
|
|
75
|
+
onTimeChanged(mapOf("time" to player.getTime().toInt()))
|
|
80
76
|
|
|
81
77
|
if (firstTime) {
|
|
82
78
|
if (mediaLength == 0L) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
onFirstPlay(mediaInfo)
|
|
79
|
+
onFirstPlay(getMediaInfo())
|
|
86
80
|
}
|
|
87
81
|
|
|
88
82
|
setContentFit()
|
|
@@ -94,25 +88,18 @@ fun LibVlcPlayerView.setMediaPlayerListener() {
|
|
|
94
88
|
}
|
|
95
89
|
|
|
96
90
|
Event.PositionChanged -> {
|
|
97
|
-
|
|
98
|
-
onPositionChanged(position)
|
|
91
|
+
onPositionChanged(mapOf("position" to player.getPosition()))
|
|
99
92
|
}
|
|
100
93
|
|
|
101
94
|
Event.ESAdded -> {
|
|
102
|
-
|
|
103
|
-
onESAdded(mediaTracks)
|
|
95
|
+
onESAdded(getMediaTracks())
|
|
104
96
|
}
|
|
105
97
|
|
|
106
98
|
Event.RecordChanged -> {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
val path = event.getRecordPath()
|
|
110
|
-
val isRecording = event.getRecording()
|
|
111
|
-
|
|
112
|
-
recording =
|
|
99
|
+
val recording =
|
|
113
100
|
Recording(
|
|
114
|
-
path =
|
|
115
|
-
isRecording =
|
|
101
|
+
path = event.getRecordPath(),
|
|
102
|
+
isRecording = event.getRecording(),
|
|
116
103
|
)
|
|
117
104
|
|
|
118
105
|
onRecordChanged(recording)
|
|
@@ -19,7 +19,6 @@ extension MediaPlayerManager {
|
|
|
19
19
|
let isOutputtingAudio = playerViews.allObjects.contains { view in
|
|
20
20
|
guard let player = view.mediaPlayer else { return false }
|
|
21
21
|
guard let audio = player.audio else { return false }
|
|
22
|
-
|
|
23
22
|
return player.isPlaying && audio.volume > minPlayerVolume
|
|
24
23
|
}
|
|
25
24
|
|
|
@@ -90,8 +90,7 @@ class LibVlcPlayerView: ExpoView {
|
|
|
90
90
|
vlcDialog!.customRenderer = self
|
|
91
91
|
|
|
92
92
|
guard let url = URL(string: source) else {
|
|
93
|
-
|
|
94
|
-
onEncounteredError(error)
|
|
93
|
+
onEncounteredError(["error": "Invalid source, media could not be set"])
|
|
95
94
|
return
|
|
96
95
|
}
|
|
97
96
|
|
|
@@ -135,8 +134,7 @@ class LibVlcPlayerView: ExpoView {
|
|
|
135
134
|
let selected = slave.selected ?? false
|
|
136
135
|
|
|
137
136
|
guard let url = URL(string: source) else {
|
|
138
|
-
|
|
139
|
-
onEncounteredError(error)
|
|
137
|
+
onEncounteredError(["error": "Invalid slave, \(type) could not be added"])
|
|
140
138
|
continue
|
|
141
139
|
}
|
|
142
140
|
|
|
@@ -350,8 +348,7 @@ class LibVlcPlayerView: ExpoView {
|
|
|
350
348
|
var volume: Int = maxPlayerVolume {
|
|
351
349
|
didSet {
|
|
352
350
|
if options.hasAudioOption() {
|
|
353
|
-
|
|
354
|
-
onEncounteredError(error)
|
|
351
|
+
onEncounteredError(["error": "Audio disabled via options"])
|
|
355
352
|
}
|
|
356
353
|
|
|
357
354
|
let newVolume = max(minPlayerVolume, min(maxPlayerVolume, volume))
|
|
@@ -367,8 +364,7 @@ class LibVlcPlayerView: ExpoView {
|
|
|
367
364
|
var mute: Bool = false {
|
|
368
365
|
didSet {
|
|
369
366
|
if options.hasAudioOption() {
|
|
370
|
-
|
|
371
|
-
onEncounteredError(error)
|
|
367
|
+
onEncounteredError(["error": "Audio disabled via options"])
|
|
372
368
|
}
|
|
373
369
|
|
|
374
370
|
let newVolume = mute ?
|
|
@@ -391,8 +387,7 @@ class LibVlcPlayerView: ExpoView {
|
|
|
391
387
|
var shouldRepeat: Bool = false {
|
|
392
388
|
didSet {
|
|
393
389
|
if options.hasRepeatOption() {
|
|
394
|
-
|
|
395
|
-
onEncounteredError(error)
|
|
390
|
+
onEncounteredError(["error": "Repeat enabled via options"])
|
|
396
391
|
}
|
|
397
392
|
}
|
|
398
393
|
}
|
|
@@ -448,8 +443,7 @@ class LibVlcPlayerView: ExpoView {
|
|
|
448
443
|
let success = !player.startRecording(atPath: path)
|
|
449
444
|
|
|
450
445
|
if !success {
|
|
451
|
-
|
|
452
|
-
onEncounteredError(error)
|
|
446
|
+
onEncounteredError(["error": "Media could not be recorded"])
|
|
453
447
|
|
|
454
448
|
player.stopRecording()
|
|
455
449
|
}
|
|
@@ -471,11 +465,9 @@ class LibVlcPlayerView: ExpoView {
|
|
|
471
465
|
|
|
472
466
|
player.saveVideoSnapshot(at: snapshotPath, withWidth: width, andHeight: height)
|
|
473
467
|
|
|
474
|
-
|
|
475
|
-
onSnapshotTaken(path)
|
|
468
|
+
onSnapshotTaken(["path": snapshotPath])
|
|
476
469
|
} else {
|
|
477
|
-
|
|
478
|
-
onEncounteredError(error)
|
|
470
|
+
onEncounteredError(["error": "Media snapshot could not be taken"])
|
|
479
471
|
}
|
|
480
472
|
}
|
|
481
473
|
|
|
@@ -16,9 +16,7 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
16
16
|
if firstPlay {
|
|
17
17
|
setupPlayer()
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
onFirstPlay(mediaInfo)
|
|
19
|
+
onFirstPlay(getMediaInfo())
|
|
22
20
|
|
|
23
21
|
firstPlay = false
|
|
24
22
|
}
|
|
@@ -49,8 +47,7 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
49
47
|
player.play()
|
|
50
48
|
}
|
|
51
49
|
case .error:
|
|
52
|
-
|
|
53
|
-
onEncounteredError(error)
|
|
50
|
+
onEncounteredError(["error": "Media player encountered an error"])
|
|
54
51
|
|
|
55
52
|
MediaPlayerManager.shared.deactivateKeepAwake()
|
|
56
53
|
MediaPlayerManager.shared.setAppropriateAudioSession()
|
|
@@ -58,8 +55,7 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
58
55
|
firstPlay = true
|
|
59
56
|
firstTime = true
|
|
60
57
|
case .esAdded:
|
|
61
|
-
|
|
62
|
-
onESAdded(mediaTracks)
|
|
58
|
+
onESAdded(getMediaTracks())
|
|
63
59
|
default:
|
|
64
60
|
break
|
|
65
61
|
}
|
|
@@ -68,14 +64,11 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
68
64
|
|
|
69
65
|
func mediaPlayerTimeChanged(_: Notification) {
|
|
70
66
|
if let player = mediaPlayer {
|
|
71
|
-
|
|
72
|
-
onTimeChanged(time)
|
|
67
|
+
onTimeChanged(["time": player.time.intValue])
|
|
73
68
|
|
|
74
69
|
if firstTime {
|
|
75
70
|
if mediaLength == 0 {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
onFirstPlay(mediaInfo)
|
|
71
|
+
onFirstPlay(getMediaInfo())
|
|
79
72
|
}
|
|
80
73
|
|
|
81
74
|
setContentFit()
|
|
@@ -85,15 +78,12 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
85
78
|
firstTime = false
|
|
86
79
|
}
|
|
87
80
|
|
|
88
|
-
|
|
89
|
-
onPositionChanged(position)
|
|
81
|
+
onPositionChanged(["position": player.position])
|
|
90
82
|
}
|
|
91
83
|
}
|
|
92
84
|
|
|
93
85
|
func mediaPlayerStartedRecording(_: VLCMediaPlayer) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
recording = Recording(
|
|
86
|
+
let recording = Recording(
|
|
97
87
|
path: nil,
|
|
98
88
|
isRecording: true,
|
|
99
89
|
)
|
|
@@ -102,9 +92,7 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
102
92
|
}
|
|
103
93
|
|
|
104
94
|
func mediaPlayer(_: VLCMediaPlayer, recordingStoppedAtPath path: String) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
recording = Recording(
|
|
95
|
+
let recording = Recording(
|
|
108
96
|
path: path,
|
|
109
97
|
isRecording: false,
|
|
110
98
|
)
|