Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ class HMSHLSPlayerManager : SimpleViewManager<HMSHLSPlayer>() {
override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any>? {
super.getExportedCustomDirectEventTypeConstants()

return MapBuilder.of(
HMSHLSPlayerConstants.HMS_HLS_PLAYBACK_EVENT,
MapBuilder.of("registrationName", "onHmsHlsPlaybackEvent"),
HMSHLSPlayerConstants.HMS_HLS_STATS_EVENT,
MapBuilder.of("registrationName", "onHmsHlsStatsEvent"),
HMSHLSPlayerConstants.HLS_DATA_REQUEST_EVENT,
MapBuilder.of("registrationName", "onDataReturned"),
HMSHLSPlayerConstants.HLS_PLAYER_CUES_EVENT,
MapBuilder.of("registrationName", "onHlsPlayerCuesEvent"),
// MapBuilder returns a Java Map; wrap it into a MutableMap to satisfy RN 0.81 signature
return HashMap(
MapBuilder.of(
HMSHLSPlayerConstants.HMS_HLS_PLAYBACK_EVENT,
MapBuilder.of("registrationName", "onHmsHlsPlaybackEvent"),
HMSHLSPlayerConstants.HMS_HLS_STATS_EVENT,
MapBuilder.of("registrationName", "onHmsHlsStatsEvent"),
HMSHLSPlayerConstants.HLS_DATA_REQUEST_EVENT,
MapBuilder.of("registrationName", "onDataReturned"),
HMSHLSPlayerConstants.HLS_PLAYER_CUES_EVENT,
MapBuilder.of("registrationName", "onHlsPlayerCuesEvent"),
),
)
}

Expand Down Expand Up @@ -97,22 +100,24 @@ class HMSHLSPlayerManager : SimpleViewManager<HMSHLSPlayer>() {
}

override fun getCommandsMap(): MutableMap<String, Int>? =
MapBuilder
.builder<String, Int>()
.put("play", 10)
.put("stop", 20)
.put("pause", 30)
.put("resume", 40)
.put("seekToLivePosition", 50)
.put("seekForward", 60)
.put("seekBackward", 70)
.put("setVolume", 80)
.put("areClosedCaptionSupported", 90)
.put("isClosedCaptionEnabled", 100)
.put("enableClosedCaption", 110)
.put("disableClosedCaption", 120)
.put("getPlayerDurationDetails", 130)
.build()
HashMap(
MapBuilder
.builder<String, Int>()
.put("play", 10)
.put("stop", 20)
.put("pause", 30)
.put("resume", 40)
.put("seekToLivePosition", 50)
.put("seekForward", 60)
.put("seekBackward", 70)
.put("setVolume", 80)
.put("areClosedCaptionSupported", 90)
.put("isClosedCaptionEnabled", 100)
.put("enableClosedCaption", 110)
.put("disableClosedCaption", 120)
.put("getPlayerDurationDetails", 130)
.build(),
)

@ReactProp(name = "url")
fun setStreamURL(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class HMSManager(
reactAppContext = reactApplicationContext

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
currentActivity?.let {
reactApplicationContext.currentActivity?.let {
pipReceiver?.register(it)
}
}
Expand Down Expand Up @@ -438,7 +438,7 @@ class HMSManager(
data: ReadableMap,
callback: Promise?,
) {
currentActivity?.application?.registerActivityLifecycleCallbacks(this)
reactApplicationContext.currentActivity?.application?.registerActivityLifecycleCallbacks(this)
val hms = HMSHelper.getHms(data, hmsCollection)

hms?.startScreenshare(callback)
Expand All @@ -461,7 +461,7 @@ class HMSManager(
) {
val hms = HMSHelper.getHms(data, hmsCollection)

currentActivity?.application?.unregisterActivityLifecycleCallbacks(this)
reactApplicationContext.currentActivity?.application?.unregisterActivityLifecycleCallbacks(this)
hms?.stopScreenshare(callback)
}

Expand All @@ -470,7 +470,7 @@ class HMSManager(
data: ReadableMap,
callback: Promise?,
) {
currentActivity?.application?.registerActivityLifecycleCallbacks(this)
reactApplicationContext.currentActivity?.application?.registerActivityLifecycleCallbacks(this)
val hms = HMSHelper.getHms(data, hmsCollection)

hms?.startAudioshare(data, callback)
Expand All @@ -493,7 +493,7 @@ class HMSManager(
) {
val hms = HMSHelper.getHms(data, hmsCollection)

currentActivity?.application?.unregisterActivityLifecycleCallbacks(this)
reactApplicationContext.currentActivity?.application?.unregisterActivityLifecycleCallbacks(this)
hms?.stopAudioshare(callback)
}

Expand Down Expand Up @@ -784,7 +784,7 @@ class HMSManager(
return
}

val activity = currentActivity
val activity = reactApplicationContext.currentActivity

if (activity !== null) {
val hmssdk = getHmsInstance()[PipActionReceiver.sdkIdForPIP!!]?.hmsSDK
Expand Down Expand Up @@ -1085,7 +1085,7 @@ class HMSManager(
throw Throwable(message = "PIP Mode is not supported!")
}

val activity = currentActivity ?: return false
val activity = reactApplicationContext.currentActivity ?: return false
val pipParamConfig = readableMapToPipParamConfig(data) ?: return false
val pipParams = buildPipParams(pipParamConfig) ?: return false

Expand Down Expand Up @@ -1122,7 +1122,7 @@ class HMSManager(
throw Throwable(message = "PIP Mode is not supported!")
}

val activity = currentActivity ?: return false
val activity = reactApplicationContext.currentActivity ?: return false
val pipParamConfig = readableMapToPipParamConfig(data) ?: return false
val pipParams = buildPipParams(pipParamConfig) ?: return false

Expand Down Expand Up @@ -1713,7 +1713,7 @@ class HMSManager(
hmsCollection[key]?.leave(null)
}
}
currentActivity?.application?.unregisterActivityLifecycleCallbacks(this)
reactApplicationContext.currentActivity?.application?.unregisterActivityLifecycleCallbacks(this)
hmsCollection = mutableMapOf()
// unregistering pip actions on activity destroy.
if (pipReceiver !== null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@ class HMSSDKViewManager : SimpleViewManager<HMSView>() {
}

override fun getExportedCustomBubblingEventTypeConstants(): MutableMap<String, Any>? =
MapBuilder
.builder<String, Any>()
.put(
"topChange",
MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", "onChange")),
).build()
HashMap(
MapBuilder
.builder<String, Any>()
.put(
"topChange",
MapBuilder.of("phasedRegistrationNames", MapBuilder.of("bubbled", "onChange")),
).build(),
)

override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any>? =
MapBuilder.of(
"captureFrame",
MapBuilder.of("registrationName", "onDataReturned"),
HashMap(
MapBuilder.of(
"captureFrame",
MapBuilder.of("registrationName", "onDataReturned"),
),
)

@RequiresApi(Build.VERSION_CODES.N)
Expand Down