@100mslive/react-native-hms 1.12.1 → 1.12.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.
|
@@ -14,6 +14,7 @@ import com.facebook.react.bridge.ReactContext
|
|
|
14
14
|
import com.facebook.react.bridge.ReadableArray
|
|
15
15
|
import com.facebook.react.bridge.ReadableMap
|
|
16
16
|
import com.facebook.react.bridge.WritableMap
|
|
17
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
17
18
|
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
18
19
|
import live.hms.hls_player.*
|
|
19
20
|
import live.hms.stats.PlayerStatsListener
|
|
@@ -25,7 +26,7 @@ import java.util.concurrent.TimeUnit
|
|
|
25
26
|
|
|
26
27
|
@SuppressLint("ViewConstructor")
|
|
27
28
|
class HMSHLSPlayer(
|
|
28
|
-
context:
|
|
29
|
+
context: ThemedReactContext,
|
|
29
30
|
) : FrameLayout(context) {
|
|
30
31
|
private var playerView: PlayerView? = null // Exoplayer View
|
|
31
32
|
private var hmsHlsPlayer: HmsHlsPlayer? = null // 100ms HLS Player
|
|
@@ -124,7 +125,8 @@ class HMSHLSPlayer(
|
|
|
124
125
|
localPlayerView.useController = false
|
|
125
126
|
localPlayerView.subtitleView?.visibility = View.GONE
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
// Route through reactApplicationContext for new arch interop compatibility.
|
|
129
|
+
val hmssdkCollection = context.reactApplicationContext.getNativeModule(HMSManager::class.java)?.getHmsInstance()
|
|
128
130
|
hmssdkInstance = hmssdkCollection?.get("12345")?.hmsSDK
|
|
129
131
|
|
|
130
132
|
// creating 100ms HLS Player
|
|
@@ -99,7 +99,11 @@ class HMSSDKViewManager : SimpleViewManager<HMSView>() {
|
|
|
99
99
|
data?.let { view.updateAutoSimulcast(it) }
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
// Route through reactApplicationContext so the lookup works under both old arch and
|
|
103
|
+
// the New Architecture Interop Layer. ThemedReactContext.getNativeModule() is unreliable
|
|
104
|
+
// under interop / bridgeless; the application-level context has proper TurboModule routing.
|
|
105
|
+
private fun getHms(): MutableMap<String, HMSRNSDK>? =
|
|
106
|
+
reactContext?.reactApplicationContext?.getNativeModule(HMSManager::class.java)?.getHmsInstance()
|
|
103
107
|
|
|
104
108
|
companion object {
|
|
105
109
|
const val REACT_CLASS = "HMSView"
|
|
@@ -16,8 +16,7 @@ class HMSHLSPlayerManager: RCTViewManager {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
func getHmsFromBridge() -> [String: HMSRNSDK] {
|
|
19
|
-
|
|
20
|
-
return collection
|
|
19
|
+
return HMSManager.shared?.hmsCollection ?? [String: HMSRNSDK]()
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
override class func requiresMainQueueSetup() -> Bool {
|
package/ios/HMSManager.swift
CHANGED
|
@@ -4,6 +4,11 @@ import AVKit.AVRoutePickerView
|
|
|
4
4
|
@objc(HMSManager)
|
|
5
5
|
class HMSManager: RCTEventEmitter {
|
|
6
6
|
|
|
7
|
+
// Singleton holder used by HMSView / HMSHLSPlayerManager to access
|
|
8
|
+
// hmsCollection without going through `bridge.module(for:)`, which is
|
|
9
|
+
// unreliable under the New Architecture Interop Layer.
|
|
10
|
+
@objc static weak var shared: HMSManager?
|
|
11
|
+
|
|
7
12
|
var hmsCollection = [String: HMSRNSDK]()
|
|
8
13
|
|
|
9
14
|
let ON_PREVIEW = "ON_PREVIEW"
|
|
@@ -30,6 +35,7 @@ class HMSManager: RCTEventEmitter {
|
|
|
30
35
|
|
|
31
36
|
override init() {
|
|
32
37
|
super.init()
|
|
38
|
+
HMSManager.shared = self
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
override class func requiresMainQueueSetup() -> Bool {
|
package/ios/HMSView.swift
CHANGED
|
@@ -14,8 +14,7 @@ class HMSView: RCTViewManager {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
func getHmsFromBridge() -> [String: HMSRNSDK] {
|
|
17
|
-
|
|
18
|
-
return collection
|
|
17
|
+
return HMSManager.shared?.hmsCollection ?? [String: HMSRNSDK]()
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
override class func requiresMainQueueSetup() -> Bool {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@100mslive/react-native-hms",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "Integrate Real Time Audio and Video conferencing, Interactive Live Streaming, and Chat in your apps with 100ms React Native SDK. With support for HLS and RTMP Live Streaming and Recording, Picture-in-Picture (PiP), one-to-one Video Call Modes, Audio Rooms, Video Player and much more, add immersive real-time communications to your apps.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|