expo-libvlc-player 2.0.7 → 2.0.9
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/AudioFocusManager.kt +10 -5
- package/android/src/main/java/expo/modules/libvlcplayer/LibVlcPlayerView.kt +49 -48
- package/ios/LibVlcPlayerView.swift +71 -76
- package/ios/MediaPlayerDelegate.swift +48 -48
- package/ios/MediaPlayerManager.swift +10 -7
- package/package.json +2 -2
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.0.
|
|
4
|
+
version = "2.0.9"
|
|
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.0.
|
|
30
|
+
versionName "2.0.9"
|
|
31
31
|
consumerProguardFiles("proguard-rules.pro")
|
|
32
32
|
}
|
|
33
33
|
lintOptions {
|
|
@@ -30,8 +30,11 @@ class AudioFocusManager(
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
private fun playerRequiresFocus(player: MediaPlayer?): Boolean {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
if (player != null) {
|
|
34
|
+
return player.isPlaying() && player.getVolume() > MIN_PLAYER_VOLUME
|
|
35
|
+
} else {
|
|
36
|
+
return false
|
|
37
|
+
}
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
private fun findAudioMixingMode(): AudioMixingMode {
|
|
@@ -177,9 +180,11 @@ class AudioFocusManager(
|
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
private fun pausePlayerIfUnmuted(player: MediaPlayer?) {
|
|
180
|
-
player
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
if (player != null) {
|
|
184
|
+
val unmuted = player.getVolume() > MIN_PLAYER_VOLUME
|
|
185
|
+
|
|
186
|
+
if (unmuted) {
|
|
187
|
+
player.pause()
|
|
183
188
|
}
|
|
184
189
|
}
|
|
185
190
|
}
|
|
@@ -17,6 +17,7 @@ import org.videolan.libvlc.MediaPlayer
|
|
|
17
17
|
import org.videolan.libvlc.interfaces.IMedia
|
|
18
18
|
import org.videolan.libvlc.util.DisplayManager
|
|
19
19
|
import org.videolan.libvlc.util.VLCVideoLayout
|
|
20
|
+
import java.net.URI
|
|
20
21
|
|
|
21
22
|
const val DEFAULT_PLAYER_RATE: Float = 1f
|
|
22
23
|
const val DEFAULT_PLAYER_TIME: Int = 0
|
|
@@ -81,19 +82,25 @@ class LibVlcPlayerView(
|
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
destroyPlayer()
|
|
85
|
+
|
|
86
|
+
val source = source ?: return
|
|
87
|
+
|
|
84
88
|
libVLC = LibVLC(context, options)
|
|
85
89
|
mediaPlayer = MediaPlayer(libVLC)
|
|
86
90
|
setMediaPlayerListener()
|
|
87
91
|
|
|
88
92
|
try {
|
|
89
|
-
|
|
90
|
-
mediaPlayer!!.setMedia(media)
|
|
91
|
-
media!!.release()
|
|
93
|
+
URI(source)
|
|
92
94
|
} catch (_: Exception) {
|
|
93
95
|
val error = mapOf("error" to "Invalid source, media could not be set")
|
|
94
96
|
onEncounteredError(error)
|
|
97
|
+
return
|
|
95
98
|
}
|
|
96
99
|
|
|
100
|
+
media = Media(libVLC, Uri.parse(source))
|
|
101
|
+
mediaPlayer!!.setMedia(media)
|
|
102
|
+
media!!.release()
|
|
103
|
+
|
|
97
104
|
addPlayerSlaves()
|
|
98
105
|
|
|
99
106
|
if (autoplay) {
|
|
@@ -133,6 +140,42 @@ class LibVlcPlayerView(
|
|
|
133
140
|
libVLC = null
|
|
134
141
|
}
|
|
135
142
|
|
|
143
|
+
fun setPlayerTracks() {
|
|
144
|
+
mediaPlayer?.let { player ->
|
|
145
|
+
val audioTrack = tracks?.audio ?: player.getAudioTrack()
|
|
146
|
+
val videoTrack = tracks?.video ?: player.getVideoTrack()
|
|
147
|
+
val spuTrack = tracks?.subtitle ?: player.getSpuTrack()
|
|
148
|
+
|
|
149
|
+
player.setAudioTrack(audioTrack)
|
|
150
|
+
player.setVideoTrack(videoTrack)
|
|
151
|
+
player.setSpuTrack(spuTrack)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
fun addPlayerSlaves() {
|
|
156
|
+
slaves.forEach { slave ->
|
|
157
|
+
val source = slave.source
|
|
158
|
+
val type = slave.type
|
|
159
|
+
val slaveType =
|
|
160
|
+
if (type == "subtitle") {
|
|
161
|
+
IMedia.Slave.Type.Subtitle
|
|
162
|
+
} else {
|
|
163
|
+
IMedia.Slave.Type.Audio
|
|
164
|
+
}
|
|
165
|
+
val selected = slave.selected ?: false
|
|
166
|
+
|
|
167
|
+
try {
|
|
168
|
+
URI(source)
|
|
169
|
+
} catch (_: Exception) {
|
|
170
|
+
val error = mapOf("error" to "Invalid slave, $type could not be added")
|
|
171
|
+
onEncounteredError(error)
|
|
172
|
+
return@forEach
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
mediaPlayer?.addSlave(slaveType, Uri.parse(source), selected)
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
136
179
|
fun getMediaTracks(): MediaTracks {
|
|
137
180
|
var mediaTracks = MediaTracks()
|
|
138
181
|
|
|
@@ -172,39 +215,6 @@ class LibVlcPlayerView(
|
|
|
172
215
|
return mediaTracks
|
|
173
216
|
}
|
|
174
217
|
|
|
175
|
-
fun setPlayerTracks() {
|
|
176
|
-
mediaPlayer?.let { player ->
|
|
177
|
-
val audioTrack = tracks?.audio ?: player.getAudioTrack()
|
|
178
|
-
val videoTrack = tracks?.video ?: player.getVideoTrack()
|
|
179
|
-
val spuTrack = tracks?.subtitle ?: player.getSpuTrack()
|
|
180
|
-
|
|
181
|
-
player.setAudioTrack(audioTrack)
|
|
182
|
-
player.setVideoTrack(videoTrack)
|
|
183
|
-
player.setSpuTrack(spuTrack)
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
fun addPlayerSlaves() {
|
|
188
|
-
slaves.forEach { slave ->
|
|
189
|
-
val type = slave.type
|
|
190
|
-
val slaveType =
|
|
191
|
-
if (type == "subtitle") {
|
|
192
|
-
IMedia.Slave.Type.Subtitle
|
|
193
|
-
} else {
|
|
194
|
-
IMedia.Slave.Type.Audio
|
|
195
|
-
}
|
|
196
|
-
val source = slave.source
|
|
197
|
-
val selected = slave.selected ?: false
|
|
198
|
-
|
|
199
|
-
try {
|
|
200
|
-
mediaPlayer?.addSlave(slaveType, Uri.parse(source), selected)
|
|
201
|
-
} catch (_: Exception) {
|
|
202
|
-
val error = mapOf("error" to "Invalid slave, $type could not be added")
|
|
203
|
-
onEncounteredError(error)
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
218
|
fun getMediaInfo(): MediaInfo {
|
|
209
219
|
var mediaInfo = MediaInfo()
|
|
210
220
|
|
|
@@ -274,22 +284,14 @@ class LibVlcPlayerView(
|
|
|
274
284
|
set(value) {
|
|
275
285
|
val old = field
|
|
276
286
|
field = value
|
|
277
|
-
|
|
278
|
-
if (value != null) {
|
|
279
|
-
shouldCreate = value != old
|
|
280
|
-
} else {
|
|
281
|
-
destroyPlayer()
|
|
282
|
-
}
|
|
287
|
+
shouldCreate = value != old
|
|
283
288
|
}
|
|
284
289
|
|
|
285
290
|
var options: ArrayList<String> = ArrayList()
|
|
286
291
|
set(value) {
|
|
287
292
|
val old = field
|
|
288
293
|
field = value
|
|
289
|
-
|
|
290
|
-
if (source != null) {
|
|
291
|
-
shouldCreate = value != old
|
|
292
|
-
}
|
|
294
|
+
shouldCreate = value != old
|
|
293
295
|
}
|
|
294
296
|
|
|
295
297
|
var tracks: Tracks? = null
|
|
@@ -409,8 +411,7 @@ class LibVlcPlayerView(
|
|
|
409
411
|
if (player.isSeekable()) {
|
|
410
412
|
player.setPosition(position)
|
|
411
413
|
} else {
|
|
412
|
-
|
|
413
|
-
this.time = time.toInt()
|
|
414
|
+
time = (position * mediaLength.toFloat()).toInt()
|
|
414
415
|
}
|
|
415
416
|
}
|
|
416
417
|
}
|
|
@@ -56,11 +56,14 @@ class LibVlcPlayerView: ExpoView {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
destroyPlayer()
|
|
59
|
+
|
|
60
|
+
guard let source = source else { return }
|
|
61
|
+
|
|
59
62
|
mediaPlayer = VLCMediaPlayer(options: options)
|
|
60
63
|
mediaPlayer!.drawable = playerView
|
|
61
64
|
mediaPlayer!.delegate = self
|
|
62
65
|
|
|
63
|
-
guard let
|
|
66
|
+
guard let url = URL(string: source) else {
|
|
64
67
|
let error = ["error": "Invalid source, media could not be set"]
|
|
65
68
|
onEncounteredError(error)
|
|
66
69
|
return
|
|
@@ -85,6 +88,37 @@ class LibVlcPlayerView: ExpoView {
|
|
|
85
88
|
mediaPlayer = nil
|
|
86
89
|
}
|
|
87
90
|
|
|
91
|
+
func setPlayerTracks() {
|
|
92
|
+
if let player = mediaPlayer {
|
|
93
|
+
let audioTrackIndex = tracks?.audio ?? Int(player.currentAudioTrackIndex)
|
|
94
|
+
let videoTrackIndex = tracks?.video ?? Int(player.currentVideoTrackIndex)
|
|
95
|
+
let videoSubTitleIndex = tracks?.subtitle ?? Int(player.currentVideoSubTitleIndex)
|
|
96
|
+
|
|
97
|
+
player.currentAudioTrackIndex = Int32(audioTrackIndex)
|
|
98
|
+
player.currentVideoTrackIndex = Int32(videoTrackIndex)
|
|
99
|
+
player.currentVideoSubTitleIndex = Int32(videoSubTitleIndex)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
func addPlayerSlaves() {
|
|
104
|
+
for slave in slaves {
|
|
105
|
+
let source = slave.source
|
|
106
|
+
let type = slave.type
|
|
107
|
+
let slaveType = type == "subtitle" ?
|
|
108
|
+
VLCMediaPlaybackSlaveType.subtitle :
|
|
109
|
+
VLCMediaPlaybackSlaveType.audio
|
|
110
|
+
let selected = slave.selected ?? false
|
|
111
|
+
|
|
112
|
+
guard let url = URL(string: source) else {
|
|
113
|
+
let error = ["error": "Invalid slave, \(type) could not be added"]
|
|
114
|
+
onEncounteredError(error)
|
|
115
|
+
continue
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
mediaPlayer?.addPlaybackSlave(url, type: slaveType, enforce: selected)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
88
122
|
func getMediaTracks() -> MediaTracks {
|
|
89
123
|
var mediaTracks = MediaTracks()
|
|
90
124
|
|
|
@@ -135,37 +169,6 @@ class LibVlcPlayerView: ExpoView {
|
|
|
135
169
|
return mediaTracks
|
|
136
170
|
}
|
|
137
171
|
|
|
138
|
-
func setPlayerTracks() {
|
|
139
|
-
guard let player = mediaPlayer else { return }
|
|
140
|
-
|
|
141
|
-
let audioTrackIndex = tracks?.audio ?? Int(player.currentAudioTrackIndex)
|
|
142
|
-
let videoTrackIndex = tracks?.video ?? Int(player.currentVideoTrackIndex)
|
|
143
|
-
let videoSubTitleIndex = tracks?.subtitle ?? Int(player.currentVideoSubTitleIndex)
|
|
144
|
-
|
|
145
|
-
player.currentAudioTrackIndex = Int32(audioTrackIndex)
|
|
146
|
-
player.currentVideoTrackIndex = Int32(videoTrackIndex)
|
|
147
|
-
player.currentVideoSubTitleIndex = Int32(videoSubTitleIndex)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
func addPlayerSlaves() {
|
|
151
|
-
for slave in slaves {
|
|
152
|
-
let source = slave.source
|
|
153
|
-
let type = slave.type
|
|
154
|
-
let slaveType = type == "subtitle" ?
|
|
155
|
-
VLCMediaPlaybackSlaveType.subtitle :
|
|
156
|
-
VLCMediaPlaybackSlaveType.audio
|
|
157
|
-
let selected = slave.selected ?? false
|
|
158
|
-
|
|
159
|
-
guard let url = URL(string: source) else {
|
|
160
|
-
let error = ["error": "Invalid slave, \(type) could not be added"]
|
|
161
|
-
onEncounteredError(error)
|
|
162
|
-
continue
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
mediaPlayer?.addPlaybackSlave(url, type: slaveType, enforce: selected)
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
172
|
func getMediaInfo() -> MediaInfo {
|
|
170
173
|
var mediaInfo = MediaInfo()
|
|
171
174
|
|
|
@@ -190,54 +193,48 @@ class LibVlcPlayerView: ExpoView {
|
|
|
190
193
|
}
|
|
191
194
|
|
|
192
195
|
func setupPlayer() {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
setPlayerTracks()
|
|
196
|
+
if let player = mediaPlayer {
|
|
197
|
+
setPlayerTracks()
|
|
196
198
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
if volume != maxPlayerVolume || mute {
|
|
200
|
+
let newVolume = mute ?
|
|
201
|
+
minPlayerVolume :
|
|
202
|
+
volume
|
|
201
203
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
+
player.audio?.volume = Int32(newVolume)
|
|
205
|
+
}
|
|
204
206
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
207
|
+
if rate != defaultPlayerRate {
|
|
208
|
+
player.rate = rate
|
|
209
|
+
}
|
|
208
210
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
211
|
+
if time != defaultPlayerTime {
|
|
212
|
+
player.time = VLCTime(int: Int32(time))
|
|
213
|
+
}
|
|
212
214
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
if scale != defaultPlayerScale {
|
|
216
|
+
player.scaleFactor = scale
|
|
217
|
+
}
|
|
216
218
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
if let aspectRatio = aspectRatio {
|
|
220
|
+
aspectRatio.withCString { cString in
|
|
221
|
+
player.videoAspectRatio = UnsafeMutablePointer(mutating: cString)
|
|
222
|
+
}
|
|
220
223
|
}
|
|
221
|
-
}
|
|
222
224
|
|
|
223
|
-
|
|
225
|
+
time = defaultPlayerTime
|
|
226
|
+
}
|
|
224
227
|
}
|
|
225
228
|
|
|
226
229
|
var source: String? {
|
|
227
230
|
didSet {
|
|
228
|
-
|
|
229
|
-
shouldCreate = source != oldValue
|
|
230
|
-
} else {
|
|
231
|
-
destroyPlayer()
|
|
232
|
-
}
|
|
231
|
+
shouldCreate = source != oldValue
|
|
233
232
|
}
|
|
234
233
|
}
|
|
235
234
|
|
|
236
235
|
var options: [String] = .init() {
|
|
237
236
|
didSet {
|
|
238
|
-
|
|
239
|
-
shouldCreate = options != oldValue
|
|
240
|
-
}
|
|
237
|
+
shouldCreate = options != oldValue
|
|
241
238
|
}
|
|
242
239
|
}
|
|
243
240
|
|
|
@@ -270,13 +267,12 @@ class LibVlcPlayerView: ExpoView {
|
|
|
270
267
|
|
|
271
268
|
var aspectRatio: String? {
|
|
272
269
|
didSet {
|
|
273
|
-
|
|
270
|
+
if let aspectRatio = aspectRatio {
|
|
271
|
+
aspectRatio.withCString { cString in
|
|
272
|
+
mediaPlayer?.videoAspectRatio = UnsafeMutablePointer(mutating: cString)
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
274
275
|
mediaPlayer?.videoAspectRatio = nil
|
|
275
|
-
return
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
aspectRatio.withCString { cString in
|
|
279
|
-
mediaPlayer?.videoAspectRatio = UnsafeMutablePointer(mutating: cString)
|
|
280
276
|
}
|
|
281
277
|
}
|
|
282
278
|
}
|
|
@@ -359,13 +355,12 @@ class LibVlcPlayerView: ExpoView {
|
|
|
359
355
|
}
|
|
360
356
|
|
|
361
357
|
func seek(_ position: Float) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
self.time = Int(time)
|
|
358
|
+
if let player = mediaPlayer {
|
|
359
|
+
if player.isSeekable {
|
|
360
|
+
player.position = position
|
|
361
|
+
} else {
|
|
362
|
+
time = Int(position * Float(mediaLength))
|
|
363
|
+
}
|
|
369
364
|
}
|
|
370
365
|
}
|
|
371
366
|
}
|
|
@@ -2,58 +2,58 @@ import MobileVLCKit
|
|
|
2
2
|
|
|
3
3
|
extension LibVlcPlayerView: VLCMediaPlayerDelegate {
|
|
4
4
|
func mediaPlayerStateChanged(_: Notification) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
5
|
+
if let player = mediaPlayer {
|
|
6
|
+
switch player.state {
|
|
7
|
+
case .buffering:
|
|
8
|
+
onBuffering([:])
|
|
9
|
+
case .playing:
|
|
10
|
+
onPlaying([:])
|
|
11
|
+
|
|
12
|
+
if firstPlay {
|
|
13
|
+
setupPlayer()
|
|
14
|
+
|
|
15
|
+
let mediaInfo = getMediaInfo()
|
|
16
|
+
|
|
17
|
+
onFirstPlay(mediaInfo)
|
|
18
|
+
|
|
19
|
+
firstPlay = false
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
MediaPlayerManager.shared.setAppropriateAudioSession()
|
|
23
|
+
case .paused:
|
|
24
|
+
onPaused([:])
|
|
25
|
+
case .stopped:
|
|
26
|
+
onStopped([:])
|
|
27
|
+
|
|
28
|
+
firstPlay = true
|
|
29
|
+
case .ended:
|
|
30
|
+
onEndReached([:])
|
|
31
|
+
|
|
32
|
+
player.stop()
|
|
33
|
+
|
|
34
|
+
let shouldReplay = !options.hasRepeatOption() && shouldRepeat
|
|
35
|
+
|
|
36
|
+
if shouldReplay {
|
|
37
|
+
player.play()
|
|
38
|
+
}
|
|
39
|
+
case .error:
|
|
40
|
+
let error = ["error": "Player encountered an error"]
|
|
41
|
+
onEncounteredError(error)
|
|
42
|
+
case .esAdded:
|
|
43
|
+
if !firstPlay {
|
|
44
|
+
let mediaTracks = getMediaTracks()
|
|
45
|
+
onESAdded(mediaTracks)
|
|
46
|
+
}
|
|
47
|
+
default:
|
|
48
|
+
break
|
|
39
49
|
}
|
|
40
|
-
case .error:
|
|
41
|
-
let error = ["error": "Player encountered an error"]
|
|
42
|
-
onEncounteredError(error)
|
|
43
|
-
case .esAdded:
|
|
44
|
-
if !firstPlay {
|
|
45
|
-
let mediaTracks = getMediaTracks()
|
|
46
|
-
onESAdded(mediaTracks)
|
|
47
|
-
}
|
|
48
|
-
default:
|
|
49
|
-
break
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
func mediaPlayerTimeChanged(_: Notification) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
if let player = mediaPlayer {
|
|
55
|
+
let position = ["position": player.position]
|
|
56
|
+
onPositionChanged(position)
|
|
57
|
+
}
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -27,12 +27,12 @@ class MediaPlayerManager {
|
|
|
27
27
|
for view in playerViews.allObjects {
|
|
28
28
|
view.onBackground([:])
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
if let player = view.mediaPlayer {
|
|
31
|
+
let shouldPause = !view.playInBackground && player.isPlaying
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
player.pause()
|
|
33
|
+
if shouldPause {
|
|
34
|
+
player.pause()
|
|
35
|
+
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -49,8 +49,11 @@ class MediaPlayerManager {
|
|
|
49
49
|
var audioSessionCategoryOptions: AVAudioSession.CategoryOptions = audioSession.categoryOptions
|
|
50
50
|
|
|
51
51
|
let isOutputtingAudio = playerViews.allObjects.contains { view in
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if let player = view.mediaPlayer, let audio = player.audio {
|
|
53
|
+
return player.isPlaying && audio.volume > minPlayerVolume
|
|
54
|
+
} else {
|
|
55
|
+
return false
|
|
56
|
+
}
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
let shouldMixOverride = audioMixingMode == .mixWithOthers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-libvlc-player",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "LibVLC Player for Expo",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"libvlc",
|
|
21
21
|
"player",
|
|
22
22
|
"expo-libvlc-player",
|
|
23
|
-
"
|
|
23
|
+
"ExpoLibvlcPlayer"
|
|
24
24
|
],
|
|
25
25
|
"repository": "https://github.com/cornejobarraza/expo-libvlc-player",
|
|
26
26
|
"bugs": {
|