expo-libvlc-player 0.1.44 → 0.1.45
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
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 = '0.1.
|
|
4
|
+
version = '0.1.44'
|
|
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 "0.1.
|
|
30
|
+
versionName "0.1.44"
|
|
31
31
|
consumerProguardFiles("proguard-rules.pro")
|
|
32
32
|
}
|
|
33
33
|
lintOptions {
|
|
@@ -31,7 +31,10 @@ class LibVlcPlayerView(
|
|
|
31
31
|
) : ExpoView(context, appContext) {
|
|
32
32
|
internal val playerViewId: String = UUID.randomUUID().toString()
|
|
33
33
|
|
|
34
|
-
private val playerView: VLCVideoLayout =
|
|
34
|
+
private val playerView: VLCVideoLayout =
|
|
35
|
+
VLCVideoLayout(context).also {
|
|
36
|
+
addView(it)
|
|
37
|
+
}
|
|
35
38
|
|
|
36
39
|
private var libVLC: LibVLC? = null
|
|
37
40
|
internal var mediaPlayer: MediaPlayer? = null
|
|
@@ -53,20 +56,12 @@ class LibVlcPlayerView(
|
|
|
53
56
|
|
|
54
57
|
init {
|
|
55
58
|
MediaPlayerManager.registerPlayerView(this)
|
|
56
|
-
|
|
57
|
-
addView(playerView)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
override fun onAttachedToWindow() {
|
|
61
|
-
super.onAttachedToWindow()
|
|
62
|
-
|
|
63
|
-
mediaPlayer?.attachViews(playerView, null, ENABLE_SUBTITLES, USE_TEXTURE_VIEW)
|
|
64
59
|
}
|
|
65
60
|
|
|
66
61
|
override fun onDetachedFromWindow() {
|
|
67
62
|
super.onDetachedFromWindow()
|
|
68
63
|
|
|
69
|
-
|
|
64
|
+
attachPlayer()
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
fun createPlayer() {
|
|
@@ -78,6 +73,7 @@ class LibVlcPlayerView(
|
|
|
78
73
|
libVLC = LibVLC(context, options)
|
|
79
74
|
mediaPlayer = MediaPlayer(libVLC)
|
|
80
75
|
setMediaPlayerListener()
|
|
76
|
+
attachPlayer()
|
|
81
77
|
|
|
82
78
|
try {
|
|
83
79
|
media = Media(libVLC, Uri.parse(source))
|
|
@@ -113,6 +109,10 @@ class LibVlcPlayerView(
|
|
|
113
109
|
shouldCreate = false
|
|
114
110
|
}
|
|
115
111
|
|
|
112
|
+
fun attachPlayer() {
|
|
113
|
+
mediaPlayer?.attachViews(playerView, null, ENABLE_SUBTITLES, USE_TEXTURE_VIEW)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
116
|
fun destroyPlayer() {
|
|
117
117
|
media?.release()
|
|
118
118
|
mediaPlayer?.release()
|
|
@@ -85,6 +85,10 @@ public class LibVlcPlayerModule: Module {
|
|
|
85
85
|
view.autoplay = autoplay ?? true
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
OnViewDestroys { (view: LibVlcPlayerView) in
|
|
89
|
+
MediaPlayerManager.shared.unregisterPlayerView(view)
|
|
90
|
+
}
|
|
91
|
+
|
|
88
92
|
OnViewDidUpdateProps { (view: LibVlcPlayerView) in
|
|
89
93
|
view.createPlayer()
|
|
90
94
|
}
|
|
@@ -31,7 +31,7 @@ class LibVlcPlayerView: ExpoView {
|
|
|
31
31
|
required init(appContext: AppContext? = nil) {
|
|
32
32
|
super.init(appContext: appContext)
|
|
33
33
|
|
|
34
|
-
MediaPlayerManager.shared.registerPlayerView(
|
|
34
|
+
MediaPlayerManager.shared.registerPlayerView(self)
|
|
35
35
|
|
|
36
36
|
clipsToBounds = true
|
|
37
37
|
playerView.backgroundColor = .black
|
|
@@ -268,10 +268,6 @@ class LibVlcPlayerView: ExpoView {
|
|
|
268
268
|
let userPosition = ["position": position]
|
|
269
269
|
onPositionChanged(userPosition)
|
|
270
270
|
}
|
|
271
|
-
|
|
272
|
-
deinit {
|
|
273
|
-
MediaPlayerManager.shared.unregisterPlayerView(view: self)
|
|
274
|
-
}
|
|
275
271
|
}
|
|
276
272
|
|
|
277
273
|
extension Array where Element == String {
|
|
@@ -15,12 +15,12 @@ class MediaPlayerManager {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
func registerPlayerView(view: LibVlcPlayerView) {
|
|
18
|
+
func registerPlayerView(_ view: LibVlcPlayerView) {
|
|
19
19
|
playerViews.add(view)
|
|
20
20
|
setAppropriateAudioSessionOrWarn()
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
func unregisterPlayerView(view: LibVlcPlayerView) {
|
|
23
|
+
func unregisterPlayerView(_ view: LibVlcPlayerView) {
|
|
24
24
|
playerViews.remove(view)
|
|
25
25
|
setAppropriateAudioSessionOrWarn()
|
|
26
26
|
view.destroyPlayer()
|