bitmovin-player-react-native 1.0.0-alpha.0 → 1.0.0-alpha.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/README.md +4 -4
- package/android/src/main/java/com/bitmovin/player/reactnative/BufferModule.kt +1 -4
- package/android/src/main/java/com/bitmovin/player/reactnative/PlayerModule.kt +47 -52
- package/android/src/main/java/com/bitmovin/player/reactnative/PlayerRegistry.kt +78 -0
- package/build/components/PlayerView/index.d.ts +1 -1
- package/build/components/PlayerView/index.d.ts.map +1 -1
- package/build/components/PlayerView/index.js +4 -1
- package/build/components/PlayerView/index.js.map +1 -1
- package/ios/AppLifecycleDelegate.swift +4 -1
- package/ios/OfflineModule.swift +3 -7
- package/ios/PlayerModule.swift +99 -94
- package/ios/PlayerRegistry.swift +88 -0
- package/ios/RNPlayerView.swift +2 -0
- package/package.json +1 -1
- package/plugin/build/withBitmovinIosConfig.js +25 -20
- package/plugin/src/withBitmovinIosConfig.ts +27 -21
- package/src/components/PlayerView/index.tsx +84 -82
package/README.md
CHANGED
|
@@ -14,12 +14,12 @@ This is an open-source project created to enable customers to integrate the Bitm
|
|
|
14
14
|
|
|
15
15
|
## Platform Support
|
|
16
16
|
|
|
17
|
-
This library requires at least React Native 0.
|
|
17
|
+
This library requires at least Expo 53+, React Native 0.79+ and React 17+ to work properly. The **officially supported** platforms are:
|
|
18
18
|
|
|
19
|
-
- **iOS/iPadOS/tvOS:**
|
|
20
|
-
- **Android:**
|
|
19
|
+
- **iOS/iPadOS/tvOS:** 15.1+
|
|
20
|
+
- **Android:** 7.0+
|
|
21
21
|
- **Android TV:** 7+
|
|
22
|
-
- **Fire TV:** Fire OS 6.0+
|
|
22
|
+
- **Fire TV:** Fire OS 6.0+
|
|
23
23
|
|
|
24
24
|
Please note that browsers and other browser-like environments such as webOS and Tizen are not supported. For more details regarding Bitmovin Player SDK platform and device support, please refer to the [Supported Platforms & Devices](https://developer.bitmovin.com/playback/docs/supported-platforms-devices-player) page of our documentation.
|
|
25
25
|
|
|
@@ -34,10 +34,7 @@ class BufferModule : Module() {
|
|
|
34
34
|
val player = appContext.registry.getModule<PlayerModule>()?.getPlayerOrNull(playerId)
|
|
35
35
|
?: return@AsyncFunction
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
if (bufferType == BufferType.ForwardDuration) {
|
|
39
|
-
player.buffer.setTargetLevel(bufferType, value)
|
|
40
|
-
}
|
|
37
|
+
player.buffer.setTargetLevel(type.toBufferTypeOrThrow(), value)
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
}
|
|
@@ -16,11 +16,6 @@ import expo.modules.kotlin.modules.Module
|
|
|
16
16
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
17
17
|
|
|
18
18
|
class PlayerModule : Module() {
|
|
19
|
-
/**
|
|
20
|
-
* In-memory mapping from [NativeId]s to [Player] instances.
|
|
21
|
-
* This must match the Registry pattern from legacy PlayerModule
|
|
22
|
-
*/
|
|
23
|
-
private val players: Registry<Player> = mutableMapOf()
|
|
24
19
|
|
|
25
20
|
val mediaSessionPlaybackManager by lazy { MediaSessionPlaybackManager(appContext) }
|
|
26
21
|
|
|
@@ -33,68 +28,68 @@ class PlayerModule : Module() {
|
|
|
33
28
|
|
|
34
29
|
OnDestroy {
|
|
35
30
|
// Clean up all players when module is destroyed
|
|
36
|
-
|
|
31
|
+
PlayerRegistry.getAllPlayers().forEach { player ->
|
|
37
32
|
try {
|
|
38
33
|
player.destroy()
|
|
39
34
|
} catch (e: Exception) {
|
|
40
35
|
// Log but don't crash on cleanup
|
|
41
36
|
}
|
|
42
37
|
}
|
|
43
|
-
|
|
38
|
+
PlayerRegistry.clear()
|
|
44
39
|
}
|
|
45
40
|
|
|
46
41
|
AsyncFunction("play") { nativeId: NativeId ->
|
|
47
|
-
val player =
|
|
42
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
48
43
|
player?.play()
|
|
49
44
|
}.runOnQueue(Queues.MAIN)
|
|
50
45
|
|
|
51
46
|
AsyncFunction("pause") { nativeId: NativeId ->
|
|
52
|
-
val player =
|
|
47
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
53
48
|
player?.pause()
|
|
54
49
|
}.runOnQueue(Queues.MAIN)
|
|
55
50
|
|
|
56
51
|
AsyncFunction("mute") { nativeId: NativeId ->
|
|
57
|
-
val player =
|
|
52
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
58
53
|
player?.mute()
|
|
59
54
|
}.runOnQueue(Queues.MAIN)
|
|
60
55
|
|
|
61
56
|
AsyncFunction("unmute") { nativeId: NativeId ->
|
|
62
|
-
val player =
|
|
57
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
63
58
|
player?.unmute()
|
|
64
59
|
}.runOnQueue(Queues.MAIN)
|
|
65
60
|
|
|
66
61
|
AsyncFunction("seek") { nativeId: NativeId, time: Double ->
|
|
67
|
-
val player =
|
|
62
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
68
63
|
player?.seek(time)
|
|
69
64
|
}.runOnQueue(Queues.MAIN)
|
|
70
65
|
|
|
71
66
|
AsyncFunction("timeShift") { nativeId: NativeId, offset: Double ->
|
|
72
|
-
val player =
|
|
67
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
73
68
|
player?.timeShift(offset)
|
|
74
69
|
}.runOnQueue(Queues.MAIN)
|
|
75
70
|
|
|
76
71
|
AsyncFunction("destroy") { nativeId: NativeId ->
|
|
77
|
-
val player =
|
|
72
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
78
73
|
if (player != null) {
|
|
79
74
|
// Note: MediaSession cleanup would need to be handled here
|
|
80
75
|
// For now, just destroy the player and remove from registry
|
|
81
76
|
player.destroy()
|
|
82
|
-
|
|
77
|
+
PlayerRegistry.unregister(nativeId)
|
|
83
78
|
}
|
|
84
79
|
}.runOnQueue(Queues.MAIN)
|
|
85
80
|
|
|
86
81
|
AsyncFunction("setVolume") { nativeId: NativeId, volume: Double ->
|
|
87
|
-
val player =
|
|
82
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
88
83
|
player?.volume = volume.toInt()
|
|
89
84
|
}.runOnQueue(Queues.MAIN)
|
|
90
85
|
|
|
91
86
|
AsyncFunction("getVolume") { nativeId: NativeId ->
|
|
92
|
-
val player =
|
|
87
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
93
88
|
return@AsyncFunction player?.volume?.toDouble()
|
|
94
89
|
}
|
|
95
90
|
|
|
96
91
|
AsyncFunction("currentTime") { nativeId: NativeId, mode: String? ->
|
|
97
|
-
val player =
|
|
92
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
98
93
|
return@AsyncFunction when {
|
|
99
94
|
player == null -> null
|
|
100
95
|
mode == "relative" -> player.currentTime + player.playbackTimeOffsetToRelativeTime
|
|
@@ -104,62 +99,62 @@ class PlayerModule : Module() {
|
|
|
104
99
|
}
|
|
105
100
|
|
|
106
101
|
AsyncFunction("isPlaying") { nativeId: NativeId ->
|
|
107
|
-
val player =
|
|
102
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
108
103
|
return@AsyncFunction player?.isPlaying
|
|
109
104
|
}
|
|
110
105
|
|
|
111
106
|
AsyncFunction("isPaused") { nativeId: NativeId ->
|
|
112
|
-
val player =
|
|
107
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
113
108
|
return@AsyncFunction player?.isPaused
|
|
114
109
|
}
|
|
115
110
|
|
|
116
111
|
AsyncFunction("duration") { nativeId: NativeId ->
|
|
117
|
-
val player =
|
|
112
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
118
113
|
return@AsyncFunction player?.duration
|
|
119
114
|
}
|
|
120
115
|
|
|
121
116
|
AsyncFunction("isMuted") { nativeId: NativeId ->
|
|
122
|
-
val player =
|
|
117
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
123
118
|
return@AsyncFunction player?.isMuted
|
|
124
119
|
}
|
|
125
120
|
|
|
126
121
|
AsyncFunction("unload") { nativeId: NativeId ->
|
|
127
|
-
val player =
|
|
122
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
128
123
|
player?.unload()
|
|
129
124
|
}.runOnQueue(Queues.MAIN)
|
|
130
125
|
|
|
131
126
|
AsyncFunction("getTimeShift") { nativeId: NativeId ->
|
|
132
|
-
val player =
|
|
127
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
133
128
|
return@AsyncFunction player?.timeShift
|
|
134
129
|
}
|
|
135
130
|
|
|
136
131
|
AsyncFunction("isLive") { nativeId: NativeId ->
|
|
137
|
-
val player =
|
|
132
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
138
133
|
return@AsyncFunction player?.isLive
|
|
139
134
|
}
|
|
140
135
|
|
|
141
136
|
AsyncFunction("getMaxTimeShift") { nativeId: NativeId ->
|
|
142
|
-
val player =
|
|
137
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
143
138
|
return@AsyncFunction player?.maxTimeShift
|
|
144
139
|
}
|
|
145
140
|
|
|
146
141
|
AsyncFunction("getPlaybackSpeed") { nativeId: NativeId ->
|
|
147
|
-
val player =
|
|
142
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
148
143
|
return@AsyncFunction player?.playbackSpeed?.toDouble()
|
|
149
144
|
}
|
|
150
145
|
|
|
151
146
|
AsyncFunction("setPlaybackSpeed") { nativeId: NativeId, playbackSpeed: Double ->
|
|
152
|
-
val player =
|
|
147
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
153
148
|
player?.playbackSpeed = playbackSpeed.toFloat()
|
|
154
149
|
}.runOnQueue(Queues.MAIN)
|
|
155
150
|
|
|
156
151
|
AsyncFunction("isAd") { nativeId: NativeId ->
|
|
157
|
-
val player =
|
|
152
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
158
153
|
return@AsyncFunction player?.isAd
|
|
159
154
|
}
|
|
160
155
|
|
|
161
156
|
AsyncFunction("setMaxSelectableBitrate") { nativeId: NativeId, maxBitrate: Double ->
|
|
162
|
-
val player =
|
|
157
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
163
158
|
player?.setMaxSelectableVideoBitrate(maxBitrate.toInt())
|
|
164
159
|
}.runOnQueue(Queues.MAIN)
|
|
165
160
|
|
|
@@ -174,27 +169,27 @@ class PlayerModule : Module() {
|
|
|
174
169
|
}
|
|
175
170
|
|
|
176
171
|
AsyncFunction("isCastAvailable") { nativeId: NativeId ->
|
|
177
|
-
val player =
|
|
172
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
178
173
|
return@AsyncFunction player?.isCastAvailable
|
|
179
174
|
}
|
|
180
175
|
|
|
181
176
|
AsyncFunction("isCasting") { nativeId: NativeId ->
|
|
182
|
-
val player =
|
|
177
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
183
178
|
return@AsyncFunction player?.isCasting
|
|
184
179
|
}
|
|
185
180
|
|
|
186
181
|
AsyncFunction("castVideo") { nativeId: NativeId ->
|
|
187
|
-
val player =
|
|
182
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
188
183
|
player?.castVideo()
|
|
189
184
|
}.runOnQueue(Queues.MAIN)
|
|
190
185
|
|
|
191
186
|
AsyncFunction("castStop") { nativeId: NativeId ->
|
|
192
|
-
val player =
|
|
187
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
193
188
|
player?.castStop()
|
|
194
189
|
}.runOnQueue(Queues.MAIN)
|
|
195
190
|
|
|
196
191
|
AsyncFunction("skipAd") { nativeId: NativeId ->
|
|
197
|
-
val player =
|
|
192
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
198
193
|
player?.skipAd()
|
|
199
194
|
}.runOnQueue(Queues.MAIN)
|
|
200
195
|
|
|
@@ -204,57 +199,57 @@ class PlayerModule : Module() {
|
|
|
204
199
|
}
|
|
205
200
|
|
|
206
201
|
AsyncFunction("getAudioTrack") { nativeId: NativeId ->
|
|
207
|
-
val player =
|
|
202
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
208
203
|
return@AsyncFunction player?.source?.selectedAudioTrack?.toJson()
|
|
209
204
|
}
|
|
210
205
|
|
|
211
206
|
AsyncFunction("getAvailableAudioTracks") { nativeId: NativeId ->
|
|
212
|
-
val player =
|
|
207
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
213
208
|
return@AsyncFunction player?.source?.availableAudioTracks?.map { it.toJson() } ?: emptyList()
|
|
214
209
|
}
|
|
215
210
|
|
|
216
211
|
AsyncFunction("setAudioTrack") { nativeId: NativeId, trackIdentifier: String ->
|
|
217
|
-
val player =
|
|
212
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
218
213
|
player?.source?.setAudioTrack(trackIdentifier)
|
|
219
214
|
}.runOnQueue(Queues.MAIN)
|
|
220
215
|
|
|
221
216
|
AsyncFunction("getSubtitleTrack") { nativeId: NativeId ->
|
|
222
|
-
val player =
|
|
217
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
223
218
|
return@AsyncFunction player?.source?.selectedSubtitleTrack?.toJson()
|
|
224
219
|
}
|
|
225
220
|
|
|
226
221
|
AsyncFunction("getAvailableSubtitles") { nativeId: NativeId ->
|
|
227
|
-
val player =
|
|
222
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
228
223
|
return@AsyncFunction player?.source?.availableSubtitleTracks?.map { it.toJson() } ?: emptyList()
|
|
229
224
|
}
|
|
230
225
|
|
|
231
226
|
AsyncFunction("setSubtitleTrack") { nativeId: NativeId, trackIdentifier: String? ->
|
|
232
|
-
val player =
|
|
227
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
233
228
|
player?.source?.setSubtitleTrack(trackIdentifier)
|
|
234
229
|
}.runOnQueue(Queues.MAIN)
|
|
235
230
|
|
|
236
231
|
AsyncFunction("getVideoQuality") { nativeId: NativeId ->
|
|
237
|
-
val player =
|
|
232
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
238
233
|
return@AsyncFunction player?.videoQuality?.toJson()
|
|
239
234
|
}
|
|
240
235
|
|
|
241
236
|
AsyncFunction("getAvailableVideoQualities") { nativeId: NativeId ->
|
|
242
|
-
val player =
|
|
237
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
243
238
|
return@AsyncFunction player?.availableVideoQualities?.map { it.toJson() } ?: emptyList()
|
|
244
239
|
}
|
|
245
240
|
|
|
246
241
|
AsyncFunction("setVideoQuality") { nativeId: NativeId, qualityId: String ->
|
|
247
|
-
val player =
|
|
242
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
248
243
|
player?.source?.setVideoQuality(qualityId)
|
|
249
244
|
}.runOnQueue(Queues.MAIN)
|
|
250
245
|
|
|
251
246
|
AsyncFunction("getThumbnail") { nativeId: NativeId, time: Double ->
|
|
252
|
-
val player =
|
|
247
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
253
248
|
return@AsyncFunction player?.getThumbnail(time)?.toJson()
|
|
254
249
|
}
|
|
255
250
|
AsyncFunction("loadOfflineContent") { nativeId: NativeId, offlineContentManagerBridgeId: String,
|
|
256
251
|
options: Map<String, Any>?, ->
|
|
257
|
-
val player =
|
|
252
|
+
val player = PlayerRegistry.getPlayer(nativeId) ?: return@AsyncFunction
|
|
258
253
|
val offlineContentManagerBridge = appContext.registry.getModule<OfflineModule>()
|
|
259
254
|
?.getOfflineContentManagerBridge(offlineContentManagerBridgeId)
|
|
260
255
|
|
|
@@ -264,7 +259,7 @@ class PlayerModule : Module() {
|
|
|
264
259
|
}.runOnQueue(Queues.MAIN)
|
|
265
260
|
|
|
266
261
|
AsyncFunction("scheduleAd") { nativeId: NativeId, adItemJson: Map<String, Any> ->
|
|
267
|
-
val player =
|
|
262
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
268
263
|
val adItem = adItemJson.toAdItem()
|
|
269
264
|
if (player != null && adItem != null) {
|
|
270
265
|
player.scheduleAd(adItem)
|
|
@@ -282,7 +277,7 @@ class PlayerModule : Module() {
|
|
|
282
277
|
}.runOnQueue(Queues.MAIN)
|
|
283
278
|
|
|
284
279
|
AsyncFunction("loadSource") { nativeId: NativeId, sourceNativeId: NativeId ->
|
|
285
|
-
val player =
|
|
280
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
286
281
|
val source = appContext.registry.getModule<SourceModule>()?.getSourceOrNull(sourceNativeId)
|
|
287
282
|
if (player != null && source != null) {
|
|
288
283
|
player.load(source)
|
|
@@ -290,7 +285,7 @@ class PlayerModule : Module() {
|
|
|
290
285
|
}.runOnQueue(Queues.MAIN)
|
|
291
286
|
|
|
292
287
|
AsyncFunction("source") { nativeId: NativeId ->
|
|
293
|
-
val player =
|
|
288
|
+
val player = PlayerRegistry.getPlayer(nativeId)
|
|
294
289
|
return@AsyncFunction player?.source?.toJson()
|
|
295
290
|
}
|
|
296
291
|
}
|
|
@@ -302,7 +297,7 @@ class PlayerModule : Module() {
|
|
|
302
297
|
decoderNativeId: NativeId?,
|
|
303
298
|
analyticsConfigJson: Map<String, Any>?,
|
|
304
299
|
) {
|
|
305
|
-
if (
|
|
300
|
+
if (PlayerRegistry.hasPlayer(nativeId)) {
|
|
306
301
|
// Player already exists for this nativeId
|
|
307
302
|
return
|
|
308
303
|
}
|
|
@@ -340,7 +335,7 @@ class PlayerModule : Module() {
|
|
|
340
335
|
} else {
|
|
341
336
|
Player.create(applicationContext, playerConfig)
|
|
342
337
|
}
|
|
343
|
-
|
|
338
|
+
PlayerRegistry.register(player, nativeId)
|
|
344
339
|
|
|
345
340
|
if (enableMediaSession) {
|
|
346
341
|
mediaSessionPlaybackManager.setupMediaSessionPlayback(nativeId)
|
|
@@ -348,5 +343,5 @@ class PlayerModule : Module() {
|
|
|
348
343
|
}
|
|
349
344
|
|
|
350
345
|
// CRITICAL: This method must remain available for cross-module access
|
|
351
|
-
fun getPlayerOrNull(nativeId: NativeId): Player? =
|
|
346
|
+
fun getPlayerOrNull(nativeId: NativeId): Player? = PlayerRegistry.getPlayer(nativeId)
|
|
352
347
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
package com.bitmovin.player.reactnative
|
|
2
|
+
|
|
3
|
+
import com.bitmovin.player.api.Player
|
|
4
|
+
import java.util.concurrent.ConcurrentHashMap
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Global registry for Player instances that allows static access from anywhere in native code
|
|
8
|
+
* without requiring access to the PlayerModule instance or Expo runtime.
|
|
9
|
+
*/
|
|
10
|
+
object PlayerRegistry {
|
|
11
|
+
private val players: Registry<Player> = ConcurrentHashMap()
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Register a player instance with the given native ID.
|
|
15
|
+
*/
|
|
16
|
+
@JvmStatic
|
|
17
|
+
fun register(player: Player, nativeId: NativeId) {
|
|
18
|
+
players[nativeId] = player
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Unregister a player instance with the given native ID.
|
|
23
|
+
*/
|
|
24
|
+
@JvmStatic
|
|
25
|
+
fun unregister(nativeId: NativeId) {
|
|
26
|
+
players.remove(nativeId)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get a player instance by native ID.
|
|
31
|
+
* Returns null if no player is registered with the given ID.
|
|
32
|
+
*/
|
|
33
|
+
@JvmStatic
|
|
34
|
+
fun getPlayer(nativeId: NativeId): Player? {
|
|
35
|
+
return players[nativeId]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Get all registered player instances.
|
|
40
|
+
*/
|
|
41
|
+
@JvmStatic
|
|
42
|
+
fun getAllPlayers(): List<Player> {
|
|
43
|
+
return players.values.toList()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Get all registered native IDs.
|
|
48
|
+
*/
|
|
49
|
+
@JvmStatic
|
|
50
|
+
fun getAllNativeIds(): List<NativeId> {
|
|
51
|
+
return players.keys.toList()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Check if a player is registered with the given native ID.
|
|
56
|
+
*/
|
|
57
|
+
@JvmStatic
|
|
58
|
+
fun hasPlayer(nativeId: NativeId): Boolean {
|
|
59
|
+
return players.containsKey(nativeId)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Clear all registered players.
|
|
64
|
+
* Note: This does not destroy the players, just removes them from the registry.
|
|
65
|
+
*/
|
|
66
|
+
@JvmStatic
|
|
67
|
+
fun clear() {
|
|
68
|
+
players.clear()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get the count of registered players.
|
|
73
|
+
*/
|
|
74
|
+
@JvmStatic
|
|
75
|
+
fun count(): Int {
|
|
76
|
+
return players.size
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -6,5 +6,5 @@ import { PlayerViewProps } from './properties';
|
|
|
6
6
|
*
|
|
7
7
|
* @param options configuration options
|
|
8
8
|
*/
|
|
9
|
-
export declare function PlayerView({ viewRef, style, player, config, fullscreenHandler, customMessageHandler, isFullscreenRequested, scalingMode, isPictureInPictureRequested, ...props }: PlayerViewProps):
|
|
9
|
+
export declare function PlayerView({ viewRef, style, player, config, fullscreenHandler, customMessageHandler, isFullscreenRequested, scalingMode, isPictureInPictureRequested, ...props }: PlayerViewProps): React.JSX.Element | null;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PlayerView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAO3D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAW/C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,oBAAoB,EACpB,qBAA6B,EAC7B,WAAW,EACX,2BAAmC,EACnC,GAAG,KAAK,EACT,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PlayerView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAO3D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAW/C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,oBAAoB,EACpB,qBAA6B,EAC7B,WAAW,EACX,2BAAmC,EACnC,GAAG,KAAK,EACT,EAAE,eAAe,4BAuJjB"}
|
|
@@ -67,6 +67,9 @@ export function PlayerView({ viewRef, style, player, config, fullscreenHandler,
|
|
|
67
67
|
viewRef.current = nativeView.current;
|
|
68
68
|
}
|
|
69
69
|
}, [viewRef, nativeView]);
|
|
70
|
-
|
|
70
|
+
if (!isPlayerInitialized) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return (<NativePlayerView ref={nativeView} style={nativeViewStyle} config={nativePlayerViewConfig} isFullscreenRequested={isFullscreenRequested} isPictureInPictureRequested={isPictureInPictureRequested} scalingMode={scalingMode} fullscreenBridgeId={fullscreenBridge.current?.nativeId} onBmpAdBreakFinished={proxy(props.onAdBreakFinished)} onBmpAdBreakStarted={proxy(props.onAdBreakStarted)} onBmpAdClicked={proxy(props.onAdClicked)} onBmpAdError={proxy(props.onAdError)} onBmpAdFinished={proxy(props.onAdFinished)} onBmpAdManifestLoad={proxy(props.onAdManifestLoad)} onBmpAdManifestLoaded={proxy(props.onAdManifestLoaded)} onBmpAdQuartile={proxy(props.onAdQuartile)} onBmpAdScheduled={proxy(props.onAdScheduled)} onBmpAdSkipped={proxy(props.onAdSkipped)} onBmpAdStarted={proxy(props.onAdStarted)} onBmpCastAvailable={proxy(props.onCastAvailable)} onBmpCastPaused={proxy(props.onCastPaused)} onBmpCastPlaybackFinished={proxy(props.onCastPlaybackFinished)} onBmpCastPlaying={proxy(props.onCastPlaying)} onBmpCastStarted={proxy(props.onCastStarted)} onBmpCastStart={proxy(props.onCastStart)} onBmpCastStopped={proxy(props.onCastStopped)} onBmpCastTimeUpdated={proxy(props.onCastTimeUpdated)} onBmpCastWaitingForDevice={proxy(props.onCastWaitingForDevice)} onBmpCueEnter={proxy(props.onCueEnter)} onBmpCueExit={proxy(props.onCueExit)} onBmpDestroy={proxy(props.onDestroy)} onBmpEvent={proxy(props.onEvent)} onBmpFullscreenEnabled={proxy(props.onFullscreenEnabled)} onBmpFullscreenDisabled={proxy(props.onFullscreenDisabled)} onBmpFullscreenEnter={proxy(props.onFullscreenEnter)} onBmpFullscreenExit={proxy(props.onFullscreenExit)} onBmpMuted={proxy(props.onMuted)} onBmpPaused={proxy(props.onPaused)} onBmpPictureInPictureAvailabilityChanged={proxy(props.onPictureInPictureAvailabilityChanged)} onBmpPictureInPictureEnter={proxy(props.onPictureInPictureEnter)} onBmpPictureInPictureEntered={proxy(props.onPictureInPictureEntered)} onBmpPictureInPictureExit={proxy(props.onPictureInPictureExit)} onBmpPictureInPictureExited={proxy(props.onPictureInPictureExited)} onBmpPlay={proxy(props.onPlay)} onBmpPlaybackFinished={proxy(props.onPlaybackFinished)} onBmpPlaybackSpeedChanged={proxy(props.onPlaybackSpeedChanged)} onBmpPlayerActive={proxy(props.onPlayerActive)} onBmpPlayerError={proxy(props.onPlayerError)} onBmpPlayerWarning={proxy(props.onPlayerWarning)} onBmpPlaying={proxy(props.onPlaying)} onBmpReady={proxy(props.onReady)} onBmpSeek={proxy(props.onSeek)} onBmpSeeked={proxy(props.onSeeked)} onBmpTimeShift={proxy(props.onTimeShift)} onBmpTimeShifted={proxy(props.onTimeShifted)} onBmpStallStarted={proxy(props.onStallStarted)} onBmpStallEnded={proxy(props.onStallEnded)} onBmpSourceError={proxy(props.onSourceError)} onBmpSourceLoad={proxy(props.onSourceLoad)} onBmpSourceLoaded={proxy(props.onSourceLoaded)} onBmpSourceUnloaded={proxy(props.onSourceUnloaded)} onBmpSourceWarning={proxy(props.onSourceWarning)} onBmpAudioAdded={proxy(props.onAudioAdded)} onBmpAudioChanged={proxy(props.onAudioChanged)} onBmpAudioRemoved={proxy(props.onAudioRemoved)} onBmpSubtitleAdded={proxy(props.onSubtitleAdded)} onBmpSubtitleChanged={proxy(props.onSubtitleChanged)} onBmpSubtitleRemoved={proxy(props.onSubtitleRemoved)} onBmpTimeChanged={proxy(props.onTimeChanged)} onBmpUnmuted={proxy(props.onUnmuted)} onBmpVideoDownloadQualityChanged={proxy(props.onVideoDownloadQualityChanged)} onBmpVideoPlaybackQualityChanged={proxy(props.onVideoPlaybackQualityChanged)} onBmpDownloadFinished={proxy(props.onDownloadFinished)}/>);
|
|
71
74
|
}
|
|
72
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PlayerView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAA0B,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAGjF;;GAEG;AACH,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,SAAS,EAAE,SAAS;KACrB;CACF,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,iBAA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gB,CAAC,CAAC,CACnD,kBAAkB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CACjD,eAAe,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAC3C,iBAAiB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAC/C,iBAAiB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAC/C,kBAAkB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CACjD,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CACrD,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CACrD,gBAAgB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAC7C,YAAY,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CACrC,gCAAgC,CAAC,CAAC,KAAK,CACrC,KAAK,CAAC,6BAA6B,CACpC,CAAC,CACF,gCAAgC,CAAC,CAAC,KAAK,CACrC,KAAK,CAAC,6BAA6B,CACpC,CAAC,CACF,qBAAqB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,EACvD,CACH,CACF,CAAC;AACJ,CAAC","sourcesContent":["import React, { useRef, useEffect, useState } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { useKeepAwake } from 'expo-keep-awake';\nimport { NativePlayerView, NativePlayerViewConfig } from './native';\nimport { useProxy } from '../../hooks/useProxy';\nimport { FullscreenHandlerBridge } from '../../ui/fullscreenhandlerbridge';\nimport { CustomMessageHandlerBridge } from '../../ui/custommessagehandlerbridge';\nimport { PlayerViewProps } from './properties';\n\n/**\n * Base style that initializes the native view frame when no width/height prop has been set.\n */\nconst styles = StyleSheet.create({\n baseStyle: {\n alignSelf: 'stretch',\n },\n});\n\n/**\n * Component that provides the Bitmovin Player UI and default UI handling to an attached `Player` instance.\n * This component needs a `Player` instance to work properly so make sure one is passed to it as a prop.\n *\n * @param options configuration options\n */\nexport function PlayerView({\n viewRef,\n style,\n player,\n config,\n fullscreenHandler,\n customMessageHandler,\n isFullscreenRequested = false,\n scalingMode,\n isPictureInPictureRequested = false,\n ...props\n}: PlayerViewProps) {\n // Keep the device awake while the PlayerView is mounted\n useKeepAwake();\n\n const nativeView = useRef(viewRef?.current || null);\n\n // Native events proxy helper.\n const proxy = useProxy(nativeView);\n // Style resulting from merging `baseStyle` and `props.style`.\n const nativeViewStyle = StyleSheet.flatten([styles.baseStyle, style]);\n\n const fullscreenBridge: React.RefObject<FullscreenHandlerBridge | undefined> =\n useRef(undefined);\n if (fullscreenHandler && !fullscreenBridge.current) {\n fullscreenBridge.current = new FullscreenHandlerBridge();\n }\n if (fullscreenBridge.current) {\n fullscreenBridge.current.setFullscreenHandler(fullscreenHandler);\n }\n\n const customMessageHandlerBridge: React.RefObject<\n CustomMessageHandlerBridge | undefined\n > = useRef(undefined);\n if (customMessageHandler && !customMessageHandlerBridge.current) {\n customMessageHandlerBridge.current = new CustomMessageHandlerBridge();\n }\n if (customMessageHandlerBridge.current && customMessageHandler) {\n customMessageHandlerBridge.current.setCustomMessageHandler(\n customMessageHandler\n );\n }\n\n const nativePlayerViewConfig: NativePlayerViewConfig = {\n playerId: player.nativeId,\n customMessageHandlerBridgeId: customMessageHandlerBridge.current?.nativeId,\n enableBackgroundPlayback:\n player.config?.playbackConfig?.isBackgroundPlaybackEnabled,\n isPictureInPictureEnabledOnPlayer:\n player.config?.playbackConfig?.isPictureInPictureEnabled,\n userInterfaceTypeName: player.config?.styleConfig?.userInterfaceType,\n playerViewConfig: config,\n };\n\n const [isPlayerInitialized, setIsPlayerInitialized] = useState(false);\n\n useEffect(() => {\n player.initialize().then(() => {\n setIsPlayerInitialized(true);\n // call attach player on native view if switched to AsyncFunction for RNPlayerViewExpo\n });\n\n return () => {\n fullscreenBridge.current?.destroy();\n fullscreenBridge.current = undefined;\n customMessageHandlerBridge.current?.destroy();\n customMessageHandlerBridge.current = undefined;\n };\n }, [player, fullscreenBridge, customMessageHandlerBridge]);\n\n useEffect(() => {\n if (viewRef) {\n viewRef.current = nativeView.current;\n }\n }, [viewRef, nativeView]);\n\n return (\n isPlayerInitialized && (\n <NativePlayerView\n ref={nativeView}\n style={nativeViewStyle}\n config={nativePlayerViewConfig}\n isFullscreenRequested={isFullscreenRequested}\n isPictureInPictureRequested={isPictureInPictureRequested}\n scalingMode={scalingMode}\n fullscreenBridgeId={fullscreenBridge.current?.nativeId}\n onBmpAdBreakFinished={proxy(props.onAdBreakFinished)}\n onBmpAdBreakStarted={proxy(props.onAdBreakStarted)}\n onBmpAdClicked={proxy(props.onAdClicked)}\n onBmpAdError={proxy(props.onAdError)}\n onBmpAdFinished={proxy(props.onAdFinished)}\n onBmpAdManifestLoad={proxy(props.onAdManifestLoad)}\n onBmpAdManifestLoaded={proxy(props.onAdManifestLoaded)}\n onBmpAdQuartile={proxy(props.onAdQuartile)}\n onBmpAdScheduled={proxy(props.onAdScheduled)}\n onBmpAdSkipped={proxy(props.onAdSkipped)}\n onBmpAdStarted={proxy(props.onAdStarted)}\n onBmpCastAvailable={proxy(props.onCastAvailable)}\n onBmpCastPaused={proxy(props.onCastPaused)}\n onBmpCastPlaybackFinished={proxy(props.onCastPlaybackFinished)}\n onBmpCastPlaying={proxy(props.onCastPlaying)}\n onBmpCastStarted={proxy(props.onCastStarted)}\n onBmpCastStart={proxy(props.onCastStart)}\n onBmpCastStopped={proxy(props.onCastStopped)}\n onBmpCastTimeUpdated={proxy(props.onCastTimeUpdated)}\n onBmpCastWaitingForDevice={proxy(props.onCastWaitingForDevice)}\n onBmpCueEnter={proxy(props.onCueEnter)}\n onBmpCueExit={proxy(props.onCueExit)}\n onBmpDestroy={proxy(props.onDestroy)}\n onBmpEvent={proxy(props.onEvent)}\n onBmpFullscreenEnabled={proxy(props.onFullscreenEnabled)}\n onBmpFullscreenDisabled={proxy(props.onFullscreenDisabled)}\n onBmpFullscreenEnter={proxy(props.onFullscreenEnter)}\n onBmpFullscreenExit={proxy(props.onFullscreenExit)}\n onBmpMuted={proxy(props.onMuted)}\n onBmpPaused={proxy(props.onPaused)}\n onBmpPictureInPictureAvailabilityChanged={proxy(\n props.onPictureInPictureAvailabilityChanged\n )}\n onBmpPictureInPictureEnter={proxy(props.onPictureInPictureEnter)}\n onBmpPictureInPictureEntered={proxy(props.onPictureInPictureEntered)}\n onBmpPictureInPictureExit={proxy(props.onPictureInPictureExit)}\n onBmpPictureInPictureExited={proxy(props.onPictureInPictureExited)}\n onBmpPlay={proxy(props.onPlay)}\n onBmpPlaybackFinished={proxy(props.onPlaybackFinished)}\n onBmpPlaybackSpeedChanged={proxy(props.onPlaybackSpeedChanged)}\n onBmpPlayerActive={proxy(props.onPlayerActive)}\n onBmpPlayerError={proxy(props.onPlayerError)}\n onBmpPlayerWarning={proxy(props.onPlayerWarning)}\n onBmpPlaying={proxy(props.onPlaying)}\n onBmpReady={proxy(props.onReady)}\n onBmpSeek={proxy(props.onSeek)}\n onBmpSeeked={proxy(props.onSeeked)}\n onBmpTimeShift={proxy(props.onTimeShift)}\n onBmpTimeShifted={proxy(props.onTimeShifted)}\n onBmpStallStarted={proxy(props.onStallStarted)}\n onBmpStallEnded={proxy(props.onStallEnded)}\n onBmpSourceError={proxy(props.onSourceError)}\n onBmpSourceLoad={proxy(props.onSourceLoad)}\n onBmpSourceLoaded={proxy(props.onSourceLoaded)}\n onBmpSourceUnloaded={proxy(props.onSourceUnloaded)}\n onBmpSourceWarning={proxy(props.onSourceWarning)}\n onBmpAudioAdded={proxy(props.onAudioAdded)}\n onBmpAudioChanged={proxy(props.onAudioChanged)}\n onBmpAudioRemoved={proxy(props.onAudioRemoved)}\n onBmpSubtitleAdded={proxy(props.onSubtitleAdded)}\n onBmpSubtitleChanged={proxy(props.onSubtitleChanged)}\n onBmpSubtitleRemoved={proxy(props.onSubtitleRemoved)}\n onBmpTimeChanged={proxy(props.onTimeChanged)}\n onBmpUnmuted={proxy(props.onUnmuted)}\n onBmpVideoDownloadQualityChanged={proxy(\n props.onVideoDownloadQualityChanged\n )}\n onBmpVideoPlaybackQualityChanged={proxy(\n props.onVideoPlaybackQualityChanged\n )}\n onBmpDownloadFinished={proxy(props.onDownloadFinished)}\n />\n )\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PlayerView/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAA0B,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAGjF;;GAEG;AACH,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,SAAS,EAAE,SAAS;KACrB;CACF,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GAAG,KAAK,EAC7B,WAAW,EACX,2BAA2B,GAAG,KAAK,EACnC,GAAG,KAAK,EACQ;IAChB,wDAAwD;IACxD,YAAY,EAAE,CAAC;IAEf,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC;IAEpD,8BAA8B;IAC9B,MAAM,KA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AAc,CAAC,CAAC,CAC/C,iBAAiB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAC/C,kBAAkB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CACjD,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CACrD,oBAAoB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CACrD,gBAAgB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAC7C,YAAY,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CACrC,gCAAgC,CAAC,CAAC,KAAK,CACrC,KAAK,CAAC,6BAA6B,CACpC,CAAC,CACF,gCAAgC,CAAC,CAAC,KAAK,CACrC,KAAK,CAAC,6BAA6B,CACpC,CAAC,CACF,qBAAqB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,EACvD,CACH,CAAC;AACJ,CAAC","sourcesContent":["import React, { useRef, useEffect, useState } from 'react';\nimport { StyleSheet } from 'react-native';\nimport { useKeepAwake } from 'expo-keep-awake';\nimport { NativePlayerView, NativePlayerViewConfig } from './native';\nimport { useProxy } from '../../hooks/useProxy';\nimport { FullscreenHandlerBridge } from '../../ui/fullscreenhandlerbridge';\nimport { CustomMessageHandlerBridge } from '../../ui/custommessagehandlerbridge';\nimport { PlayerViewProps } from './properties';\n\n/**\n * Base style that initializes the native view frame when no width/height prop has been set.\n */\nconst styles = StyleSheet.create({\n baseStyle: {\n alignSelf: 'stretch',\n },\n});\n\n/**\n * Component that provides the Bitmovin Player UI and default UI handling to an attached `Player` instance.\n * This component needs a `Player` instance to work properly so make sure one is passed to it as a prop.\n *\n * @param options configuration options\n */\nexport function PlayerView({\n viewRef,\n style,\n player,\n config,\n fullscreenHandler,\n customMessageHandler,\n isFullscreenRequested = false,\n scalingMode,\n isPictureInPictureRequested = false,\n ...props\n}: PlayerViewProps) {\n // Keep the device awake while the PlayerView is mounted\n useKeepAwake();\n\n const nativeView = useRef(viewRef?.current || null);\n\n // Native events proxy helper.\n const proxy = useProxy(nativeView);\n // Style resulting from merging `baseStyle` and `props.style`.\n const nativeViewStyle = StyleSheet.flatten([styles.baseStyle, style]);\n\n const fullscreenBridge: React.RefObject<FullscreenHandlerBridge | undefined> =\n useRef(undefined);\n if (fullscreenHandler && !fullscreenBridge.current) {\n fullscreenBridge.current = new FullscreenHandlerBridge();\n }\n if (fullscreenBridge.current) {\n fullscreenBridge.current.setFullscreenHandler(fullscreenHandler);\n }\n\n const customMessageHandlerBridge: React.RefObject<\n CustomMessageHandlerBridge | undefined\n > = useRef(undefined);\n if (customMessageHandler && !customMessageHandlerBridge.current) {\n customMessageHandlerBridge.current = new CustomMessageHandlerBridge();\n }\n if (customMessageHandlerBridge.current && customMessageHandler) {\n customMessageHandlerBridge.current.setCustomMessageHandler(\n customMessageHandler\n );\n }\n\n const nativePlayerViewConfig: NativePlayerViewConfig = {\n playerId: player.nativeId,\n customMessageHandlerBridgeId: customMessageHandlerBridge.current?.nativeId,\n enableBackgroundPlayback:\n player.config?.playbackConfig?.isBackgroundPlaybackEnabled,\n isPictureInPictureEnabledOnPlayer:\n player.config?.playbackConfig?.isPictureInPictureEnabled,\n userInterfaceTypeName: player.config?.styleConfig?.userInterfaceType,\n playerViewConfig: config,\n };\n\n const [isPlayerInitialized, setIsPlayerInitialized] = useState(false);\n\n useEffect(() => {\n player.initialize().then(() => {\n setIsPlayerInitialized(true);\n // call attach player on native view if switched to AsyncFunction for RNPlayerViewExpo\n });\n\n return () => {\n fullscreenBridge.current?.destroy();\n fullscreenBridge.current = undefined;\n customMessageHandlerBridge.current?.destroy();\n customMessageHandlerBridge.current = undefined;\n };\n }, [player, fullscreenBridge, customMessageHandlerBridge]);\n\n useEffect(() => {\n if (viewRef) {\n viewRef.current = nativeView.current;\n }\n }, [viewRef, nativeView]);\n\n if (!isPlayerInitialized) {\n return null;\n }\n\n return (\n <NativePlayerView\n ref={nativeView}\n style={nativeViewStyle}\n config={nativePlayerViewConfig}\n isFullscreenRequested={isFullscreenRequested}\n isPictureInPictureRequested={isPictureInPictureRequested}\n scalingMode={scalingMode}\n fullscreenBridgeId={fullscreenBridge.current?.nativeId}\n onBmpAdBreakFinished={proxy(props.onAdBreakFinished)}\n onBmpAdBreakStarted={proxy(props.onAdBreakStarted)}\n onBmpAdClicked={proxy(props.onAdClicked)}\n onBmpAdError={proxy(props.onAdError)}\n onBmpAdFinished={proxy(props.onAdFinished)}\n onBmpAdManifestLoad={proxy(props.onAdManifestLoad)}\n onBmpAdManifestLoaded={proxy(props.onAdManifestLoaded)}\n onBmpAdQuartile={proxy(props.onAdQuartile)}\n onBmpAdScheduled={proxy(props.onAdScheduled)}\n onBmpAdSkipped={proxy(props.onAdSkipped)}\n onBmpAdStarted={proxy(props.onAdStarted)}\n onBmpCastAvailable={proxy(props.onCastAvailable)}\n onBmpCastPaused={proxy(props.onCastPaused)}\n onBmpCastPlaybackFinished={proxy(props.onCastPlaybackFinished)}\n onBmpCastPlaying={proxy(props.onCastPlaying)}\n onBmpCastStarted={proxy(props.onCastStarted)}\n onBmpCastStart={proxy(props.onCastStart)}\n onBmpCastStopped={proxy(props.onCastStopped)}\n onBmpCastTimeUpdated={proxy(props.onCastTimeUpdated)}\n onBmpCastWaitingForDevice={proxy(props.onCastWaitingForDevice)}\n onBmpCueEnter={proxy(props.onCueEnter)}\n onBmpCueExit={proxy(props.onCueExit)}\n onBmpDestroy={proxy(props.onDestroy)}\n onBmpEvent={proxy(props.onEvent)}\n onBmpFullscreenEnabled={proxy(props.onFullscreenEnabled)}\n onBmpFullscreenDisabled={proxy(props.onFullscreenDisabled)}\n onBmpFullscreenEnter={proxy(props.onFullscreenEnter)}\n onBmpFullscreenExit={proxy(props.onFullscreenExit)}\n onBmpMuted={proxy(props.onMuted)}\n onBmpPaused={proxy(props.onPaused)}\n onBmpPictureInPictureAvailabilityChanged={proxy(\n props.onPictureInPictureAvailabilityChanged\n )}\n onBmpPictureInPictureEnter={proxy(props.onPictureInPictureEnter)}\n onBmpPictureInPictureEntered={proxy(props.onPictureInPictureEntered)}\n onBmpPictureInPictureExit={proxy(props.onPictureInPictureExit)}\n onBmpPictureInPictureExited={proxy(props.onPictureInPictureExited)}\n onBmpPlay={proxy(props.onPlay)}\n onBmpPlaybackFinished={proxy(props.onPlaybackFinished)}\n onBmpPlaybackSpeedChanged={proxy(props.onPlaybackSpeedChanged)}\n onBmpPlayerActive={proxy(props.onPlayerActive)}\n onBmpPlayerError={proxy(props.onPlayerError)}\n onBmpPlayerWarning={proxy(props.onPlayerWarning)}\n onBmpPlaying={proxy(props.onPlaying)}\n onBmpReady={proxy(props.onReady)}\n onBmpSeek={proxy(props.onSeek)}\n onBmpSeeked={proxy(props.onSeeked)}\n onBmpTimeShift={proxy(props.onTimeShift)}\n onBmpTimeShifted={proxy(props.onTimeShifted)}\n onBmpStallStarted={proxy(props.onStallStarted)}\n onBmpStallEnded={proxy(props.onStallEnded)}\n onBmpSourceError={proxy(props.onSourceError)}\n onBmpSourceLoad={proxy(props.onSourceLoad)}\n onBmpSourceLoaded={proxy(props.onSourceLoaded)}\n onBmpSourceUnloaded={proxy(props.onSourceUnloaded)}\n onBmpSourceWarning={proxy(props.onSourceWarning)}\n onBmpAudioAdded={proxy(props.onAudioAdded)}\n onBmpAudioChanged={proxy(props.onAudioChanged)}\n onBmpAudioRemoved={proxy(props.onAudioRemoved)}\n onBmpSubtitleAdded={proxy(props.onSubtitleAdded)}\n onBmpSubtitleChanged={proxy(props.onSubtitleChanged)}\n onBmpSubtitleRemoved={proxy(props.onSubtitleRemoved)}\n onBmpTimeChanged={proxy(props.onTimeChanged)}\n onBmpUnmuted={proxy(props.onUnmuted)}\n onBmpVideoDownloadQualityChanged={proxy(\n props.onVideoDownloadQualityChanged\n )}\n onBmpVideoPlaybackQualityChanged={proxy(\n props.onVideoPlaybackQualityChanged\n )}\n onBmpDownloadFinished={proxy(props.onDownloadFinished)}\n />\n );\n}\n"]}
|
|
@@ -8,7 +8,10 @@ public class AppLifecycleDelegate: ExpoAppDelegateSubscriber {
|
|
|
8
8
|
) -> Bool {
|
|
9
9
|
// TODO: Add support for OfflineConfig via config plugin
|
|
10
10
|
#if os(iOS)
|
|
11
|
-
|
|
11
|
+
if let offlineSupportEnabled = Bundle.main.infoDictionary?["BitmovinPlayerOfflineSupportEnabled"] as? Bool,
|
|
12
|
+
offlineSupportEnabled {
|
|
13
|
+
OfflineManager.initializeOfflineManager()
|
|
14
|
+
}
|
|
12
15
|
#endif
|
|
13
16
|
return true
|
|
14
17
|
}
|
package/ios/OfflineModule.swift
CHANGED
|
@@ -90,7 +90,7 @@ public class OfflineModule: Module {
|
|
|
90
90
|
}.runOnQueue(.main)
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
#if os(iOS)
|
|
94
94
|
private func createOfflineManager(nativeId: NativeId, config: [String: Any?]?, drmNativeId: NativeId?) {
|
|
95
95
|
if self.offlineContentManagerBridges[nativeId] != nil {
|
|
96
96
|
return
|
|
@@ -146,13 +146,9 @@ public class OfflineModule: Module {
|
|
|
146
146
|
downloadConfig: config
|
|
147
147
|
)
|
|
148
148
|
}
|
|
149
|
-
#endif
|
|
150
149
|
|
|
151
150
|
internal func retrieve(_ nativeId: NativeId) -> OfflineContentManagerBridge? {
|
|
152
|
-
|
|
153
|
-
return self.offlineContentManagerBridges[nativeId]
|
|
154
|
-
#else
|
|
155
|
-
return nil
|
|
156
|
-
#endif
|
|
151
|
+
self.offlineContentManagerBridges[nativeId]
|
|
157
152
|
}
|
|
153
|
+
#endif
|
|
158
154
|
}
|