expo-libvlc-player 2.2.0 → 2.2.2
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 -2
- package/android/src/main/java/expo/modules/libvlcplayer/MediaPlayerListener.kt +9 -6
- package/ios/LibVlcPlayerView.swift +8 -2
- package/ios/MediaPlayerDelegate.swift +9 -6
- 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 = "2.2.
|
|
4
|
+
version = "2.2.2"
|
|
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 "2.2.
|
|
30
|
+
versionName "2.2.2"
|
|
31
31
|
consumerProguardFiles("proguard-rules.pro")
|
|
32
32
|
}
|
|
33
33
|
lintOptions {
|
|
@@ -52,6 +52,7 @@ class LibVlcPlayerView(
|
|
|
52
52
|
|
|
53
53
|
private var shouldCreate: Boolean = false
|
|
54
54
|
internal var firstPlay: Boolean = false
|
|
55
|
+
internal var firstPosition: Boolean = false
|
|
55
56
|
|
|
56
57
|
internal val onBuffering by EventDispatcher<Unit>()
|
|
57
58
|
internal val onPlaying by EventDispatcher<Unit>()
|
|
@@ -116,8 +117,9 @@ class LibVlcPlayerView(
|
|
|
116
117
|
|
|
117
118
|
mediaPlayer!!.play()
|
|
118
119
|
|
|
119
|
-
firstPlay = true
|
|
120
120
|
shouldCreate = false
|
|
121
|
+
firstPlay = true
|
|
122
|
+
firstPosition = true
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
fun attachPlayer() {
|
|
@@ -441,7 +443,11 @@ class LibVlcPlayerView(
|
|
|
441
443
|
player.setTime(value.toLong())
|
|
442
444
|
}
|
|
443
445
|
} else {
|
|
444
|
-
|
|
446
|
+
if (type == "position") {
|
|
447
|
+
time = (value * mediaLength.toDouble()).toInt()
|
|
448
|
+
} else {
|
|
449
|
+
time = value.toInt()
|
|
450
|
+
}
|
|
445
451
|
}
|
|
446
452
|
}
|
|
447
453
|
}
|
|
@@ -22,9 +22,7 @@ fun LibVlcPlayerView.setMediaPlayerListener() {
|
|
|
22
22
|
|
|
23
23
|
val mediaInfo = getMediaInfo()
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
onFirstPlay(mediaInfo)
|
|
27
|
-
}
|
|
25
|
+
onFirstPlay(mediaInfo)
|
|
28
26
|
|
|
29
27
|
firstPlay = false
|
|
30
28
|
}
|
|
@@ -42,6 +40,7 @@ fun LibVlcPlayerView.setMediaPlayerListener() {
|
|
|
42
40
|
detachPlayer()
|
|
43
41
|
|
|
44
42
|
firstPlay = true
|
|
43
|
+
firstPosition = true
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
Event.EndReached -> {
|
|
@@ -62,6 +61,7 @@ fun LibVlcPlayerView.setMediaPlayerListener() {
|
|
|
62
61
|
onEncounteredError(error)
|
|
63
62
|
|
|
64
63
|
firstPlay = true
|
|
64
|
+
firstPosition = true
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
Event.TimeChanged -> {
|
|
@@ -75,18 +75,21 @@ fun LibVlcPlayerView.setMediaPlayerListener() {
|
|
|
75
75
|
|
|
76
76
|
onPositionChanged(position)
|
|
77
77
|
|
|
78
|
-
if (
|
|
79
|
-
|
|
78
|
+
if (firstPosition) {
|
|
79
|
+
if (mediaLength == 0L) {
|
|
80
|
+
val mediaInfo = getMediaInfo()
|
|
80
81
|
|
|
81
|
-
if (mediaInfo.length != 0.0) {
|
|
82
82
|
onFirstPlay(mediaInfo)
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
firstPosition = false
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
Event.ESAdded -> {
|
|
88
90
|
if (!firstPlay) {
|
|
89
91
|
val mediaTracks = getMediaTracks()
|
|
92
|
+
|
|
90
93
|
onESAdded(mediaTracks)
|
|
91
94
|
}
|
|
92
95
|
}
|
|
@@ -24,6 +24,7 @@ class LibVlcPlayerView: ExpoView {
|
|
|
24
24
|
|
|
25
25
|
private var shouldCreate: Bool = false
|
|
26
26
|
var firstPlay: Bool = false
|
|
27
|
+
var firstPosition: Bool = false
|
|
27
28
|
|
|
28
29
|
let onBuffering = EventDispatcher()
|
|
29
30
|
let onPlaying = EventDispatcher()
|
|
@@ -90,8 +91,9 @@ class LibVlcPlayerView: ExpoView {
|
|
|
90
91
|
|
|
91
92
|
mediaPlayer!.play()
|
|
92
93
|
|
|
93
|
-
firstPlay = true
|
|
94
94
|
shouldCreate = false
|
|
95
|
+
firstPlay = true
|
|
96
|
+
firstPosition = true
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
func destroyPlayer() {
|
|
@@ -390,7 +392,11 @@ class LibVlcPlayerView: ExpoView {
|
|
|
390
392
|
player.time = VLCTime(int: Int32(value))
|
|
391
393
|
}
|
|
392
394
|
} else {
|
|
393
|
-
|
|
395
|
+
if type == "position" {
|
|
396
|
+
time = Int(value * Double(mediaLength))
|
|
397
|
+
} else {
|
|
398
|
+
time = Int(value)
|
|
399
|
+
}
|
|
394
400
|
}
|
|
395
401
|
}
|
|
396
402
|
}
|
|
@@ -14,9 +14,7 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
14
14
|
|
|
15
15
|
let mediaInfo = getMediaInfo()
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
onFirstPlay(mediaInfo)
|
|
19
|
-
}
|
|
17
|
+
onFirstPlay(mediaInfo)
|
|
20
18
|
|
|
21
19
|
firstPlay = false
|
|
22
20
|
}
|
|
@@ -28,6 +26,7 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
28
26
|
onStopped()
|
|
29
27
|
|
|
30
28
|
firstPlay = true
|
|
29
|
+
firstPosition = true
|
|
31
30
|
case .ended:
|
|
32
31
|
onEndReached()
|
|
33
32
|
|
|
@@ -44,9 +43,11 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
44
43
|
onEncounteredError(error)
|
|
45
44
|
|
|
46
45
|
firstPlay = true
|
|
46
|
+
firstPosition = true
|
|
47
47
|
case .esAdded:
|
|
48
48
|
if !firstPlay {
|
|
49
49
|
let mediaTracks = getMediaTracks()
|
|
50
|
+
|
|
50
51
|
onESAdded(mediaTracks)
|
|
51
52
|
}
|
|
52
53
|
default:
|
|
@@ -65,12 +66,14 @@ extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
|
65
66
|
|
|
66
67
|
onPositionChanged(position)
|
|
67
68
|
|
|
68
|
-
if
|
|
69
|
-
|
|
69
|
+
if firstPosition {
|
|
70
|
+
if mediaLength == 0 {
|
|
71
|
+
let mediaInfo = getMediaInfo()
|
|
70
72
|
|
|
71
|
-
if mediaInfo.length != 0.0 {
|
|
72
73
|
onFirstPlay(mediaInfo)
|
|
73
74
|
}
|
|
75
|
+
|
|
76
|
+
firstPosition = false
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
}
|