bitmovin-player-react-native 1.0.0-alpha.1 → 1.0.0-alpha.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/CONTRIBUTING.md +1 -1
- package/android/ktlint.gradle +1 -1
- 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/app.plugin.js +6 -6
- 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 +6 -3
- package/build/components/PlayerView/index.js.map +1 -1
- package/build/nativeInstance.d.ts.map +1 -1
- package/build/nativeInstance.js +2 -3
- package/build/nativeInstance.js.map +1 -1
- package/build/ui/custommessagehandlerbridge.js +2 -2
- package/build/ui/custommessagehandlerbridge.js.map +1 -1
- package/build/ui/fullscreenhandlerbridge.js +2 -2
- package/build/ui/fullscreenhandlerbridge.js.map +1 -1
- package/expo-module.config.json +0 -2
- package/ios/AppLifecycleDelegate.swift +4 -1
- package/ios/PlayerModule.swift +99 -94
- package/ios/PlayerRegistry.swift +88 -0
- package/ios/RNBitmovinPlayer.podspec +2 -2
- package/package.json +4 -1
- package/plugin/build/withBitmovinIosConfig.js +25 -20
- package/plugin/src/withBitmovinIosConfig.ts +27 -21
- package/scripts/check-dependencies.js +26 -0
- package/scripts/setup-hooks.sh +1 -1
- package/src/components/PlayerView/index.tsx +86 -84
- package/src/nativeInstance.ts +2 -4
- package/src/ui/custommessagehandlerbridge.ts +2 -2
- package/src/ui/fullscreenhandlerbridge.ts +2 -2
- package/TODO.md +0 -0
- package/android/src/main/java/com/bitmovin/player/reactnative/UuidModule.kt +0 -18
- package/build/modules/UuidModule.d.ts +0 -8
- package/build/modules/UuidModule.d.ts.map +0 -1
- package/build/modules/UuidModule.js +0 -3
- package/build/modules/UuidModule.js.map +0 -1
- package/ios/UuidModule.swift +0 -15
- package/src/modules/UuidModule.ts +0 -9
package/CONTRIBUTING.md
CHANGED
|
@@ -96,7 +96,7 @@ yarn lint:all
|
|
|
96
96
|
|
|
97
97
|
[ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/)
|
|
98
98
|
|
|
99
|
-
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code
|
|
99
|
+
We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code.
|
|
100
100
|
|
|
101
101
|
Make sure your code passes TypeScript and ESLint. Run the following to verify:
|
|
102
102
|
|
package/android/ktlint.gradle
CHANGED
|
@@ -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
|
+
}
|
package/app.plugin.js
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
* "bitmovin-player-react-native",
|
|
8
8
|
* {
|
|
9
9
|
* "licenseKey": "ENTER_LICENSE_KEY",
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* "featureFlags": {
|
|
11
|
+
* "airPlay": true,
|
|
12
|
+
* "backgroundPlayback": true,
|
|
13
|
+
* "googleCastSDK": { "android": "21.3.0", "ios": "4.8.1.2" },
|
|
14
|
+
* "offline": true,
|
|
15
|
+
* "pictureInPicture": true
|
|
16
16
|
* }
|
|
17
17
|
* }
|
|
18
18
|
* ]
|
|
@@ -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"}
|
|
@@ -63,10 +63,13 @@ export function PlayerView({ viewRef, style, player, config, fullscreenHandler,
|
|
|
63
63
|
};
|
|
64
64
|
}, [player, fullscreenBridge, customMessageHandlerBridge]);
|
|
65
65
|
useEffect(() => {
|
|
66
|
-
if (viewRef) {
|
|
66
|
+
if (isPlayerInitialized && viewRef) {
|
|
67
67
|
viewRef.current = nativeView.current;
|
|
68
68
|
}
|
|
69
|
-
}, [viewRef, nativeView]);
|
|
70
|
-
|
|
69
|
+
}, [isPlayerInitialized, viewRef, nativeView]);
|
|
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
|
|
@@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gB,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,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,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 (isPlayerInitialized && viewRef) {\n viewRef.current = nativeView.current;\n }\n }, [isPlayerInitialized, 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeInstance.d.ts","sourceRoot":"","sources":["../src/nativeInstance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nativeInstance.d.ts","sourceRoot":"","sources":["../src/nativeInstance.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,cAAc,CAC1C,MAAM,SAAS,oBAAoB;IAEnC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;gBACS,MAAM,CAAC,EAAE,MAAM;IAK3B;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,QAAQ,CAAC,UAAU,IAAI,IAAI;IAE3B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,OAAO,IAAI,IAAI;CACzB"}
|
package/build/nativeInstance.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const Uuid = UuidModule;
|
|
1
|
+
import * as Crypto from 'expo-crypto';
|
|
3
2
|
export default class NativeInstance {
|
|
4
3
|
/**
|
|
5
4
|
* Optionally user-defined string `id` for the native instance, or UUIDv4.
|
|
@@ -14,7 +13,7 @@ export default class NativeInstance {
|
|
|
14
13
|
*/
|
|
15
14
|
constructor(config) {
|
|
16
15
|
this.config = config;
|
|
17
|
-
this.nativeId = config?.nativeId ??
|
|
16
|
+
this.nativeId = config?.nativeId ?? Crypto.randomUUID();
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
//# sourceMappingURL=nativeInstance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeInstance.js","sourceRoot":"","sources":["../src/nativeInstance.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"nativeInstance.js","sourceRoot":"","sources":["../src/nativeInstance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAmBtC,MAAM,CAAC,OAAO,OAAgB,cAAc;IAG1C;;OAEG;IACM,QAAQ,CAAS;IAE1B;;OAEG;IACM,MAAM,CAAU;IAEzB;;OAEG;IACH,YAAY,MAAe;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,MAAM,EAAE,QAAQ,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;IAC1D,CAAC;CAuBF","sourcesContent":["import * as Crypto from 'expo-crypto';\n\nexport interface NativeInstanceConfig {\n /**\n * Optionally user-defined string `id` for the native instance.\n * Used to access a certain native instance from any point in the source code then call\n * methods/properties on it.\n *\n * When left empty, a random `UUIDv4` is generated for it.\n * @example\n * Accessing or creating the `Player` with `nativeId` equal to `my-player`:\n * ```\n * const player = new Player({ nativeId: 'my-player' })\n * player.play(); // call methods and properties...\n * ```\n */\n nativeId?: string;\n}\n\nexport default abstract class NativeInstance<\n Config extends NativeInstanceConfig,\n> {\n /**\n * Optionally user-defined string `id` for the native instance, or UUIDv4.\n */\n readonly nativeId: string;\n\n /**\n * The configuration object used to initialize this instance.\n */\n readonly config?: Config;\n\n /**\n * Generate UUID in case the user-defined `nativeId` is empty.\n */\n constructor(config?: Config) {\n this.config = config;\n this.nativeId = config?.nativeId ?? Crypto.randomUUID();\n }\n\n /**\n * Flag indicating whether the native resources of this object have been created internally\n * .i.e `initialize` has been called.\n */\n abstract isInitialized: boolean;\n\n /**\n * Create the native object/resources that will be managed by this instance.\n */\n abstract initialize(): void;\n\n /**\n * Flag indicating whether the native resources of this object have been disposed .i.e\n * `destroy` has been called.\n */\n abstract isDestroyed: boolean;\n\n /**\n * Dispose the native object/resources created by this instance during `initialize`.\n */\n abstract destroy(): void;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Crypto from 'expo-crypto';
|
|
2
2
|
import CustomMessageHandlerModule from './customMessageHandlerModule';
|
|
3
3
|
/**
|
|
4
4
|
* Takes care of JS/Native communication for a CustomMessageHandler.
|
|
@@ -10,7 +10,7 @@ export class CustomMessageHandlerBridge {
|
|
|
10
10
|
onReceivedSynchronousMessageSubscription;
|
|
11
11
|
onReceivedAsynchronousMessageSubscription;
|
|
12
12
|
constructor(nativeId) {
|
|
13
|
-
this.nativeId = nativeId ??
|
|
13
|
+
this.nativeId = nativeId ?? Crypto.randomUUID();
|
|
14
14
|
this.isDestroyed = false;
|
|
15
15
|
// Set up event listeners for synchronous and asynchronous messages
|
|
16
16
|
this.onReceivedSynchronousMessageSubscription =
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custommessagehandlerbridge.js","sourceRoot":"","sources":["../../src/ui/custommessagehandlerbridge.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"custommessagehandlerbridge.js","sourceRoot":"","sources":["../../src/ui/custommessagehandlerbridge.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,0BAA0B;IAC5B,QAAQ,CAAS;IAClB,oBAAoB,CAAwB;IAC5C,WAAW,CAAU;IAErB,wCAAwC,CAAqB;IAC7D,yCAAyC,CAAqB;IAEtE,YAAY,QAAiB;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAChD,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAEzB,mEAAmE;QACnE,IAAI,CAAC,wCAAwC;YAC3C,0BAA0B,CAAC,WAAW,CACpC,8BAA8B,EAC9B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;gBAClC,IAAI,QAAQ,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAC/B,OAAO;gBACT,CAAC;gBACD,IAAI,CAAC,0BAA0B,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;YACrD,CAAC,CACF,CAAC;QAEJ,IAAI,CAAC,yCAAyC;YAC5C,0BAA0B,CAAC,WAAW,CACpC,+BAA+B,EAC/B,CAAC,EAAE,QAAQ,EAAE,OAAO,EA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e,EAAE,IAAwB;QACnD,0BAA0B,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACvE,CAAC;CACF","sourcesContent":["import { EventSubscription } from 'expo-modules-core';\nimport { CustomMessageHandler } from './custommessagehandler';\nimport { CustomMessageSender } from './custommessagesender';\nimport * as Crypto from 'expo-crypto';\nimport CustomMessageHandlerModule from './customMessageHandlerModule';\n\n/**\n * Takes care of JS/Native communication for a CustomMessageHandler.\n */\nexport class CustomMessageHandlerBridge implements CustomMessageSender {\n readonly nativeId: string;\n private customMessageHandler?: CustomMessageHandler;\n private isDestroyed: boolean;\n\n private onReceivedSynchronousMessageSubscription?: EventSubscription;\n private onReceivedAsynchronousMessageSubscription?: EventSubscription;\n\n constructor(nativeId?: string) {\n this.nativeId = nativeId ?? Crypto.randomUUID();\n this.isDestroyed = false;\n\n // Set up event listeners for synchronous and asynchronous messages\n this.onReceivedSynchronousMessageSubscription =\n CustomMessageHandlerModule.addListener(\n 'onReceivedSynchronousMessage',\n ({ nativeId, id, message, data }) => {\n if (nativeId !== this.nativeId) {\n return;\n }\n this.receivedSynchronousMessage(id, message, data);\n }\n );\n\n this.onReceivedAsynchronousMessageSubscription =\n CustomMessageHandlerModule.addListener(\n 'onReceivedAsynchronousMessage',\n ({ nativeId, message, data }) => {\n if (nativeId !== this.nativeId) {\n return;\n }\n this.receivedAsynchronousMessage(message, data);\n }\n );\n\n CustomMessageHandlerModule.registerHandler(this.nativeId);\n }\n\n setCustomMessageHandler(customMessageHandler: CustomMessageHandler) {\n this.customMessageHandler = customMessageHandler;\n this.customMessageHandler.customMessageSender = this;\n }\n\n /**\n * Destroys the native CustomMessageHandler\n */\n destroy() {\n if (!this.isDestroyed) {\n CustomMessageHandlerModule.destroy(this.nativeId);\n this.onReceivedSynchronousMessageSubscription?.remove();\n this.onReceivedAsynchronousMessageSubscription?.remove();\n this.onReceivedSynchronousMessageSubscription = undefined;\n this.onReceivedAsynchronousMessageSubscription = undefined;\n this.isDestroyed = true;\n }\n }\n\n /**\n * Called by native code, when the UI sends a synchronous message.\n * @internal\n */\n private receivedSynchronousMessage(\n id: number,\n message: string,\n data: string | undefined\n ): void {\n const result = this.customMessageHandler?.receivedSynchronousMessage(\n message,\n data\n );\n CustomMessageHandlerModule.onReceivedSynchronousMessageResult(id, result);\n }\n\n /**\n * Called by native code, when the UI sends an asynchronous message.\n * @internal\n */\n private receivedAsynchronousMessage(\n message: string,\n data: string | undefined\n ): void {\n this.customMessageHandler?.receivedAsynchronousMessage(message, data);\n }\n\n // noinspection JSUnusedGlobalSymbols\n /**\n * Called by CustomMessageHandler, when sending a message to the UI.\n */\n sendMessage(message: string, data: string | undefined): void {\n CustomMessageHandlerModule.sendMessage(this.nativeId, message, data);\n }\n}\n"]}
|