@100mslive/react-native-hms 0.8.3 → 0.9.1
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 +16 -8
- package/android/.gradle/6.9/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.idea/gradle.xml +13 -0
- package/android/.idea/misc.xml +9 -0
- package/android/.idea/modules/android.iml +18 -0
- package/android/.idea/modules.xml +8 -0
- package/android/.idea/sonarlint/issuestore/f/0/f07866736216be0ee2aba49e392191aeae700a35 +0 -0
- package/android/.idea/sonarlint/issuestore/index.pb +3 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +4 -2
- package/android/local.properties +8 -0
- package/android/src/main/java/com/reactnativehmssdk/HmsDecoder.kt +58 -5
- package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +76 -61
- package/android/src/main/java/com/reactnativehmssdk/HmsModule.kt +99 -8
- package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +299 -128
- package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +66 -0
- package/android/src/main/java/com/reactnativehmssdk/HmsView.kt +28 -3
- package/android/src/main/java/com/reactnativehmssdk/HmssdkViewManager.kt +10 -1
- package/android/src/main/res/layout/hms_view.xml +19 -0
- package/ios/HmsDecoder.swift +217 -123
- package/ios/HmsHelper.swift +56 -38
- package/ios/HmsManager.m +11 -3
- package/ios/HmsManager.swift +125 -68
- package/ios/HmsSDK.swift +407 -189
- package/ios/HmsView.swift +50 -68
- package/ios/VideoCollectionViewCell.swift +4 -4
- package/lib/commonjs/classes/HMSBrowserRecordingState.js +6 -0
- package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
- package/lib/commonjs/classes/HMSChangeTrackStateRequest.js +3 -0
- package/lib/commonjs/classes/HMSChangeTrackStateRequest.js.map +1 -1
- package/lib/commonjs/classes/HMSEncoder.js +166 -4
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSConfig.js +20 -0
- package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -0
- package/lib/commonjs/classes/HMSHLSMeetingURLVariant.js +23 -0
- package/lib/commonjs/classes/HMSHLSMeetingURLVariant.js.map +1 -0
- package/lib/commonjs/classes/HMSHLSStreamingState.js +23 -0
- package/lib/commonjs/classes/HMSHLSStreamingState.js.map +1 -0
- package/lib/commonjs/classes/HMSHLSVariant.js +29 -0
- package/lib/commonjs/classes/HMSHLSVariant.js.map +1 -0
- package/lib/commonjs/classes/HMSLocalAudioStats.js +26 -0
- package/lib/commonjs/classes/HMSLocalAudioStats.js.map +1 -0
- package/lib/commonjs/classes/HMSLocalVideoStats.js +32 -0
- package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -0
- package/lib/commonjs/classes/HMSLogger.js +27 -0
- package/lib/commonjs/classes/HMSLogger.js.map +1 -1
- package/lib/commonjs/classes/HMSPeerUpdate.js +2 -0
- package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSPermissions.js +2 -2
- package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
- package/lib/commonjs/classes/HMSRTCStats.js +38 -0
- package/lib/commonjs/classes/HMSRTCStats.js.map +1 -0
- package/lib/commonjs/classes/HMSRTCStatsReport.js +26 -0
- package/lib/commonjs/classes/HMSRTCStatsReport.js.map +1 -0
- package/lib/commonjs/classes/HMSRemoteAudioStats.js +32 -0
- package/lib/commonjs/classes/HMSRemoteAudioStats.js.map +1 -0
- package/lib/commonjs/classes/HMSRemoteVideoStats.js +38 -0
- package/lib/commonjs/classes/HMSRemoteVideoStats.js.map +1 -0
- package/lib/commonjs/classes/HMSRoom.js +6 -0
- package/lib/commonjs/classes/HMSRoom.js.map +1 -1
- package/lib/commonjs/classes/HMSRoomUpdate.js +7 -0
- package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSRtmpStreamingState.js +6 -0
- package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +476 -115
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSServerRecordingState.js +3 -0
- package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
- package/lib/commonjs/classes/HMSUpdateListenerActions.js +5 -0
- package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HmsView.js +26 -4
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/index.js +140 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/classes/HMSBrowserRecordingState.js +6 -0
- package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
- package/lib/module/classes/HMSChangeTrackStateRequest.js +3 -0
- package/lib/module/classes/HMSChangeTrackStateRequest.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +159 -4
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSHLSConfig.js +11 -0
- package/lib/module/classes/HMSHLSConfig.js.map +1 -0
- package/lib/module/classes/HMSHLSMeetingURLVariant.js +14 -0
- package/lib/module/classes/HMSHLSMeetingURLVariant.js.map +1 -0
- package/lib/module/classes/HMSHLSStreamingState.js +14 -0
- package/lib/module/classes/HMSHLSStreamingState.js.map +1 -0
- package/lib/module/classes/HMSHLSVariant.js +20 -0
- package/lib/module/classes/HMSHLSVariant.js.map +1 -0
- package/lib/module/classes/HMSLocalAudioStats.js +17 -0
- package/lib/module/classes/HMSLocalAudioStats.js.map +1 -0
- package/lib/module/classes/HMSLocalVideoStats.js +23 -0
- package/lib/module/classes/HMSLocalVideoStats.js.map +1 -0
- package/lib/module/classes/HMSLogger.js +27 -0
- package/lib/module/classes/HMSLogger.js.map +1 -1
- package/lib/module/classes/HMSPeerUpdate.js +2 -0
- package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/module/classes/HMSPermissions.js +2 -2
- package/lib/module/classes/HMSPermissions.js.map +1 -1
- package/lib/module/classes/HMSRTCStats.js +29 -0
- package/lib/module/classes/HMSRTCStats.js.map +1 -0
- package/lib/module/classes/HMSRTCStatsReport.js +17 -0
- package/lib/module/classes/HMSRTCStatsReport.js.map +1 -0
- package/lib/module/classes/HMSRemoteAudioStats.js +23 -0
- package/lib/module/classes/HMSRemoteAudioStats.js.map +1 -0
- package/lib/module/classes/HMSRemoteVideoStats.js +29 -0
- package/lib/module/classes/HMSRemoteVideoStats.js.map +1 -0
- package/lib/module/classes/HMSRoom.js +6 -0
- package/lib/module/classes/HMSRoom.js.map +1 -1
- package/lib/module/classes/HMSRoomUpdate.js +7 -0
- package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
- package/lib/module/classes/HMSRtmpStreamingState.js +6 -0
- package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +464 -116
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSServerRecordingState.js +3 -0
- package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
- package/lib/module/classes/HMSUpdateListenerActions.js +5 -0
- package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/module/classes/HmsView.js +23 -4
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +4 -0
- package/lib/typescript/classes/HMSChangeTrackStateRequest.d.ts +2 -0
- package/lib/typescript/classes/HMSEncoder.d.ts +21 -0
- package/lib/typescript/classes/HMSHLSConfig.d.ts +7 -0
- package/lib/typescript/classes/HMSHLSMeetingURLVariant.d.ts +8 -0
- package/lib/typescript/classes/HMSHLSStreamingState.d.ts +9 -0
- package/lib/typescript/classes/HMSHLSVariant.d.ts +12 -0
- package/lib/typescript/classes/HMSLocalAudioStats.d.ts +10 -0
- package/lib/typescript/classes/HMSLocalVideoStats.d.ts +15 -0
- package/lib/typescript/classes/HMSLogger.d.ts +2 -0
- package/lib/typescript/classes/HMSPeerUpdate.d.ts +3 -1
- package/lib/typescript/classes/HMSPermissions.d.ts +2 -2
- package/lib/typescript/classes/HMSRTCStats.d.ts +18 -0
- package/lib/typescript/classes/HMSRTCStatsReport.d.ts +11 -0
- package/lib/typescript/classes/HMSRemoteAudioStats.d.ts +14 -0
- package/lib/typescript/classes/HMSRemoteVideoStats.d.ts +19 -0
- package/lib/typescript/classes/HMSRoom.d.ts +5 -0
- package/lib/typescript/classes/HMSRoomUpdate.d.ts +8 -1
- package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +4 -0
- package/lib/typescript/classes/HMSSDK.d.ts +33 -9
- package/lib/typescript/classes/HMSServerRecordingState.d.ts +2 -0
- package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +6 -1
- package/lib/typescript/index.d.ts +10 -0
- package/package.json +1 -1
- package/react-native-hms.podspec +1 -1
- package/src/classes/HMSBrowserRecordingState.ts +10 -1
- package/src/classes/HMSChangeTrackStateRequest.ts +7 -1
- package/src/classes/HMSEncoder.ts +163 -3
- package/src/classes/HMSHLSConfig.ts +9 -0
- package/src/classes/HMSHLSMeetingURLVariant.ts +9 -0
- package/src/classes/HMSHLSStreamingState.ts +11 -0
- package/src/classes/HMSHLSVariant.ts +18 -0
- package/src/classes/HMSLocalAudioStats.ts +15 -0
- package/src/classes/HMSLocalVideoStats.ts +23 -0
- package/src/classes/HMSLogger.ts +14 -0
- package/src/classes/HMSPeerUpdate.ts +2 -0
- package/src/classes/HMSPermissions.ts +3 -3
- package/src/classes/HMSRTCStats.ts +27 -0
- package/src/classes/HMSRTCStatsReport.ts +17 -0
- package/src/classes/HMSRemoteAudioStats.ts +21 -0
- package/src/classes/HMSRemoteVideoStats.ts +29 -0
- package/src/classes/HMSRoom.ts +7 -0
- package/src/classes/HMSRoomUpdate.ts +7 -0
- package/src/classes/HMSRtmpStreamingState.ts +10 -1
- package/src/classes/HMSSDK.tsx +325 -26
- package/src/classes/HMSServerRecordingState.ts +7 -1
- package/src/classes/HMSUpdateListenerActions.ts +5 -0
- package/src/classes/HmsView.tsx +32 -4
- package/src/index.ts +10 -0
- package/android/.gradle/6.9/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.9/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/6.9/javaCompile/classAnalysis.bin +0 -0
- package/android/.gradle/6.9/javaCompile/jarAnalysis.bin +0 -0
- package/android/.gradle/6.9/javaCompile/javaCompile.lock +0 -0
- package/android/.gradle/6.9/javaCompile/taskHistory.bin +0 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.project +0 -34
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
[](https://100ms.live/discord)
|
|
15
15
|
[](https://appdistribution.firebase.dev/i/7b7ab3b30e627c35)
|
|
16
16
|
[](https://testflight.apple.com/join/v4bSIPad)
|
|
17
|
+
[](https://github.com/100mslive/react-native-hms/projects/1)
|
|
17
18
|
[](https://dashboard.100ms.live/register)
|
|
18
19
|
|
|
19
20
|
React native wrapper for 100ms SDK
|
|
@@ -22,8 +23,6 @@ React native wrapper for 100ms SDK
|
|
|
22
23
|
|
|
23
24
|
```bash
|
|
24
25
|
npm install @100mslive/react-native-hms --save
|
|
25
|
-
|
|
26
|
-
cd ios/ && pod install
|
|
27
26
|
```
|
|
28
27
|
|
|
29
28
|
📲 Download the Sample iOS App here: https://testflight.apple.com/join/v4bSIPad
|
|
@@ -124,7 +123,7 @@ To display a video on screen the package provide a UI component named HmsView th
|
|
|
124
123
|
...
|
|
125
124
|
import { HMSRemotePeer } from '@100mslive/react-native-hms';
|
|
126
125
|
|
|
127
|
-
// getting local track ID
|
|
126
|
+
// getting local track ID
|
|
128
127
|
const localTrackId: string = hmsInstance?.localPeer?.videoTrack?.trackId;
|
|
129
128
|
|
|
130
129
|
// getting remote track IDs
|
|
@@ -185,17 +184,17 @@ await hmsInstance?.leave();
|
|
|
185
184
|
# Sending messages
|
|
186
185
|
|
|
187
186
|
```js
|
|
188
|
-
import { HMSRole } from '@100mslive/react-native-hms';
|
|
187
|
+
import { HMSRole, HMSPeer } from '@100mslive/react-native-hms';
|
|
189
188
|
|
|
190
189
|
const message = 'hello'
|
|
191
190
|
const roles: HMSRole[] = hmsInstance?.knownRoles
|
|
192
|
-
//
|
|
193
|
-
const
|
|
191
|
+
// any remote peer
|
|
192
|
+
const peer: HMSPeer = hmsInstance?.remotePeers[0]
|
|
194
193
|
|
|
195
194
|
// send a different type of messages
|
|
196
195
|
hmsInstance?.sendBroadcastMessage(message);
|
|
197
196
|
hmsInstance?.sendGroupMessage(message, [role[0]);
|
|
198
|
-
hmsInstance?.sendDirectMessage(message,
|
|
197
|
+
hmsInstance?.sendDirectMessage(message, peer);
|
|
199
198
|
```
|
|
200
199
|
|
|
201
200
|
# Error handling
|
|
@@ -203,6 +202,15 @@ hmsInstance?.sendDirectMessage(message, peerId);
|
|
|
203
202
|
```js
|
|
204
203
|
import { HMSUpdateListenerActions } from '@100mslive/react-native-hms';
|
|
205
204
|
|
|
206
|
-
// add an error event listener
|
|
205
|
+
// add an error event listener
|
|
207
206
|
hmsInstance.addEventListener(HMSUpdateListenerActions.ON_ERROR, onError);
|
|
208
207
|
```
|
|
208
|
+
|
|
209
|
+
# Run Example App
|
|
210
|
+
To run the example app on your system, follow these steps -
|
|
211
|
+
1. In the project root, run `npm install`
|
|
212
|
+
2. Go to the example folder, `cd example`
|
|
213
|
+
3. In the example folder, run `npm install`
|
|
214
|
+
4. To run on Android, run `npx react-native run-android`
|
|
215
|
+
5. To run on iOS, first install the pods in iOS folder, `cd ios; pod install`. Then, in example folder, run `npx react-native run-ios`
|
|
216
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Thu Jan 06 21:33:45 IST 2022
|
|
2
2
|
gradle.version=6.9
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="GradleSettings">
|
|
4
|
+
<option name="linkedExternalProjectsSettings">
|
|
5
|
+
<GradleProjectSettings>
|
|
6
|
+
<option name="testRunner" value="GRADLE" />
|
|
7
|
+
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
8
|
+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
9
|
+
<option name="resolveModulePerSourceSet" value="false" />
|
|
10
|
+
</GradleProjectSettings>
|
|
11
|
+
</option>
|
|
12
|
+
</component>
|
|
13
|
+
</project>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="11" project-jdk-type="JavaSDK">
|
|
4
|
+
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectType">
|
|
7
|
+
<option name="id" value="Android" />
|
|
8
|
+
</component>
|
|
9
|
+
</project>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module external.linked.project.id=":" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="FacetManager">
|
|
4
|
+
<facet type="android-gradle" name="Android-Gradle">
|
|
5
|
+
<configuration>
|
|
6
|
+
<option name="GRADLE_PROJECT_PATH" value=":" />
|
|
7
|
+
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
|
|
8
|
+
<option name="LAST_KNOWN_AGP_VERSION" />
|
|
9
|
+
</configuration>
|
|
10
|
+
</facet>
|
|
11
|
+
</component>
|
|
12
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
13
|
+
<exclude-output />
|
|
14
|
+
<content url="file://$MODULE_DIR$/../.." />
|
|
15
|
+
<orderEntry type="inheritedJdk" />
|
|
16
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
17
|
+
</component>
|
|
18
|
+
</module>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/modules/android.iml" filepath="$PROJECT_DIR$/.idea/modules/android.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
File without changes
|
package/android/build.gradle
CHANGED
|
@@ -26,7 +26,7 @@ def safeExtGet(prop, fallback) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
android {
|
|
29
|
-
compileSdkVersion safeExtGet('Hmssdk_compileSdkVersion',
|
|
29
|
+
compileSdkVersion safeExtGet('Hmssdk_compileSdkVersion', 30)
|
|
30
30
|
defaultConfig {
|
|
31
31
|
minSdkVersion safeExtGet('Hmssdk_minSdkVersion', 21)
|
|
32
32
|
targetSdkVersion safeExtGet('Hmssdk_targetSdkVersion', 29)
|
|
@@ -63,6 +63,8 @@ dependencies {
|
|
|
63
63
|
//noinspection GradleDynamicVersion
|
|
64
64
|
implementation "com.facebook.react:react-native:+"
|
|
65
65
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" // From node_modules
|
|
66
|
-
implementation 'com.github.100mslive
|
|
66
|
+
implementation 'com.github.100mslive.android-sdk:lib:2.3.1'
|
|
67
67
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
|
|
68
|
+
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
|
|
69
|
+
implementation 'androidx.appcompat:appcompat:1.3.1'
|
|
68
70
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
+
# as it contains information specific to your local configuration.
|
|
3
|
+
#
|
|
4
|
+
# Location of the SDK. This is only used by Gradle.
|
|
5
|
+
# For customization when using a Version Control System, please read the
|
|
6
|
+
# header note.
|
|
7
|
+
#Tue Mar 01 18:12:03 IST 2022
|
|
8
|
+
sdk.dir=/Users/yogesh/Library/Android/sdk
|
|
@@ -31,8 +31,10 @@ object HmsDecoder {
|
|
|
31
31
|
"serverRecordingState",
|
|
32
32
|
this.getHMSServerRecordingState(hmsRoom.serverRecordingState)
|
|
33
33
|
)
|
|
34
|
+
room.putMap("hlsStreamingState", this.getHMSHlsStreamingState(hmsRoom.hlsStreamingState))
|
|
34
35
|
room.putMap("localPeer", this.getHmsLocalPeer(hmsRoom.localPeer))
|
|
35
36
|
room.putArray("peers", this.getAllPeers(hmsRoom.peerList))
|
|
37
|
+
room.putInt("peerCount", hmsRoom.peerCount)
|
|
36
38
|
}
|
|
37
39
|
return room
|
|
38
40
|
}
|
|
@@ -122,7 +124,7 @@ object HmsDecoder {
|
|
|
122
124
|
permissions.putBoolean("changeRoleForce", hmsPermissions.changeRoleForce)
|
|
123
125
|
permissions.putBoolean("unmute", hmsPermissions.unmute)
|
|
124
126
|
permissions.putBoolean("recording", hmsPermissions.recording)
|
|
125
|
-
permissions.putBoolean("
|
|
127
|
+
permissions.putBoolean("streaming", hmsPermissions.streaming)
|
|
126
128
|
permissions.putBoolean("changeRole", hmsPermissions.changeRole)
|
|
127
129
|
}
|
|
128
130
|
return permissions
|
|
@@ -153,7 +155,7 @@ object HmsDecoder {
|
|
|
153
155
|
|
|
154
156
|
private fun getHmsAudioSettings(hmsAudioSettings: AudioParams?): WritableMap {
|
|
155
157
|
val audioSettings: WritableMap = Arguments.createMap()
|
|
156
|
-
if (hmsAudioSettings != null) {
|
|
158
|
+
if (hmsAudioSettings != null && hmsAudioSettings.codec != null) {
|
|
157
159
|
audioSettings.putInt("bitRate", hmsAudioSettings.bitRate)
|
|
158
160
|
audioSettings.putString("codec", hmsAudioSettings.codec.name)
|
|
159
161
|
}
|
|
@@ -162,7 +164,7 @@ object HmsDecoder {
|
|
|
162
164
|
|
|
163
165
|
private fun getHmsVideoSettings(hmsVideoSettings: VideoParams?): WritableMap {
|
|
164
166
|
val videoSettings: WritableMap = Arguments.createMap()
|
|
165
|
-
if (hmsVideoSettings != null) {
|
|
167
|
+
if (hmsVideoSettings != null && hmsVideoSettings.codec != null) {
|
|
166
168
|
videoSettings.putInt("bitRate", hmsVideoSettings.bitRate)
|
|
167
169
|
videoSettings.putInt("frameRate", hmsVideoSettings.frameRate)
|
|
168
170
|
videoSettings.putInt("width", hmsVideoSettings.width)
|
|
@@ -342,6 +344,7 @@ object HmsDecoder {
|
|
|
342
344
|
|
|
343
345
|
changeTrackStateRequest.putMap("requestedBy", this.getHmsPeer(request.requestedBy))
|
|
344
346
|
changeTrackStateRequest.putString("trackType", request.track.type.name)
|
|
347
|
+
changeTrackStateRequest.putBoolean("mute", request.mute)
|
|
345
348
|
changeTrackStateRequest.putString("id", id)
|
|
346
349
|
|
|
347
350
|
return changeTrackStateRequest
|
|
@@ -360,11 +363,34 @@ object HmsDecoder {
|
|
|
360
363
|
return decodedError
|
|
361
364
|
}
|
|
362
365
|
|
|
366
|
+
private fun getCustomError(message: String?, code: Int?): WritableMap {
|
|
367
|
+
val decodedError: WritableMap = Arguments.createMap()
|
|
368
|
+
var customCode = 101
|
|
369
|
+
var customMessage = "SOMETHING WENT WRONG"
|
|
370
|
+
if (code !== null) {
|
|
371
|
+
customCode = code.toInt()
|
|
372
|
+
}
|
|
373
|
+
if (message !== null) {
|
|
374
|
+
customMessage = message
|
|
375
|
+
}
|
|
376
|
+
decodedError.putInt("code", customCode)
|
|
377
|
+
decodedError.putString("localizedDescription", customMessage)
|
|
378
|
+
decodedError.putString("description", customMessage)
|
|
379
|
+
decodedError.putString("message", customMessage)
|
|
380
|
+
decodedError.putInt("name", customCode)
|
|
381
|
+
decodedError.putInt("action", customCode)
|
|
382
|
+
|
|
383
|
+
return decodedError
|
|
384
|
+
}
|
|
385
|
+
|
|
363
386
|
private fun getHMSBrowserRecordingState(data: HMSBrowserRecordingState?): ReadableMap {
|
|
364
387
|
val input = Arguments.createMap()
|
|
365
388
|
if (data !== null) {
|
|
366
389
|
input.putBoolean("running", data.running)
|
|
367
|
-
input.
|
|
390
|
+
input.putString("startedAt", data.startedAt.toString())
|
|
391
|
+
input.putString("stoppedAt", data.stoppedAt.toString())
|
|
392
|
+
input.putBoolean("running", data.running)
|
|
393
|
+
input.putMap("error", this.getCustomError(data.error?.message, data.error?.code))
|
|
368
394
|
}
|
|
369
395
|
return input
|
|
370
396
|
}
|
|
@@ -373,7 +399,9 @@ object HmsDecoder {
|
|
|
373
399
|
val input = Arguments.createMap()
|
|
374
400
|
if (data !== null) {
|
|
375
401
|
input.putBoolean("running", data.running)
|
|
376
|
-
input.
|
|
402
|
+
input.putString("startedAt", data.startedAt.toString())
|
|
403
|
+
input.putString("stoppedAt", data.stoppedAt.toString())
|
|
404
|
+
input.putMap("error", this.getCustomError(data.error?.message, data.error?.code))
|
|
377
405
|
}
|
|
378
406
|
return input
|
|
379
407
|
}
|
|
@@ -382,11 +410,36 @@ object HmsDecoder {
|
|
|
382
410
|
val input = Arguments.createMap()
|
|
383
411
|
if (data !== null) {
|
|
384
412
|
input.putBoolean("running", data.running)
|
|
413
|
+
input.putString("startedAt", data.startedAt.toString())
|
|
385
414
|
input.putMap("error", data.error?.let { this.getError(it) })
|
|
386
415
|
}
|
|
387
416
|
return input
|
|
388
417
|
}
|
|
389
418
|
|
|
419
|
+
private fun getHMSHlsStreamingState(data: HMSHLSStreamingState?): ReadableMap {
|
|
420
|
+
val input = Arguments.createMap()
|
|
421
|
+
if (data !== null) {
|
|
422
|
+
input.putBoolean("running", data.running)
|
|
423
|
+
input.putArray("variants", this.getHMSHLSVariant(data.variants))
|
|
424
|
+
}
|
|
425
|
+
return input
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
private fun getHMSHLSVariant(data: ArrayList<HMSHLSVariant>?): ReadableArray {
|
|
429
|
+
val variants = Arguments.createArray()
|
|
430
|
+
if (data !== null) {
|
|
431
|
+
for (variant in data) {
|
|
432
|
+
val input = Arguments.createMap()
|
|
433
|
+
input.putString("hlsStreamUrl", variant.hlsStreamUrl)
|
|
434
|
+
input.putString("meetingUrl", variant.meetingUrl)
|
|
435
|
+
input.putString("metadata", variant.metadata)
|
|
436
|
+
input.putString("startedAt", variant.startedAt.toString())
|
|
437
|
+
variants.pushMap(input)
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return variants
|
|
441
|
+
}
|
|
442
|
+
|
|
390
443
|
private fun getHmsSubscribeSettings(hmsSubscribeSettings: SubscribeParams?): WritableMap {
|
|
391
444
|
val subscribeSettings: WritableMap = Arguments.createMap()
|
|
392
445
|
if (hmsSubscribeSettings != null) {
|
|
@@ -5,11 +5,13 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
5
5
|
import live.hms.video.media.codec.HMSAudioCodec
|
|
6
6
|
import live.hms.video.media.codec.HMSVideoCodec
|
|
7
7
|
import live.hms.video.media.settings.HMSAudioTrackSettings
|
|
8
|
+
import live.hms.video.media.settings.HMSTrackSettings
|
|
8
9
|
import live.hms.video.media.settings.HMSVideoResolution
|
|
9
10
|
import live.hms.video.media.settings.HMSVideoTrackSettings
|
|
10
11
|
import live.hms.video.media.tracks.*
|
|
11
12
|
import live.hms.video.sdk.models.*
|
|
12
13
|
import live.hms.video.sdk.models.role.*
|
|
14
|
+
import live.hms.video.utils.HmsUtilities
|
|
13
15
|
|
|
14
16
|
object HmsHelper {
|
|
15
17
|
|
|
@@ -46,24 +48,16 @@ object HmsHelper {
|
|
|
46
48
|
return true
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
fun getPeerFromPeerId(peerId: String?,
|
|
50
|
-
if (peerId != null &&
|
|
51
|
-
|
|
52
|
-
if (peerId == peer.peerID) {
|
|
53
|
-
return peer
|
|
54
|
-
}
|
|
55
|
-
}
|
|
51
|
+
fun getPeerFromPeerId(peerId: String?, room: HMSRoom?): HMSPeer? {
|
|
52
|
+
if (peerId != null && room != null) {
|
|
53
|
+
return HmsUtilities.getPeer(peerId, room)
|
|
56
54
|
}
|
|
57
55
|
return null
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
fun getRemotePeerFromPeerId(peerId: String?,
|
|
61
|
-
if (peerId != null &&
|
|
62
|
-
|
|
63
|
-
if (peerId == peer.peerID) {
|
|
64
|
-
return peer
|
|
65
|
-
}
|
|
66
|
-
}
|
|
58
|
+
fun getRemotePeerFromPeerId(peerId: String?, room: HMSRoom?): HMSRemotePeer? {
|
|
59
|
+
if (peerId != null && room != null) {
|
|
60
|
+
return HmsUtilities.getPeer(peerId, room) as? HMSRemotePeer
|
|
67
61
|
}
|
|
68
62
|
return null
|
|
69
63
|
}
|
|
@@ -97,69 +91,65 @@ object HmsHelper {
|
|
|
97
91
|
return null
|
|
98
92
|
}
|
|
99
93
|
|
|
100
|
-
fun getRemoteAudioTrackFromTrackId(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
): HMSRemoteAudioTrack? {
|
|
104
|
-
if (trackId != null && remotePeers != null) {
|
|
105
|
-
for (remotePeer in remotePeers) {
|
|
106
|
-
if (remotePeer.audioTrack?.trackId == trackId) {
|
|
107
|
-
return remotePeer.audioTrack as HMSRemoteAudioTrack
|
|
108
|
-
}
|
|
109
|
-
}
|
|
94
|
+
fun getRemoteAudioTrackFromTrackId(trackId: String?, room: HMSRoom?): HMSRemoteAudioTrack? {
|
|
95
|
+
if (trackId != null && room != null) {
|
|
96
|
+
return HmsUtilities.getAudioTrack(trackId, room) as? HMSRemoteAudioTrack
|
|
110
97
|
}
|
|
111
98
|
return null
|
|
112
99
|
}
|
|
113
100
|
|
|
114
|
-
fun getRemoteVideoTrackFromTrackId(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
): HMSRemoteVideoTrack? {
|
|
118
|
-
if (trackId != null && remotePeers != null) {
|
|
119
|
-
for (remotePeer in remotePeers) {
|
|
120
|
-
if (remotePeer.videoTrack?.trackId == trackId) {
|
|
121
|
-
return remotePeer.videoTrack as HMSRemoteVideoTrack
|
|
122
|
-
}
|
|
123
|
-
}
|
|
101
|
+
fun getRemoteVideoTrackFromTrackId(trackId: String?, room: HMSRoom?): HMSRemoteVideoTrack? {
|
|
102
|
+
if (trackId != null && room != null) {
|
|
103
|
+
return HmsUtilities.getVideoTrack(trackId, room) as? HMSRemoteVideoTrack
|
|
124
104
|
}
|
|
125
105
|
return null
|
|
126
106
|
}
|
|
127
107
|
|
|
128
|
-
fun getTrackFromTrackId(trackId: String?,
|
|
129
|
-
if (trackId != null &&
|
|
130
|
-
|
|
131
|
-
if (remotePeer.audioTrack?.trackId == trackId) {
|
|
132
|
-
return remotePeer.audioTrack as HMSTrack
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (remotePeer.videoTrack?.trackId == trackId) {
|
|
136
|
-
return remotePeer.videoTrack as HMSTrack
|
|
137
|
-
}
|
|
138
|
-
}
|
|
108
|
+
fun getTrackFromTrackId(trackId: String?, room: HMSRoom?): HMSTrack? {
|
|
109
|
+
if (trackId != null && room != null) {
|
|
110
|
+
HmsUtilities.getTrack(trackId, room)
|
|
139
111
|
}
|
|
140
112
|
return null
|
|
141
113
|
}
|
|
142
114
|
|
|
143
|
-
fun
|
|
144
|
-
if (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
115
|
+
fun getTrackSettings(data: ReadableMap?): HMSTrackSettings? {
|
|
116
|
+
if (data == null) {
|
|
117
|
+
return null
|
|
118
|
+
}
|
|
148
119
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
120
|
+
var useHardwareEchoCancellation = false
|
|
121
|
+
val requiredKeysUseHardwareEchoCancellation =
|
|
122
|
+
this.areAllRequiredKeysAvailable(
|
|
123
|
+
data,
|
|
124
|
+
arrayOf(Pair("useHardwareEchoCancellation", "Boolean"))
|
|
125
|
+
)
|
|
126
|
+
if (requiredKeysUseHardwareEchoCancellation) {
|
|
127
|
+
useHardwareEchoCancellation = data.getBoolean("useHardwareEchoCancellation")
|
|
128
|
+
}
|
|
152
129
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
130
|
+
var video: ReadableMap? = null
|
|
131
|
+
val requiredKeysVideo = this.areAllRequiredKeysAvailable(data, arrayOf(Pair("video", "Map")))
|
|
132
|
+
if (requiredKeysVideo) {
|
|
133
|
+
video = data.getMap("video")
|
|
158
134
|
}
|
|
159
|
-
|
|
135
|
+
|
|
136
|
+
var audio: ReadableMap? = null
|
|
137
|
+
val requiredKeysAudio = this.areAllRequiredKeysAvailable(data, arrayOf(Pair("audio", "Map")))
|
|
138
|
+
if (requiredKeysAudio) {
|
|
139
|
+
audio = data.getMap("audio")
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (video == null && audio == null && !useHardwareEchoCancellation) {
|
|
143
|
+
return null
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
val videoSettings = this.getVideoTrackSettings(video)
|
|
147
|
+
val audioSettings = this.getAudioTrackSettings(audio, useHardwareEchoCancellation)
|
|
148
|
+
val trackSettingsBuilder = HMSTrackSettings.Builder()
|
|
149
|
+
return trackSettingsBuilder.audio(audioSettings).video(videoSettings).build()
|
|
160
150
|
}
|
|
161
151
|
|
|
162
|
-
fun getAudioTrackSettings(
|
|
152
|
+
private fun getAudioTrackSettings(
|
|
163
153
|
data: ReadableMap?,
|
|
164
154
|
useHardwareEchoCancellation: Boolean
|
|
165
155
|
): HMSAudioTrackSettings {
|
|
@@ -180,7 +170,7 @@ object HmsHelper {
|
|
|
180
170
|
|
|
181
171
|
// TODO: find out a way to set settings required to create HMSVideoTrackSettings
|
|
182
172
|
|
|
183
|
-
fun getVideoTrackSettings(data: ReadableMap?): HMSVideoTrackSettings {
|
|
173
|
+
private fun getVideoTrackSettings(data: ReadableMap?): HMSVideoTrackSettings {
|
|
184
174
|
val builder = HMSVideoTrackSettings.Builder()
|
|
185
175
|
if (data != null) {
|
|
186
176
|
val codec = getVideoCodec(data.getString("codec"))
|
|
@@ -266,4 +256,29 @@ object HmsHelper {
|
|
|
266
256
|
}
|
|
267
257
|
return rtmpURLs
|
|
268
258
|
}
|
|
259
|
+
|
|
260
|
+
fun getHMSHLSMeetingURLVariants(
|
|
261
|
+
hmsMeetingURLVariants: ArrayList<HashMap<String, String>>?
|
|
262
|
+
): List<HMSHLSMeetingURLVariant> {
|
|
263
|
+
val meetingURLVariants = mutableListOf<HMSHLSMeetingURLVariant>()
|
|
264
|
+
if (hmsMeetingURLVariants !== null) {
|
|
265
|
+
for (variant in hmsMeetingURLVariants) {
|
|
266
|
+
val meetingURLVariant = this.getHMSHLSMeetingURLVariant(variant)
|
|
267
|
+
meetingURLVariants.add(meetingURLVariant)
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return meetingURLVariants
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
private fun getHMSHLSMeetingURLVariant(
|
|
274
|
+
hmsMeetingURLVariant: HashMap<String, String>?
|
|
275
|
+
): HMSHLSMeetingURLVariant {
|
|
276
|
+
var meetingURLVariant = HMSHLSMeetingURLVariant("", "")
|
|
277
|
+
if (hmsMeetingURLVariant !== null) {
|
|
278
|
+
val meetingUrl = hmsMeetingURLVariant["meetingUrl"] as String
|
|
279
|
+
val metadata = hmsMeetingURLVariant["metadata"] as String
|
|
280
|
+
meetingURLVariant = HMSHLSMeetingURLVariant(meetingUrl, metadata)
|
|
281
|
+
}
|
|
282
|
+
return meetingURLVariant
|
|
283
|
+
}
|
|
269
284
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
package com.reactnativehmssdk
|
|
2
2
|
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.app.Application
|
|
5
|
+
import android.os.Bundle
|
|
3
6
|
import com.facebook.react.bridge.*
|
|
4
7
|
import com.facebook.react.module.annotations.ReactModule
|
|
5
8
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
@@ -7,11 +10,12 @@ import com.reactnativehmssdk.HmsModule.Companion.REACT_CLASS
|
|
|
7
10
|
import java.util.UUID
|
|
8
11
|
|
|
9
12
|
@ReactModule(name = REACT_CLASS)
|
|
10
|
-
class HmsModule(reactContext: ReactApplicationContext) :
|
|
13
|
+
class HmsModule(reactContext: ReactApplicationContext) :
|
|
14
|
+
ReactContextBaseJavaModule(reactContext), Application.ActivityLifecycleCallbacks {
|
|
11
15
|
companion object {
|
|
12
16
|
const val REACT_CLASS = "HmsManager"
|
|
17
|
+
var hmsCollection = mutableMapOf<String, HmsSDK>()
|
|
13
18
|
}
|
|
14
|
-
private var hmsCollection = mutableMapOf<String, HmsSDK>()
|
|
15
19
|
override fun getName(): String {
|
|
16
20
|
return "HmsManager"
|
|
17
21
|
}
|
|
@@ -121,10 +125,10 @@ class HmsModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMod
|
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
@ReactMethod
|
|
124
|
-
fun
|
|
128
|
+
fun changeTrackStateForRoles(data: ReadableMap, callback: Promise?) {
|
|
125
129
|
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
126
130
|
|
|
127
|
-
hms?.
|
|
131
|
+
hms?.changeTrackStateForRoles(data, callback)
|
|
128
132
|
}
|
|
129
133
|
|
|
130
134
|
@ReactMethod
|
|
@@ -170,10 +174,10 @@ class HmsModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMod
|
|
|
170
174
|
}
|
|
171
175
|
|
|
172
176
|
@ReactMethod
|
|
173
|
-
fun acceptRoleChange(data: ReadableMap) {
|
|
177
|
+
fun acceptRoleChange(data: ReadableMap, callback: Promise?) {
|
|
174
178
|
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
175
179
|
|
|
176
|
-
hms?.acceptRoleChange()
|
|
180
|
+
hms?.acceptRoleChange(callback)
|
|
177
181
|
}
|
|
178
182
|
|
|
179
183
|
@ReactMethod
|
|
@@ -191,10 +195,17 @@ class HmsModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMod
|
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
@ReactMethod
|
|
194
|
-
fun
|
|
198
|
+
fun setPlaybackForAllAudio(data: ReadableMap) {
|
|
195
199
|
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
196
200
|
|
|
197
|
-
hms?.
|
|
201
|
+
hms?.setPlaybackForAllAudio(data)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@ReactMethod
|
|
205
|
+
fun remoteMuteAllAudio(data: ReadableMap) {
|
|
206
|
+
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
207
|
+
|
|
208
|
+
hms?.remoteMuteAllAudio()
|
|
198
209
|
}
|
|
199
210
|
|
|
200
211
|
@ReactMethod
|
|
@@ -204,6 +215,29 @@ class HmsModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMod
|
|
|
204
215
|
hms?.changeMetadata(data, callback)
|
|
205
216
|
}
|
|
206
217
|
|
|
218
|
+
@ReactMethod
|
|
219
|
+
fun startScreenshare(data: ReadableMap) {
|
|
220
|
+
currentActivity?.application?.registerActivityLifecycleCallbacks(this)
|
|
221
|
+
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
222
|
+
|
|
223
|
+
hms?.startScreenshare()
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@ReactMethod
|
|
227
|
+
fun isScreenShared(data: ReadableMap, callback: Promise?) {
|
|
228
|
+
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
229
|
+
|
|
230
|
+
hms?.isScreenShared(callback)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@ReactMethod
|
|
234
|
+
fun stopScreenshare(data: ReadableMap, callback: Promise?) {
|
|
235
|
+
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
236
|
+
|
|
237
|
+
currentActivity?.application?.unregisterActivityLifecycleCallbacks(this)
|
|
238
|
+
hms?.stopScreenshare(callback)
|
|
239
|
+
}
|
|
240
|
+
|
|
207
241
|
@ReactMethod
|
|
208
242
|
fun startRTMPOrRecording(data: ReadableMap, callback: Promise?) {
|
|
209
243
|
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
@@ -218,9 +252,66 @@ class HmsModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaMod
|
|
|
218
252
|
hms?.stopRtmpAndRecording(callback)
|
|
219
253
|
}
|
|
220
254
|
|
|
255
|
+
@ReactMethod
|
|
256
|
+
fun startHLSStreaming(data: ReadableMap, callback: Promise?) {
|
|
257
|
+
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
258
|
+
|
|
259
|
+
hms?.startHLSStreaming(data, callback)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
@ReactMethod
|
|
263
|
+
fun stopHLSStreaming(data: ReadableMap, callback: Promise?) {
|
|
264
|
+
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
265
|
+
|
|
266
|
+
hms?.stopHLSStreaming(callback)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
@ReactMethod
|
|
270
|
+
fun resetVolume(data: ReadableMap) {
|
|
271
|
+
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
272
|
+
|
|
273
|
+
hms?.resetVolume()
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
@ReactMethod
|
|
277
|
+
fun changeName(data: ReadableMap, callback: Promise?) {
|
|
278
|
+
val hms = HmsHelper.getHms(data, hmsCollection)
|
|
279
|
+
|
|
280
|
+
hms?.changeName(data, callback)
|
|
281
|
+
}
|
|
282
|
+
|
|
221
283
|
fun emitEvent(event: String, data: WritableMap) {
|
|
222
284
|
reactApplicationContext
|
|
223
285
|
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
224
286
|
.emit(event, data)
|
|
225
287
|
}
|
|
288
|
+
|
|
289
|
+
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {}
|
|
290
|
+
|
|
291
|
+
override fun onActivityStarted(activity: Activity) {}
|
|
292
|
+
|
|
293
|
+
override fun onActivityResumed(activity: Activity) {}
|
|
294
|
+
|
|
295
|
+
override fun onActivityPaused(activity: Activity) {}
|
|
296
|
+
|
|
297
|
+
override fun onActivityStopped(activity: Activity) {}
|
|
298
|
+
|
|
299
|
+
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
|
|
300
|
+
|
|
301
|
+
override fun onActivityDestroyed(activity: Activity) {
|
|
302
|
+
try {
|
|
303
|
+
if (activity.componentName.shortClassName == ".MainActivity") {
|
|
304
|
+
for (key in hmsCollection.keys) {
|
|
305
|
+
val hmsLocalPeer = hmsCollection[key]?.hmsSDK?.getLocalPeer()
|
|
306
|
+
if (hmsLocalPeer != null) {
|
|
307
|
+
hmsCollection[key]?.leave(null)
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
currentActivity?.application?.unregisterActivityLifecycleCallbacks(this)
|
|
311
|
+
hmsCollection = mutableMapOf()
|
|
312
|
+
}
|
|
313
|
+
} catch (e: Exception) {
|
|
314
|
+
// Log.d("error", e.message)
|
|
315
|
+
}
|
|
316
|
+
}
|
|
226
317
|
}
|