@100mslive/react-native-hms 1.1.1 → 1.3.0
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 +145 -340
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +292 -94
- package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +127 -127
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +167 -115
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +283 -45
- package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +7 -7
- package/ios/HMSDecoder.swift +276 -137
- package/ios/HMSHelper.swift +3 -3
- package/ios/HMSManager.m +7 -0
- package/ios/HMSManager.swift +37 -2
- package/ios/HMSRNSDK.swift +339 -97
- package/ios/HMSView.m +2 -0
- package/ios/HMSView.swift +35 -3
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/yogesh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/lib/commonjs/classes/HMSAudioCodec.js +4 -4
- package/lib/commonjs/classes/HMSAudioCodec.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioDevice.js +4 -4
- package/lib/commonjs/classes/HMSAudioDevice.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioFilePlayerNode.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioMixerSource.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioMixingMode.js +4 -4
- package/lib/commonjs/classes/HMSAudioMixingMode.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioMode.js +4 -4
- package/lib/commonjs/classes/HMSAudioMode.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioNode.js +2 -1
- package/lib/commonjs/classes/HMSAudioNode.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
- package/lib/commonjs/classes/HMSCameraFacing.js +4 -4
- package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -1
- package/lib/commonjs/classes/HMSChangeTrackStateRequest.js.map +1 -1
- package/lib/commonjs/classes/HMSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSConstants.js +11 -0
- package/lib/commonjs/classes/HMSConstants.js.map +1 -0
- package/lib/commonjs/classes/HMSEncoder.js +129 -102
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSException.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSMeetingURLVariant.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSRecordingConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSRecordingState.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSStreamingState.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSVariant.js.map +1 -1
- package/lib/commonjs/classes/HMSHelper.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalAudioStats.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalPeer.js +0 -1
- package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalVideoTrack.js +0 -2
- package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLogAlarmManager.js +4 -4
- package/lib/commonjs/classes/HMSLogAlarmManager.js.map +1 -1
- package/lib/commonjs/classes/HMSLogLevel.js +4 -4
- package/lib/commonjs/classes/HMSLogLevel.js.map +1 -1
- package/lib/commonjs/classes/HMSLogSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSLogger.js +17 -25
- package/lib/commonjs/classes/HMSLogger.js.map +1 -1
- package/lib/commonjs/classes/HMSMessage.js.map +1 -1
- package/lib/commonjs/classes/HMSMessageRecipient.js +1 -1
- package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -1
- package/lib/commonjs/classes/HMSMessageRecipientType.js +4 -4
- package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -1
- package/lib/commonjs/classes/HMSMessageType.js +4 -4
- package/lib/commonjs/classes/HMSMessageType.js.map +1 -1
- package/lib/commonjs/classes/HMSMicNode.js.map +1 -1
- package/lib/commonjs/classes/HMSNativeEventEmitter.js +101 -0
- package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -0
- package/lib/commonjs/classes/HMSNetworkQuality.js.map +1 -1
- package/lib/commonjs/classes/HMSPIPListenerActions.js +4 -4
- package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSPeer.js +69 -18
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSPeerUpdate.js +7 -5
- package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSPeersCache.js +229 -0
- package/lib/commonjs/classes/HMSPeersCache.js.map +1 -0
- package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
- package/lib/commonjs/classes/HMSPublishSettings.js +0 -6
- package/lib/commonjs/classes/HMSPublishSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSRTCStats.js.map +1 -1
- package/lib/commonjs/classes/HMSRTCStatsReport.js.map +1 -1
- package/lib/commonjs/classes/HMSRTMPConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteAudioStats.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSRemotePeer.js +0 -1
- package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteVideoStats.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSRole.js +0 -6
- package/lib/commonjs/classes/HMSRole.js.map +1 -1
- package/lib/commonjs/classes/HMSRoleChangeRequest.js +3 -1
- package/lib/commonjs/classes/HMSRoleChangeRequest.js.map +1 -1
- package/lib/commonjs/classes/HMSRoom.js +79 -22
- package/lib/commonjs/classes/HMSRoom.js.map +1 -1
- package/lib/commonjs/classes/HMSRoomCache.js +128 -0
- package/lib/commonjs/classes/HMSRoomCache.js.map +1 -0
- package/lib/commonjs/classes/HMSRoomUpdate.js +4 -4
- package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
- package/lib/commonjs/classes/HMSRtmpVideoResolution.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +933 -158
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSScreenBroadcastAudioReceiverNode.js.map +1 -1
- package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
- package/lib/commonjs/classes/HMSSimulcastLayerSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSSimulcastSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSSpeaker.js.map +1 -1
- package/lib/commonjs/classes/HMSSubscribeSettings.js +0 -2
- package/lib/commonjs/classes/HMSSubscribeSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSettingsInitState.js +4 -4
- package/lib/commonjs/classes/HMSTrackSettingsInitState.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSource.js +4 -4
- package/lib/commonjs/classes/HMSTrackSource.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackType.js +4 -4
- package/lib/commonjs/classes/HMSTrackType.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackUpdate.js +4 -4
- package/lib/commonjs/classes/HMSTrackUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSUpdateListenerActions.js +5 -5
- package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoCodec.js +4 -4
- package/lib/commonjs/classes/HMSVideoCodec.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoResolution.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoViewMode.js +4 -4
- package/lib/commonjs/classes/HMSVideoViewMode.js.map +1 -1
- package/lib/commonjs/classes/HmsView.js +2 -1
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/classes/HMSAudioCodec.js +3 -3
- package/lib/module/classes/HMSAudioCodec.js.map +1 -1
- package/lib/module/classes/HMSAudioDevice.js +3 -3
- package/lib/module/classes/HMSAudioDevice.js.map +1 -1
- package/lib/module/classes/HMSAudioFilePlayerNode.js.map +1 -1
- package/lib/module/classes/HMSAudioMixerSource.js.map +1 -1
- package/lib/module/classes/HMSAudioMixingMode.js +3 -3
- package/lib/module/classes/HMSAudioMixingMode.js.map +1 -1
- package/lib/module/classes/HMSAudioMode.js +3 -3
- package/lib/module/classes/HMSAudioMode.js.map +1 -1
- package/lib/module/classes/HMSAudioNode.js +2 -1
- package/lib/module/classes/HMSAudioNode.js.map +1 -1
- package/lib/module/classes/HMSAudioSettings.js.map +1 -1
- package/lib/module/classes/HMSAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
- package/lib/module/classes/HMSCameraFacing.js +3 -3
- package/lib/module/classes/HMSCameraFacing.js.map +1 -1
- package/lib/module/classes/HMSChangeTrackStateRequest.js.map +1 -1
- package/lib/module/classes/HMSConfig.js.map +1 -1
- package/lib/module/classes/HMSConstants.js +4 -0
- package/lib/module/classes/HMSConstants.js.map +1 -0
- package/lib/module/classes/HMSEncoder.js +129 -102
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSException.js.map +1 -1
- package/lib/module/classes/HMSHLSConfig.js.map +1 -1
- package/lib/module/classes/HMSHLSMeetingURLVariant.js.map +1 -1
- package/lib/module/classes/HMSHLSRecordingConfig.js.map +1 -1
- package/lib/module/classes/HMSHLSRecordingState.js.map +1 -1
- package/lib/module/classes/HMSHLSStreamingState.js.map +1 -1
- package/lib/module/classes/HMSHLSVariant.js.map +1 -1
- package/lib/module/classes/HMSHelper.js.map +1 -1
- package/lib/module/classes/HMSLocalAudioStats.js.map +1 -1
- package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSLocalPeer.js +0 -1
- package/lib/module/classes/HMSLocalPeer.js.map +1 -1
- package/lib/module/classes/HMSLocalVideoStats.js.map +1 -1
- package/lib/module/classes/HMSLocalVideoTrack.js +0 -2
- package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSLogAlarmManager.js +3 -3
- package/lib/module/classes/HMSLogAlarmManager.js.map +1 -1
- package/lib/module/classes/HMSLogLevel.js +3 -3
- package/lib/module/classes/HMSLogLevel.js.map +1 -1
- package/lib/module/classes/HMSLogSettings.js.map +1 -1
- package/lib/module/classes/HMSLogger.js +17 -25
- package/lib/module/classes/HMSLogger.js.map +1 -1
- package/lib/module/classes/HMSMessage.js.map +1 -1
- package/lib/module/classes/HMSMessageRecipient.js +1 -1
- package/lib/module/classes/HMSMessageRecipient.js.map +1 -1
- package/lib/module/classes/HMSMessageRecipientType.js +3 -3
- package/lib/module/classes/HMSMessageRecipientType.js.map +1 -1
- package/lib/module/classes/HMSMessageType.js +3 -3
- package/lib/module/classes/HMSMessageType.js.map +1 -1
- package/lib/module/classes/HMSMicNode.js.map +1 -1
- package/lib/module/classes/HMSNativeEventEmitter.js +94 -0
- package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -0
- package/lib/module/classes/HMSNetworkQuality.js.map +1 -1
- package/lib/module/classes/HMSPIPListenerActions.js +3 -3
- package/lib/module/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/module/classes/HMSPeer.js +69 -18
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSPeerUpdate.js +4 -3
- package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/module/classes/HMSPeersCache.js +216 -0
- package/lib/module/classes/HMSPeersCache.js.map +1 -0
- package/lib/module/classes/HMSPermissions.js.map +1 -1
- package/lib/module/classes/HMSPublishSettings.js +0 -6
- package/lib/module/classes/HMSPublishSettings.js.map +1 -1
- package/lib/module/classes/HMSRTCStats.js.map +1 -1
- package/lib/module/classes/HMSRTCStatsReport.js.map +1 -1
- package/lib/module/classes/HMSRTMPConfig.js.map +1 -1
- package/lib/module/classes/HMSRemoteAudioStats.js.map +1 -1
- package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSRemotePeer.js +0 -1
- package/lib/module/classes/HMSRemotePeer.js.map +1 -1
- package/lib/module/classes/HMSRemoteVideoStats.js.map +1 -1
- package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSRole.js +0 -6
- package/lib/module/classes/HMSRole.js.map +1 -1
- package/lib/module/classes/HMSRoleChangeRequest.js +3 -1
- package/lib/module/classes/HMSRoleChangeRequest.js.map +1 -1
- package/lib/module/classes/HMSRoom.js +79 -22
- package/lib/module/classes/HMSRoom.js.map +1 -1
- package/lib/module/classes/HMSRoomCache.js +115 -0
- package/lib/module/classes/HMSRoomCache.js.map +1 -0
- package/lib/module/classes/HMSRoomUpdate.js +3 -3
- package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
- package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
- package/lib/module/classes/HMSRtmpVideoResolution.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +934 -159
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSScreenBroadcastAudioReceiverNode.js.map +1 -1
- package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
- package/lib/module/classes/HMSSimulcastLayerSettings.js.map +1 -1
- package/lib/module/classes/HMSSimulcastSettings.js.map +1 -1
- package/lib/module/classes/HMSSpeaker.js.map +1 -1
- package/lib/module/classes/HMSSubscribeSettings.js +0 -2
- package/lib/module/classes/HMSSubscribeSettings.js.map +1 -1
- package/lib/module/classes/HMSTrack.js.map +1 -1
- package/lib/module/classes/HMSTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSTrackSettingsInitState.js +3 -3
- package/lib/module/classes/HMSTrackSettingsInitState.js.map +1 -1
- package/lib/module/classes/HMSTrackSource.js +3 -3
- package/lib/module/classes/HMSTrackSource.js.map +1 -1
- package/lib/module/classes/HMSTrackType.js +3 -3
- package/lib/module/classes/HMSTrackType.js.map +1 -1
- package/lib/module/classes/HMSTrackUpdate.js +3 -3
- package/lib/module/classes/HMSTrackUpdate.js.map +1 -1
- package/lib/module/classes/HMSUpdateListenerActions.js +4 -4
- package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/module/classes/HMSVideoCodec.js +3 -3
- package/lib/module/classes/HMSVideoCodec.js.map +1 -1
- package/lib/module/classes/HMSVideoResolution.js.map +1 -1
- package/lib/module/classes/HMSVideoSettings.js.map +1 -1
- package/lib/module/classes/HMSVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSVideoViewMode.js +3 -3
- package/lib/module/classes/HMSVideoViewMode.js.map +1 -1
- package/lib/module/classes/HmsView.js +2 -1
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +4 -4
- package/lib/typescript/classes/HMSChangeTrackStateRequest.d.ts +2 -2
- package/lib/typescript/classes/HMSConstants.d.ts +3 -0
- package/lib/typescript/classes/HMSEncoder.d.ts +10 -6
- package/lib/typescript/classes/HMSHLSStreamingState.d.ts +2 -2
- package/lib/typescript/classes/HMSLocalPeer.d.ts +0 -14
- package/lib/typescript/classes/HMSLocalVideoTrack.d.ts +0 -2
- package/lib/typescript/classes/HMSLogger.d.ts +1 -7
- package/lib/typescript/classes/HMSMessageRecipient.d.ts +2 -2
- package/lib/typescript/classes/HMSNativeEventEmitter.d.ts +13 -0
- package/lib/typescript/classes/HMSPeer.d.ts +12 -18
- package/lib/typescript/classes/HMSPeerUpdate.d.ts +1 -0
- package/lib/typescript/classes/HMSPeersCache.d.ts +17 -0
- package/lib/typescript/classes/HMSPublishSettings.d.ts +8 -15
- package/lib/typescript/classes/HMSRemotePeer.d.ts +0 -14
- package/lib/typescript/classes/HMSRole.d.ts +0 -6
- package/lib/typescript/classes/HMSRoleChangeRequest.d.ts +2 -2
- package/lib/typescript/classes/HMSRoom.d.ts +11 -22
- package/lib/typescript/classes/HMSRoomCache.d.ts +16 -0
- package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +4 -4
- package/lib/typescript/classes/HMSSDK.d.ts +3 -13
- package/lib/typescript/classes/HMSServerRecordingState.d.ts +2 -2
- package/lib/typescript/classes/HMSSubscribeSettings.d.ts +0 -2
- package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/package.json +5 -4
- package/react-native-hms.podspec +1 -1
- package/sdk-versions.json +3 -2
- package/src/classes/HMSAudioNode.ts +3 -1
- package/src/classes/HMSBrowserRecordingState.ts +4 -4
- package/src/classes/HMSChangeTrackStateRequest.ts +2 -2
- package/src/classes/HMSConstants.ts +3 -0
- package/src/classes/HMSEncoder.ts +162 -120
- package/src/classes/HMSHLSStreamingState.ts +2 -2
- package/src/classes/HMSLocalPeer.ts +0 -15
- package/src/classes/HMSLocalVideoTrack.ts +0 -2
- package/src/classes/HMSLogger.ts +20 -19
- package/src/classes/HMSMessageRecipient.ts +3 -3
- package/src/classes/HMSNativeEventEmitter.ts +109 -0
- package/src/classes/HMSPeer.ts +135 -32
- package/src/classes/HMSPeerUpdate.ts +9 -0
- package/src/classes/HMSPeersCache.ts +252 -0
- package/src/classes/HMSPublishSettings.ts +8 -18
- package/src/classes/HMSRemotePeer.ts +0 -16
- package/src/classes/HMSRole.ts +0 -9
- package/src/classes/HMSRoleChangeRequest.ts +5 -3
- package/src/classes/HMSRoom.ts +141 -37
- package/src/classes/HMSRoomCache.ts +157 -0
- package/src/classes/HMSRtmpStreamingState.ts +4 -4
- package/src/classes/HMSSDK.tsx +685 -292
- package/src/classes/HMSServerRecordingState.ts +2 -2
- package/src/classes/HMSSubscribeSettings.ts +1 -7
- package/src/classes/HMSUpdateListenerActions.ts +1 -1
- package/src/classes/HmsView.tsx +2 -1
- package/src/index.ts +1 -0
package/src/classes/HMSSDK.tsx
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
AppState,
|
|
4
|
-
NativeEventEmitter,
|
|
5
|
-
NativeModules,
|
|
6
|
-
Platform,
|
|
7
|
-
ViewStyle,
|
|
8
|
-
} from 'react-native';
|
|
9
|
-
|
|
2
|
+
import { AppState, NativeModules, Platform, ViewStyle } from 'react-native';
|
|
10
3
|
import { HMSEncoder } from './HMSEncoder';
|
|
11
4
|
import { HMSHelper } from './HMSHelper';
|
|
12
5
|
import { HMSLocalAudioStats } from './HMSLocalAudioStats';
|
|
@@ -36,6 +29,23 @@ import type { HMSAudioMixingMode } from './HMSAudioMixingMode';
|
|
|
36
29
|
import type { HMSLogSettings } from './HMSLogSettings';
|
|
37
30
|
import { HMSMessageType } from './HMSMessageType';
|
|
38
31
|
import { HMSPIPListenerActions } from './HMSPIPListenerActions';
|
|
32
|
+
import {
|
|
33
|
+
type HMSEventSubscription,
|
|
34
|
+
HMSNativeEventEmitter,
|
|
35
|
+
} from './HMSNativeEventEmitter';
|
|
36
|
+
import {
|
|
37
|
+
clearHmsPeersCache,
|
|
38
|
+
getHmsPeersCache,
|
|
39
|
+
HMSPeersCache,
|
|
40
|
+
setHmsPeersCache,
|
|
41
|
+
} from './HMSPeersCache';
|
|
42
|
+
import {
|
|
43
|
+
clearHmsRoomCache,
|
|
44
|
+
getHmsRoomCache,
|
|
45
|
+
HMSRoomCache,
|
|
46
|
+
setHmsRoomCache,
|
|
47
|
+
} from './HMSRoomCache';
|
|
48
|
+
import { HMSPeerUpdateOrdinals } from './HMSPeerUpdate';
|
|
39
49
|
|
|
40
50
|
interface HmsViewProps {
|
|
41
51
|
trackId: string;
|
|
@@ -61,7 +71,7 @@ const {
|
|
|
61
71
|
|
|
62
72
|
const ReactNativeVersion = require('react-native/Libraries/Core/ReactNativeVersion');
|
|
63
73
|
|
|
64
|
-
const HmsEventEmitter = new
|
|
74
|
+
const HmsEventEmitter = new HMSNativeEventEmitter(HMSManager);
|
|
65
75
|
|
|
66
76
|
let HmsSdk: HMSSDK | undefined;
|
|
67
77
|
|
|
@@ -91,6 +101,13 @@ export class HMSSDK {
|
|
|
91
101
|
private onAudioDeviceChangedDelegate?: any;
|
|
92
102
|
private onPIPRoomLeaveDelegate?: any;
|
|
93
103
|
|
|
104
|
+
private emitterSubscriptions: Partial<
|
|
105
|
+
Record<
|
|
106
|
+
HMSUpdateListenerActions | HMSPIPListenerActions,
|
|
107
|
+
HMSEventSubscription
|
|
108
|
+
>
|
|
109
|
+
> = {};
|
|
110
|
+
|
|
94
111
|
private constructor(id: string) {
|
|
95
112
|
this.id = id;
|
|
96
113
|
}
|
|
@@ -131,7 +148,6 @@ export class HMSSDK {
|
|
|
131
148
|
logSettings: params?.logSettings,
|
|
132
149
|
});
|
|
133
150
|
HmsSdk = new HMSSDK(id);
|
|
134
|
-
HmsSdk.attachListeners();
|
|
135
151
|
return HmsSdk;
|
|
136
152
|
}
|
|
137
153
|
|
|
@@ -160,228 +176,12 @@ export class HMSSDK {
|
|
|
160
176
|
*/
|
|
161
177
|
destroy = async () => {
|
|
162
178
|
logger?.verbose('#Function destroy', { id: this.id });
|
|
163
|
-
|
|
179
|
+
clearHmsPeersCache();
|
|
180
|
+
clearHmsRoomCache();
|
|
181
|
+
this.removeAllListeners();
|
|
164
182
|
return await HMSManager.destroy({ id: this.id });
|
|
165
183
|
};
|
|
166
184
|
|
|
167
|
-
/**
|
|
168
|
-
* - Attaches all the listeners to native callbacks.
|
|
169
|
-
* Note: this function connects sdk to native side and not app to sdk.
|
|
170
|
-
* @memberof HMSSDK
|
|
171
|
-
*/
|
|
172
|
-
attachListeners = () => {
|
|
173
|
-
HmsEventEmitter.addListener(
|
|
174
|
-
HMSUpdateListenerActions.ON_PREVIEW,
|
|
175
|
-
this.onPreviewListener
|
|
176
|
-
);
|
|
177
|
-
|
|
178
|
-
HmsEventEmitter.addListener(
|
|
179
|
-
HMSUpdateListenerActions.ON_JOIN,
|
|
180
|
-
this.onJoinListener
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
HmsEventEmitter.addListener(
|
|
184
|
-
HMSUpdateListenerActions.ON_ROOM_UPDATE,
|
|
185
|
-
this.onRoomListener
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
HmsEventEmitter.addListener(
|
|
189
|
-
HMSUpdateListenerActions.ON_PEER_UPDATE,
|
|
190
|
-
this.onPeerListener
|
|
191
|
-
);
|
|
192
|
-
|
|
193
|
-
HmsEventEmitter.addListener(
|
|
194
|
-
HMSUpdateListenerActions.ON_TRACK_UPDATE,
|
|
195
|
-
this.onTrackListener
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
HmsEventEmitter.addListener(
|
|
199
|
-
HMSUpdateListenerActions.ON_ERROR,
|
|
200
|
-
this.onErrorListener
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
HmsEventEmitter.addListener(
|
|
204
|
-
HMSUpdateListenerActions.ON_MESSAGE,
|
|
205
|
-
this.onMessageListener
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
HmsEventEmitter.addListener(
|
|
209
|
-
HMSUpdateListenerActions.ON_SPEAKER,
|
|
210
|
-
this.onSpeakerListener
|
|
211
|
-
);
|
|
212
|
-
|
|
213
|
-
HmsEventEmitter.addListener(
|
|
214
|
-
HMSUpdateListenerActions.RECONNECTING,
|
|
215
|
-
this.reconnectingListener
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
HmsEventEmitter.addListener(
|
|
219
|
-
HMSUpdateListenerActions.RECONNECTED,
|
|
220
|
-
this.reconnectedListener
|
|
221
|
-
);
|
|
222
|
-
|
|
223
|
-
HmsEventEmitter.addListener(
|
|
224
|
-
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST,
|
|
225
|
-
this.onRoleChangeRequestListener
|
|
226
|
-
);
|
|
227
|
-
|
|
228
|
-
HmsEventEmitter.addListener(
|
|
229
|
-
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST,
|
|
230
|
-
this.onChangeTrackStateRequestListener
|
|
231
|
-
);
|
|
232
|
-
|
|
233
|
-
HmsEventEmitter.addListener(
|
|
234
|
-
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM,
|
|
235
|
-
this.onRemovedFromRoomListener
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
HmsEventEmitter.addListener(
|
|
239
|
-
HMSUpdateListenerActions.ON_RTC_STATS,
|
|
240
|
-
this.RTCStatsListener
|
|
241
|
-
);
|
|
242
|
-
|
|
243
|
-
HmsEventEmitter.addListener(
|
|
244
|
-
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS,
|
|
245
|
-
this.onLocalAudioStatsListener
|
|
246
|
-
);
|
|
247
|
-
|
|
248
|
-
HmsEventEmitter.addListener(
|
|
249
|
-
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS,
|
|
250
|
-
this.onLocalVideoStatsListener
|
|
251
|
-
);
|
|
252
|
-
|
|
253
|
-
HmsEventEmitter.addListener(
|
|
254
|
-
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS,
|
|
255
|
-
this.onRemoteAudioStatsListener
|
|
256
|
-
);
|
|
257
|
-
|
|
258
|
-
HmsEventEmitter.addListener(
|
|
259
|
-
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS,
|
|
260
|
-
this.onRemoteVideoStatsListener
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
HmsEventEmitter.addListener(
|
|
264
|
-
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED,
|
|
265
|
-
this.onAudioDeviceChangedListener
|
|
266
|
-
);
|
|
267
|
-
|
|
268
|
-
if (Platform.OS === 'android') {
|
|
269
|
-
HmsEventEmitter.addListener(
|
|
270
|
-
HMSPIPListenerActions.ON_PIP_ROOM_LEAVE,
|
|
271
|
-
this.onPIPRoomLeaveListener
|
|
272
|
-
);
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Disconnects all the listeners of this sdk from native listeners.
|
|
278
|
-
* Note: this function is only called from destroy function and should only be called when the current instance of {@link HMSSDK} is not required anymore.
|
|
279
|
-
* @memberof HMSSDK
|
|
280
|
-
*/
|
|
281
|
-
removeListeners = () => {
|
|
282
|
-
HmsEventEmitter.removeListener(
|
|
283
|
-
HMSUpdateListenerActions.ON_JOIN,
|
|
284
|
-
this.onJoinListener
|
|
285
|
-
);
|
|
286
|
-
|
|
287
|
-
HmsEventEmitter.removeListener(
|
|
288
|
-
HMSUpdateListenerActions.ON_PREVIEW,
|
|
289
|
-
this.onPreviewListener
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
HmsEventEmitter.removeListener(
|
|
293
|
-
HMSUpdateListenerActions.ON_ROOM_UPDATE,
|
|
294
|
-
this.onRoomListener
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
HmsEventEmitter.removeListener(
|
|
298
|
-
HMSUpdateListenerActions.ON_PEER_UPDATE,
|
|
299
|
-
this.onPeerListener
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
HmsEventEmitter.removeListener(
|
|
303
|
-
HMSUpdateListenerActions.ON_TRACK_UPDATE,
|
|
304
|
-
this.onTrackListener
|
|
305
|
-
);
|
|
306
|
-
|
|
307
|
-
HmsEventEmitter.removeListener(
|
|
308
|
-
HMSUpdateListenerActions.ON_ERROR,
|
|
309
|
-
this.onErrorListener
|
|
310
|
-
);
|
|
311
|
-
|
|
312
|
-
HmsEventEmitter.removeListener(
|
|
313
|
-
HMSUpdateListenerActions.ON_MESSAGE,
|
|
314
|
-
this.onMessageListener
|
|
315
|
-
);
|
|
316
|
-
|
|
317
|
-
HmsEventEmitter.removeListener(
|
|
318
|
-
HMSUpdateListenerActions.ON_SPEAKER,
|
|
319
|
-
this.onSpeakerListener
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
HmsEventEmitter.removeListener(
|
|
323
|
-
HMSUpdateListenerActions.RECONNECTING,
|
|
324
|
-
this.reconnectingListener
|
|
325
|
-
);
|
|
326
|
-
|
|
327
|
-
HmsEventEmitter.removeListener(
|
|
328
|
-
HMSUpdateListenerActions.RECONNECTED,
|
|
329
|
-
this.reconnectedListener
|
|
330
|
-
);
|
|
331
|
-
|
|
332
|
-
HmsEventEmitter.removeListener(
|
|
333
|
-
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST,
|
|
334
|
-
this.onRoleChangeRequestListener
|
|
335
|
-
);
|
|
336
|
-
|
|
337
|
-
HmsEventEmitter.removeListener(
|
|
338
|
-
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST,
|
|
339
|
-
this.onChangeTrackStateRequestListener
|
|
340
|
-
);
|
|
341
|
-
|
|
342
|
-
HmsEventEmitter.removeListener(
|
|
343
|
-
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM,
|
|
344
|
-
this.onRemovedFromRoomListener
|
|
345
|
-
);
|
|
346
|
-
|
|
347
|
-
HmsEventEmitter.removeListener(
|
|
348
|
-
HMSUpdateListenerActions.ON_RTC_STATS,
|
|
349
|
-
this.RTCStatsListener
|
|
350
|
-
);
|
|
351
|
-
|
|
352
|
-
HmsEventEmitter.removeListener(
|
|
353
|
-
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS,
|
|
354
|
-
this.onLocalAudioStatsListener
|
|
355
|
-
);
|
|
356
|
-
|
|
357
|
-
HmsEventEmitter.removeListener(
|
|
358
|
-
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS,
|
|
359
|
-
this.onLocalVideoStatsListener
|
|
360
|
-
);
|
|
361
|
-
|
|
362
|
-
HmsEventEmitter.removeListener(
|
|
363
|
-
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS,
|
|
364
|
-
this.onRemoteAudioStatsListener
|
|
365
|
-
);
|
|
366
|
-
|
|
367
|
-
HmsEventEmitter.removeListener(
|
|
368
|
-
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS,
|
|
369
|
-
this.onRemoteVideoStatsListener
|
|
370
|
-
);
|
|
371
|
-
|
|
372
|
-
HmsEventEmitter.removeListener(
|
|
373
|
-
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED,
|
|
374
|
-
this.onAudioDeviceChangedListener
|
|
375
|
-
);
|
|
376
|
-
|
|
377
|
-
if (Platform.OS === 'android') {
|
|
378
|
-
HmsEventEmitter.removeListener(
|
|
379
|
-
HMSPIPListenerActions.ON_PIP_ROOM_LEAVE,
|
|
380
|
-
this.onPIPRoomLeaveListener
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
|
|
385
185
|
/**
|
|
386
186
|
* takes an instance of [HMSConfig]{@link HMSConfig} and joins the room.
|
|
387
187
|
* after joining the room user will start receiving the events and updates of the room.
|
|
@@ -394,6 +194,8 @@ export class HMSSDK {
|
|
|
394
194
|
join = async (config: HMSConfig) => {
|
|
395
195
|
logger?.verbose('#Function join', { config, id: this.id });
|
|
396
196
|
this.addAppStateListener();
|
|
197
|
+
setHmsPeersCache(new HMSPeersCache(this.id));
|
|
198
|
+
setHmsRoomCache(new HMSRoomCache(this.id));
|
|
397
199
|
await HMSManager.join({ ...config, id: this.id });
|
|
398
200
|
};
|
|
399
201
|
|
|
@@ -461,6 +263,14 @@ export class HMSSDK {
|
|
|
461
263
|
);
|
|
462
264
|
});
|
|
463
265
|
|
|
266
|
+
roomLeaveCleanup = () => {
|
|
267
|
+
this.muteStatus = undefined;
|
|
268
|
+
this?.appStateSubscription?.remove();
|
|
269
|
+
clearHmsPeersCache();
|
|
270
|
+
clearHmsRoomCache();
|
|
271
|
+
HMSEncoder.clearData(); // Clearing cached data in encoder
|
|
272
|
+
};
|
|
273
|
+
|
|
464
274
|
/**
|
|
465
275
|
* Calls leave function of native sdk and session of current user is invalidated.
|
|
466
276
|
*
|
|
@@ -475,8 +285,7 @@ export class HMSSDK {
|
|
|
475
285
|
};
|
|
476
286
|
|
|
477
287
|
const op = await HMSManager.leave(data);
|
|
478
|
-
this.
|
|
479
|
-
this?.appStateSubscription?.remove();
|
|
288
|
+
this.roomLeaveCleanup();
|
|
480
289
|
return op;
|
|
481
290
|
};
|
|
482
291
|
|
|
@@ -888,6 +697,8 @@ export class HMSSDK {
|
|
|
888
697
|
});
|
|
889
698
|
const hmsRoom = await HMSManager.getRoom({ id: this.id });
|
|
890
699
|
|
|
700
|
+
getHmsRoomCache()?.updateRoomCache(hmsRoom);
|
|
701
|
+
|
|
891
702
|
const encodedHmsRoom = HMSEncoder.encodeHmsRoom(hmsRoom, this.id);
|
|
892
703
|
return encodedHmsRoom;
|
|
893
704
|
};
|
|
@@ -1303,66 +1114,376 @@ export class HMSSDK {
|
|
|
1303
1114
|
id: this.id,
|
|
1304
1115
|
});
|
|
1305
1116
|
switch (action) {
|
|
1306
|
-
case HMSUpdateListenerActions.ON_PREVIEW:
|
|
1117
|
+
case HMSUpdateListenerActions.ON_PREVIEW: {
|
|
1118
|
+
// Checking if we already have ON_PREVIEW subscription
|
|
1119
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_PREVIEW]) {
|
|
1120
|
+
// Adding ON_PREVIEW native listener
|
|
1121
|
+
const previewSubscription = HmsEventEmitter.addListener(
|
|
1122
|
+
this.id,
|
|
1123
|
+
HMSUpdateListenerActions.ON_PREVIEW,
|
|
1124
|
+
this.onPreviewListener
|
|
1125
|
+
);
|
|
1126
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PREVIEW] =
|
|
1127
|
+
previewSubscription;
|
|
1128
|
+
}
|
|
1129
|
+
// Adding App Delegate listener
|
|
1307
1130
|
this.onPreviewDelegate = callback;
|
|
1308
1131
|
break;
|
|
1309
|
-
|
|
1132
|
+
}
|
|
1133
|
+
case HMSUpdateListenerActions.ON_JOIN: {
|
|
1134
|
+
// Checking if we already have ON_JOIN subscription
|
|
1135
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_JOIN]) {
|
|
1136
|
+
// Adding ON_JOIN native listener
|
|
1137
|
+
const joinSubscription = HmsEventEmitter.addListener(
|
|
1138
|
+
this.id,
|
|
1139
|
+
HMSUpdateListenerActions.ON_JOIN,
|
|
1140
|
+
this.onJoinListener
|
|
1141
|
+
);
|
|
1142
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_JOIN] =
|
|
1143
|
+
joinSubscription;
|
|
1144
|
+
}
|
|
1145
|
+
// Adding App Delegate listener
|
|
1310
1146
|
this.onJoinDelegate = callback;
|
|
1311
1147
|
break;
|
|
1312
|
-
|
|
1148
|
+
}
|
|
1149
|
+
case HMSUpdateListenerActions.ON_ROOM_UPDATE: {
|
|
1150
|
+
// Checking if we already have ON_ROOM_UPDATE subscription
|
|
1151
|
+
if (
|
|
1152
|
+
!this.emitterSubscriptions[HMSUpdateListenerActions.ON_ROOM_UPDATE]
|
|
1153
|
+
) {
|
|
1154
|
+
// Adding ON_ROOM_UPDATE native listener
|
|
1155
|
+
const roomSubscription = HmsEventEmitter.addListener(
|
|
1156
|
+
this.id,
|
|
1157
|
+
HMSUpdateListenerActions.ON_ROOM_UPDATE,
|
|
1158
|
+
this.onRoomListener
|
|
1159
|
+
);
|
|
1160
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ROOM_UPDATE] =
|
|
1161
|
+
roomSubscription;
|
|
1162
|
+
}
|
|
1163
|
+
// Adding App Delegate listener
|
|
1313
1164
|
this.onRoomDelegate = callback;
|
|
1314
1165
|
break;
|
|
1315
|
-
|
|
1166
|
+
}
|
|
1167
|
+
case HMSUpdateListenerActions.ON_PEER_UPDATE: {
|
|
1168
|
+
// Checking if we already have ON_PEER_UPDATE subscription
|
|
1169
|
+
if (
|
|
1170
|
+
!this.emitterSubscriptions[HMSUpdateListenerActions.ON_PEER_UPDATE]
|
|
1171
|
+
) {
|
|
1172
|
+
// Adding ON_PEER_UPDATE native listener
|
|
1173
|
+
const peerSubscription = HmsEventEmitter.addListener(
|
|
1174
|
+
this.id,
|
|
1175
|
+
HMSUpdateListenerActions.ON_PEER_UPDATE,
|
|
1176
|
+
this.onPeerListener
|
|
1177
|
+
);
|
|
1178
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PEER_UPDATE] =
|
|
1179
|
+
peerSubscription;
|
|
1180
|
+
}
|
|
1181
|
+
// Adding App Delegate listener
|
|
1316
1182
|
this.onPeerDelegate = callback;
|
|
1317
1183
|
break;
|
|
1318
|
-
|
|
1184
|
+
}
|
|
1185
|
+
case HMSUpdateListenerActions.ON_TRACK_UPDATE: {
|
|
1186
|
+
// Checking if we already have ON_TRACK_UPDATE subscription
|
|
1187
|
+
if (
|
|
1188
|
+
!this.emitterSubscriptions[HMSUpdateListenerActions.ON_TRACK_UPDATE]
|
|
1189
|
+
) {
|
|
1190
|
+
// Adding ON_TRACK_UPDATE native listener
|
|
1191
|
+
const trackSubscription = HmsEventEmitter.addListener(
|
|
1192
|
+
this.id,
|
|
1193
|
+
HMSUpdateListenerActions.ON_TRACK_UPDATE,
|
|
1194
|
+
this.onTrackListener
|
|
1195
|
+
);
|
|
1196
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_TRACK_UPDATE] =
|
|
1197
|
+
trackSubscription;
|
|
1198
|
+
}
|
|
1199
|
+
// Adding App Delegate listener
|
|
1319
1200
|
this.onTrackDelegate = callback;
|
|
1320
1201
|
break;
|
|
1321
|
-
|
|
1202
|
+
}
|
|
1203
|
+
case HMSUpdateListenerActions.ON_ERROR: {
|
|
1204
|
+
// Checking if we already have ON_ERROR subscription
|
|
1205
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_ERROR]) {
|
|
1206
|
+
// Adding ON_ERROR native listener
|
|
1207
|
+
const errorSubscription = HmsEventEmitter.addListener(
|
|
1208
|
+
this.id,
|
|
1209
|
+
HMSUpdateListenerActions.ON_ERROR,
|
|
1210
|
+
this.onErrorListener
|
|
1211
|
+
);
|
|
1212
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ERROR] =
|
|
1213
|
+
errorSubscription;
|
|
1214
|
+
}
|
|
1215
|
+
// Adding App Delegate listener
|
|
1322
1216
|
this.onErrorDelegate = callback;
|
|
1323
1217
|
break;
|
|
1324
|
-
|
|
1218
|
+
}
|
|
1219
|
+
case HMSUpdateListenerActions.ON_MESSAGE: {
|
|
1220
|
+
// Checking if we already have ON_MESSAGE subscription
|
|
1221
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_MESSAGE]) {
|
|
1222
|
+
// Adding ON_MESSAGE native listener
|
|
1223
|
+
const messageSubscription = HmsEventEmitter.addListener(
|
|
1224
|
+
this.id,
|
|
1225
|
+
HMSUpdateListenerActions.ON_MESSAGE,
|
|
1226
|
+
this.onMessageListener
|
|
1227
|
+
);
|
|
1228
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_MESSAGE] =
|
|
1229
|
+
messageSubscription;
|
|
1230
|
+
}
|
|
1231
|
+
// Adding App Delegate listener
|
|
1325
1232
|
this.onMessageDelegate = callback;
|
|
1326
1233
|
break;
|
|
1327
|
-
|
|
1234
|
+
}
|
|
1235
|
+
case HMSUpdateListenerActions.ON_SPEAKER: {
|
|
1236
|
+
// Checking if we already have ON_SPEAKER subscription
|
|
1237
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_SPEAKER]) {
|
|
1238
|
+
// Adding ON_SPEAKER native listener
|
|
1239
|
+
const speakerSubscription = HmsEventEmitter.addListener(
|
|
1240
|
+
this.id,
|
|
1241
|
+
HMSUpdateListenerActions.ON_SPEAKER,
|
|
1242
|
+
this.onSpeakerListener
|
|
1243
|
+
);
|
|
1244
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_SPEAKER] =
|
|
1245
|
+
speakerSubscription;
|
|
1246
|
+
}
|
|
1247
|
+
// Adding App Delegate listener
|
|
1328
1248
|
this.onSpeakerDelegate = callback;
|
|
1329
1249
|
break;
|
|
1330
|
-
|
|
1250
|
+
}
|
|
1251
|
+
case HMSUpdateListenerActions.RECONNECTING: {
|
|
1252
|
+
// Checking if we already have RECONNECTING subscription
|
|
1253
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTING]) {
|
|
1254
|
+
// Adding RECONNECTING native listener
|
|
1255
|
+
const reconnectingSubscription = HmsEventEmitter.addListener(
|
|
1256
|
+
this.id,
|
|
1257
|
+
HMSUpdateListenerActions.RECONNECTING,
|
|
1258
|
+
this.reconnectingListener
|
|
1259
|
+
);
|
|
1260
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTING] =
|
|
1261
|
+
reconnectingSubscription;
|
|
1262
|
+
}
|
|
1263
|
+
// Adding App Delegate listener
|
|
1331
1264
|
this.onReconnectingDelegate = callback;
|
|
1332
1265
|
break;
|
|
1333
|
-
|
|
1266
|
+
}
|
|
1267
|
+
case HMSUpdateListenerActions.RECONNECTED: {
|
|
1268
|
+
// Checking if we already have RECONNECTED subscription
|
|
1269
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTED]) {
|
|
1270
|
+
// Adding RECONNECTED native listener
|
|
1271
|
+
const reconnectedSubscription = HmsEventEmitter.addListener(
|
|
1272
|
+
this.id,
|
|
1273
|
+
HMSUpdateListenerActions.RECONNECTED,
|
|
1274
|
+
this.reconnectedListener
|
|
1275
|
+
);
|
|
1276
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTED] =
|
|
1277
|
+
reconnectedSubscription;
|
|
1278
|
+
}
|
|
1279
|
+
// Adding App Delegate listener
|
|
1334
1280
|
this.onReconnectedDelegate = callback;
|
|
1335
1281
|
break;
|
|
1336
|
-
|
|
1282
|
+
}
|
|
1283
|
+
case HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST: {
|
|
1284
|
+
// Checking if we already have ON_ROLE_CHANGE_REQUEST subscription
|
|
1285
|
+
if (
|
|
1286
|
+
!this.emitterSubscriptions[
|
|
1287
|
+
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST
|
|
1288
|
+
]
|
|
1289
|
+
) {
|
|
1290
|
+
// Adding ON_ROLE_CHANGE_REQUEST native listener
|
|
1291
|
+
const roleChangeReqSubscription = HmsEventEmitter.addListener(
|
|
1292
|
+
this.id,
|
|
1293
|
+
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST,
|
|
1294
|
+
this.onRoleChangeRequestListener
|
|
1295
|
+
);
|
|
1296
|
+
this.emitterSubscriptions[
|
|
1297
|
+
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST
|
|
1298
|
+
] = roleChangeReqSubscription;
|
|
1299
|
+
}
|
|
1300
|
+
// Adding App Delegate listener
|
|
1337
1301
|
this.onRoleChangeRequestDelegate = callback;
|
|
1338
1302
|
break;
|
|
1339
|
-
|
|
1303
|
+
}
|
|
1304
|
+
case HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST: {
|
|
1305
|
+
// Checking if we already have ON_CHANGE_TRACK_STATE_REQUEST subscription
|
|
1306
|
+
if (
|
|
1307
|
+
!this.emitterSubscriptions[
|
|
1308
|
+
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST
|
|
1309
|
+
]
|
|
1310
|
+
) {
|
|
1311
|
+
// Adding ON_CHANGE_TRACK_STATE_REQUEST native listener
|
|
1312
|
+
const changeTrackReqSubscription = HmsEventEmitter.addListener(
|
|
1313
|
+
this.id,
|
|
1314
|
+
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST,
|
|
1315
|
+
this.onChangeTrackStateRequestListener
|
|
1316
|
+
);
|
|
1317
|
+
this.emitterSubscriptions[
|
|
1318
|
+
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST
|
|
1319
|
+
] = changeTrackReqSubscription;
|
|
1320
|
+
}
|
|
1321
|
+
// Adding App Delegate listener
|
|
1340
1322
|
this.onChangeTrackStateRequestDelegate = callback;
|
|
1341
1323
|
break;
|
|
1342
|
-
|
|
1324
|
+
}
|
|
1325
|
+
case HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM: {
|
|
1326
|
+
// Checking if we already have ON_REMOVED_FROM_ROOM subscription
|
|
1327
|
+
if (
|
|
1328
|
+
!this.emitterSubscriptions[
|
|
1329
|
+
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM
|
|
1330
|
+
]
|
|
1331
|
+
) {
|
|
1332
|
+
// Adding ON_REMOVED_FROM_ROOM native listener
|
|
1333
|
+
const removedFromRoomSubscription = HmsEventEmitter.addListener(
|
|
1334
|
+
this.id,
|
|
1335
|
+
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM,
|
|
1336
|
+
this.onRemovedFromRoomListener
|
|
1337
|
+
);
|
|
1338
|
+
this.emitterSubscriptions[
|
|
1339
|
+
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM
|
|
1340
|
+
] = removedFromRoomSubscription;
|
|
1341
|
+
}
|
|
1342
|
+
// Adding App Delegate listener
|
|
1343
1343
|
this.onRemovedFromRoomDelegate = callback;
|
|
1344
1344
|
break;
|
|
1345
|
-
|
|
1345
|
+
}
|
|
1346
|
+
case HMSUpdateListenerActions.ON_RTC_STATS: {
|
|
1347
|
+
// Checking if we already have ON_RTC_STATS subscription
|
|
1348
|
+
if (!this.emitterSubscriptions[HMSUpdateListenerActions.ON_RTC_STATS]) {
|
|
1349
|
+
// Adding ON_RTC_STATS native listener
|
|
1350
|
+
const rtcStatsSubscription = HmsEventEmitter.addListener(
|
|
1351
|
+
this.id,
|
|
1352
|
+
HMSUpdateListenerActions.ON_RTC_STATS,
|
|
1353
|
+
this.RTCStatsListener
|
|
1354
|
+
);
|
|
1355
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_RTC_STATS] =
|
|
1356
|
+
rtcStatsSubscription;
|
|
1357
|
+
}
|
|
1358
|
+
// Adding App Delegate listener
|
|
1346
1359
|
this.onRtcStatsDelegate = callback;
|
|
1347
1360
|
break;
|
|
1348
|
-
|
|
1361
|
+
}
|
|
1362
|
+
case HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS: {
|
|
1363
|
+
// Checking if we already have ON_LOCAL_AUDIO_STATS subscription
|
|
1364
|
+
if (
|
|
1365
|
+
!this.emitterSubscriptions[
|
|
1366
|
+
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS
|
|
1367
|
+
]
|
|
1368
|
+
) {
|
|
1369
|
+
// Adding ON_LOCAL_AUDIO_STATS native listener
|
|
1370
|
+
const lclAudioStatsSubscription = HmsEventEmitter.addListener(
|
|
1371
|
+
this.id,
|
|
1372
|
+
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS,
|
|
1373
|
+
this.onLocalAudioStatsListener
|
|
1374
|
+
);
|
|
1375
|
+
this.emitterSubscriptions[
|
|
1376
|
+
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS
|
|
1377
|
+
] = lclAudioStatsSubscription;
|
|
1378
|
+
}
|
|
1379
|
+
// Adding App Delegate listener
|
|
1349
1380
|
this.onLocalAudioStatsDelegate = callback;
|
|
1350
1381
|
break;
|
|
1351
|
-
|
|
1382
|
+
}
|
|
1383
|
+
case HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS: {
|
|
1384
|
+
// Checking if we already have ON_LOCAL_VIDEO_STATS subscription
|
|
1385
|
+
if (
|
|
1386
|
+
!this.emitterSubscriptions[
|
|
1387
|
+
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS
|
|
1388
|
+
]
|
|
1389
|
+
) {
|
|
1390
|
+
// Adding ON_LOCAL_VIDEO_STATS native listener
|
|
1391
|
+
const lclVideoStatsSubscription = HmsEventEmitter.addListener(
|
|
1392
|
+
this.id,
|
|
1393
|
+
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS,
|
|
1394
|
+
this.onLocalVideoStatsListener
|
|
1395
|
+
);
|
|
1396
|
+
this.emitterSubscriptions[
|
|
1397
|
+
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS
|
|
1398
|
+
] = lclVideoStatsSubscription;
|
|
1399
|
+
}
|
|
1400
|
+
// Adding App Delegate listener
|
|
1352
1401
|
this.onLocalVideoStatsDelegate = callback;
|
|
1353
1402
|
break;
|
|
1354
|
-
|
|
1403
|
+
}
|
|
1404
|
+
case HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS: {
|
|
1405
|
+
// Checking if we already have ON_REMOTE_AUDIO_STATS subscription
|
|
1406
|
+
if (
|
|
1407
|
+
!this.emitterSubscriptions[
|
|
1408
|
+
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS
|
|
1409
|
+
]
|
|
1410
|
+
) {
|
|
1411
|
+
// Adding ON_REMOTE_AUDIO_STATS native listener
|
|
1412
|
+
const rmAudioStatsSubscription = HmsEventEmitter.addListener(
|
|
1413
|
+
this.id,
|
|
1414
|
+
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS,
|
|
1415
|
+
this.onRemoteAudioStatsListener
|
|
1416
|
+
);
|
|
1417
|
+
this.emitterSubscriptions[
|
|
1418
|
+
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS
|
|
1419
|
+
] = rmAudioStatsSubscription;
|
|
1420
|
+
}
|
|
1421
|
+
// Adding App Delegate listener
|
|
1355
1422
|
this.onRemoteAudioStatsDelegate = callback;
|
|
1356
1423
|
break;
|
|
1357
|
-
|
|
1424
|
+
}
|
|
1425
|
+
case HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS: {
|
|
1426
|
+
// Checking if we already have ON_REMOTE_VIDEO_STATS subscription
|
|
1427
|
+
if (
|
|
1428
|
+
!this.emitterSubscriptions[
|
|
1429
|
+
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS
|
|
1430
|
+
]
|
|
1431
|
+
) {
|
|
1432
|
+
// Adding ON_REMOTE_VIDEO_STATS native listener
|
|
1433
|
+
const rmVideoStatsSubscription = HmsEventEmitter.addListener(
|
|
1434
|
+
this.id,
|
|
1435
|
+
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS,
|
|
1436
|
+
this.onRemoteVideoStatsListener
|
|
1437
|
+
);
|
|
1438
|
+
this.emitterSubscriptions[
|
|
1439
|
+
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS
|
|
1440
|
+
] = rmVideoStatsSubscription;
|
|
1441
|
+
}
|
|
1442
|
+
// Adding App Delegate listener
|
|
1358
1443
|
this.onRemoteVideoStatsDelegate = callback;
|
|
1359
1444
|
break;
|
|
1360
|
-
|
|
1445
|
+
}
|
|
1446
|
+
case HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED: {
|
|
1447
|
+
// Checking if we already have ON_AUDIO_DEVICE_CHANGED subscription
|
|
1448
|
+
if (
|
|
1449
|
+
!this.emitterSubscriptions[
|
|
1450
|
+
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED
|
|
1451
|
+
]
|
|
1452
|
+
) {
|
|
1453
|
+
// Adding ON_AUDIO_DEVICE_CHANGED native listener
|
|
1454
|
+
const audDeviceChgSubscription = HmsEventEmitter.addListener(
|
|
1455
|
+
this.id,
|
|
1456
|
+
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED,
|
|
1457
|
+
this.onAudioDeviceChangedListener
|
|
1458
|
+
);
|
|
1459
|
+
this.emitterSubscriptions[
|
|
1460
|
+
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED
|
|
1461
|
+
] = audDeviceChgSubscription;
|
|
1462
|
+
}
|
|
1463
|
+
// Adding App Delegate listener
|
|
1361
1464
|
this.onAudioDeviceChangedDelegate = callback;
|
|
1362
1465
|
break;
|
|
1363
|
-
|
|
1364
|
-
|
|
1466
|
+
}
|
|
1467
|
+
case HMSPIPListenerActions.ON_PIP_ROOM_LEAVE: {
|
|
1468
|
+
if (Platform.OS === 'android') {
|
|
1469
|
+
// Checking if we already have ON_PIP_ROOM_LEAVE subscription
|
|
1470
|
+
if (
|
|
1471
|
+
!this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_ROOM_LEAVE]
|
|
1472
|
+
) {
|
|
1473
|
+
// Adding ON_PIP_ROOM_LEAVE native listener
|
|
1474
|
+
const pipRoomLeaveSubscription = HmsEventEmitter.addListener(
|
|
1475
|
+
this.id,
|
|
1476
|
+
HMSPIPListenerActions.ON_PIP_ROOM_LEAVE,
|
|
1477
|
+
this.onPIPRoomLeaveListener
|
|
1478
|
+
);
|
|
1479
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_ROOM_LEAVE] =
|
|
1480
|
+
pipRoomLeaveSubscription;
|
|
1481
|
+
}
|
|
1482
|
+
// Adding App Delegate listener
|
|
1483
|
+
this.onPIPRoomLeaveDelegate = callback;
|
|
1484
|
+
}
|
|
1365
1485
|
break;
|
|
1486
|
+
}
|
|
1366
1487
|
default:
|
|
1367
1488
|
}
|
|
1368
1489
|
};
|
|
@@ -1379,66 +1500,312 @@ export class HMSSDK {
|
|
|
1379
1500
|
) => {
|
|
1380
1501
|
logger?.verbose('#Function removeEventListener', { action, id: this.id });
|
|
1381
1502
|
switch (action) {
|
|
1382
|
-
case HMSUpdateListenerActions.ON_PREVIEW:
|
|
1503
|
+
case HMSUpdateListenerActions.ON_PREVIEW: {
|
|
1504
|
+
const subscription =
|
|
1505
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PREVIEW];
|
|
1506
|
+
// Removing ON_PREVIEW native listener
|
|
1507
|
+
if (subscription) {
|
|
1508
|
+
subscription.remove();
|
|
1509
|
+
|
|
1510
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PREVIEW] =
|
|
1511
|
+
undefined;
|
|
1512
|
+
}
|
|
1513
|
+
// Removing App Delegate listener
|
|
1383
1514
|
this.onPreviewDelegate = null;
|
|
1384
1515
|
break;
|
|
1385
|
-
|
|
1516
|
+
}
|
|
1517
|
+
case HMSUpdateListenerActions.ON_JOIN: {
|
|
1518
|
+
const subscription =
|
|
1519
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_JOIN];
|
|
1520
|
+
// Removing ON_JOIN native listener
|
|
1521
|
+
if (subscription) {
|
|
1522
|
+
subscription.remove();
|
|
1523
|
+
|
|
1524
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_JOIN] =
|
|
1525
|
+
undefined;
|
|
1526
|
+
}
|
|
1527
|
+
// Removing App Delegate listener
|
|
1386
1528
|
this.onJoinDelegate = null;
|
|
1387
1529
|
break;
|
|
1388
|
-
|
|
1530
|
+
}
|
|
1531
|
+
case HMSUpdateListenerActions.ON_ROOM_UPDATE: {
|
|
1532
|
+
const subscription =
|
|
1533
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ROOM_UPDATE];
|
|
1534
|
+
// Removing ON_ROOM_UPDATE native listener
|
|
1535
|
+
if (subscription) {
|
|
1536
|
+
subscription.remove();
|
|
1537
|
+
|
|
1538
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ROOM_UPDATE] =
|
|
1539
|
+
undefined;
|
|
1540
|
+
}
|
|
1541
|
+
// Removing App Delegate listener
|
|
1389
1542
|
this.onRoomDelegate = null;
|
|
1390
1543
|
break;
|
|
1391
|
-
|
|
1544
|
+
}
|
|
1545
|
+
case HMSUpdateListenerActions.ON_PEER_UPDATE: {
|
|
1546
|
+
const subscription =
|
|
1547
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PEER_UPDATE];
|
|
1548
|
+
// Removing ON_PEER_UPDATE native listener
|
|
1549
|
+
if (subscription) {
|
|
1550
|
+
subscription.remove();
|
|
1551
|
+
|
|
1552
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_PEER_UPDATE] =
|
|
1553
|
+
undefined;
|
|
1554
|
+
}
|
|
1555
|
+
// Removing App Delegate listener
|
|
1392
1556
|
this.onPeerDelegate = null;
|
|
1393
1557
|
break;
|
|
1394
|
-
|
|
1558
|
+
}
|
|
1559
|
+
case HMSUpdateListenerActions.ON_TRACK_UPDATE: {
|
|
1560
|
+
const subscription =
|
|
1561
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_TRACK_UPDATE];
|
|
1562
|
+
// Removing ON_TRACK_UPDATE native listener
|
|
1563
|
+
if (subscription) {
|
|
1564
|
+
subscription.remove();
|
|
1565
|
+
|
|
1566
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_TRACK_UPDATE] =
|
|
1567
|
+
undefined;
|
|
1568
|
+
}
|
|
1569
|
+
// Removing App Delegate listener
|
|
1395
1570
|
this.onTrackDelegate = null;
|
|
1396
1571
|
break;
|
|
1397
|
-
|
|
1572
|
+
}
|
|
1573
|
+
case HMSUpdateListenerActions.ON_ERROR: {
|
|
1574
|
+
const subscription =
|
|
1575
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ERROR];
|
|
1576
|
+
// Removing ON_ERROR native listener
|
|
1577
|
+
if (subscription) {
|
|
1578
|
+
subscription.remove();
|
|
1579
|
+
|
|
1580
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_ERROR] =
|
|
1581
|
+
undefined;
|
|
1582
|
+
}
|
|
1583
|
+
// Removing App Delegate listener
|
|
1398
1584
|
this.onErrorDelegate = null;
|
|
1399
1585
|
break;
|
|
1400
|
-
|
|
1586
|
+
}
|
|
1587
|
+
case HMSUpdateListenerActions.ON_MESSAGE: {
|
|
1588
|
+
const subscription =
|
|
1589
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_MESSAGE];
|
|
1590
|
+
// Removing ON_MESSAGE native listener
|
|
1591
|
+
if (subscription) {
|
|
1592
|
+
subscription.remove();
|
|
1593
|
+
|
|
1594
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_MESSAGE] =
|
|
1595
|
+
undefined;
|
|
1596
|
+
}
|
|
1597
|
+
// Removing App Delegate listener
|
|
1401
1598
|
this.onMessageDelegate = null;
|
|
1402
1599
|
break;
|
|
1403
|
-
|
|
1600
|
+
}
|
|
1601
|
+
case HMSUpdateListenerActions.ON_SPEAKER: {
|
|
1602
|
+
const subscription =
|
|
1603
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_SPEAKER];
|
|
1604
|
+
// Removing ON_SPEAKER native listener
|
|
1605
|
+
if (subscription) {
|
|
1606
|
+
subscription.remove();
|
|
1607
|
+
|
|
1608
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_SPEAKER] =
|
|
1609
|
+
undefined;
|
|
1610
|
+
}
|
|
1611
|
+
// Removing App Delegate listener
|
|
1404
1612
|
this.onSpeakerDelegate = null;
|
|
1405
1613
|
break;
|
|
1406
|
-
|
|
1614
|
+
}
|
|
1615
|
+
case HMSUpdateListenerActions.RECONNECTING: {
|
|
1616
|
+
const subscription =
|
|
1617
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTING];
|
|
1618
|
+
// Removing RECONNECTING native listener
|
|
1619
|
+
if (subscription) {
|
|
1620
|
+
subscription.remove();
|
|
1621
|
+
|
|
1622
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTING] =
|
|
1623
|
+
undefined;
|
|
1624
|
+
}
|
|
1625
|
+
// Removing App Delegate listener
|
|
1407
1626
|
this.onReconnectingDelegate = null;
|
|
1408
1627
|
break;
|
|
1409
|
-
|
|
1628
|
+
}
|
|
1629
|
+
case HMSUpdateListenerActions.RECONNECTED: {
|
|
1630
|
+
const subscription =
|
|
1631
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTED];
|
|
1632
|
+
// Removing RECONNECTED native listener
|
|
1633
|
+
if (subscription) {
|
|
1634
|
+
subscription.remove();
|
|
1635
|
+
|
|
1636
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.RECONNECTED] =
|
|
1637
|
+
undefined;
|
|
1638
|
+
}
|
|
1639
|
+
// Removing App Delegate listener
|
|
1410
1640
|
this.onReconnectedDelegate = null;
|
|
1411
1641
|
break;
|
|
1412
|
-
|
|
1642
|
+
}
|
|
1643
|
+
case HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST: {
|
|
1644
|
+
const subscription =
|
|
1645
|
+
this.emitterSubscriptions[
|
|
1646
|
+
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST
|
|
1647
|
+
];
|
|
1648
|
+
// Removing ON_ROLE_CHANGE_REQUEST native listener
|
|
1649
|
+
if (subscription) {
|
|
1650
|
+
subscription.remove();
|
|
1651
|
+
|
|
1652
|
+
this.emitterSubscriptions[
|
|
1653
|
+
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST
|
|
1654
|
+
] = undefined;
|
|
1655
|
+
}
|
|
1656
|
+
// Removing App Delegate listener
|
|
1413
1657
|
this.onRoleChangeRequestDelegate = null;
|
|
1414
1658
|
break;
|
|
1415
|
-
|
|
1659
|
+
}
|
|
1660
|
+
case HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST: {
|
|
1661
|
+
const subscription =
|
|
1662
|
+
this.emitterSubscriptions[
|
|
1663
|
+
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST
|
|
1664
|
+
];
|
|
1665
|
+
// Removing ON_CHANGE_TRACK_STATE_REQUEST native listener
|
|
1666
|
+
if (subscription) {
|
|
1667
|
+
subscription.remove();
|
|
1668
|
+
|
|
1669
|
+
this.emitterSubscriptions[
|
|
1670
|
+
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST
|
|
1671
|
+
] = undefined;
|
|
1672
|
+
}
|
|
1673
|
+
// Removing App Delegate listener
|
|
1416
1674
|
this.onChangeTrackStateRequestDelegate = null;
|
|
1417
1675
|
break;
|
|
1418
|
-
|
|
1676
|
+
}
|
|
1677
|
+
case HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM: {
|
|
1678
|
+
const subscription =
|
|
1679
|
+
this.emitterSubscriptions[
|
|
1680
|
+
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM
|
|
1681
|
+
];
|
|
1682
|
+
// Removing ON_REMOVED_FROM_ROOM native listener
|
|
1683
|
+
if (subscription) {
|
|
1684
|
+
subscription.remove();
|
|
1685
|
+
|
|
1686
|
+
this.emitterSubscriptions[
|
|
1687
|
+
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM
|
|
1688
|
+
] = undefined;
|
|
1689
|
+
}
|
|
1690
|
+
// Removing App Delegate listener
|
|
1419
1691
|
this.onRemovedFromRoomDelegate = null;
|
|
1420
1692
|
break;
|
|
1421
|
-
|
|
1693
|
+
}
|
|
1694
|
+
case HMSUpdateListenerActions.ON_RTC_STATS: {
|
|
1695
|
+
const subscription =
|
|
1696
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_RTC_STATS];
|
|
1697
|
+
// Removing ON_RTC_STATS native listener
|
|
1698
|
+
if (subscription) {
|
|
1699
|
+
subscription.remove();
|
|
1700
|
+
|
|
1701
|
+
this.emitterSubscriptions[HMSUpdateListenerActions.ON_RTC_STATS] =
|
|
1702
|
+
undefined;
|
|
1703
|
+
}
|
|
1704
|
+
// Removing App Delegate listener
|
|
1422
1705
|
this.onRtcStatsDelegate = null;
|
|
1423
1706
|
break;
|
|
1424
|
-
|
|
1707
|
+
}
|
|
1708
|
+
case HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS: {
|
|
1709
|
+
const subscription =
|
|
1710
|
+
this.emitterSubscriptions[
|
|
1711
|
+
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS
|
|
1712
|
+
];
|
|
1713
|
+
// Removing ON_LOCAL_AUDIO_STATS native listener
|
|
1714
|
+
if (subscription) {
|
|
1715
|
+
subscription.remove();
|
|
1716
|
+
|
|
1717
|
+
this.emitterSubscriptions[
|
|
1718
|
+
HMSUpdateListenerActions.ON_LOCAL_AUDIO_STATS
|
|
1719
|
+
] = undefined;
|
|
1720
|
+
}
|
|
1721
|
+
// Removing App Delegate listener
|
|
1425
1722
|
this.onLocalAudioStatsDelegate = null;
|
|
1426
1723
|
break;
|
|
1427
|
-
|
|
1724
|
+
}
|
|
1725
|
+
case HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS: {
|
|
1726
|
+
const subscription =
|
|
1727
|
+
this.emitterSubscriptions[
|
|
1728
|
+
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS
|
|
1729
|
+
];
|
|
1730
|
+
// Removing ON_LOCAL_VIDEO_STATS native listener
|
|
1731
|
+
if (subscription) {
|
|
1732
|
+
subscription.remove();
|
|
1733
|
+
|
|
1734
|
+
this.emitterSubscriptions[
|
|
1735
|
+
HMSUpdateListenerActions.ON_LOCAL_VIDEO_STATS
|
|
1736
|
+
] = undefined;
|
|
1737
|
+
}
|
|
1738
|
+
// Removing App Delegate listener
|
|
1428
1739
|
this.onLocalVideoStatsDelegate = null;
|
|
1429
1740
|
break;
|
|
1430
|
-
|
|
1741
|
+
}
|
|
1742
|
+
case HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS: {
|
|
1743
|
+
const subscription =
|
|
1744
|
+
this.emitterSubscriptions[
|
|
1745
|
+
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS
|
|
1746
|
+
];
|
|
1747
|
+
// Removing ON_REMOTE_AUDIO_STATS native listener
|
|
1748
|
+
if (subscription) {
|
|
1749
|
+
subscription.remove();
|
|
1750
|
+
|
|
1751
|
+
this.emitterSubscriptions[
|
|
1752
|
+
HMSUpdateListenerActions.ON_REMOTE_AUDIO_STATS
|
|
1753
|
+
] = undefined;
|
|
1754
|
+
}
|
|
1755
|
+
// Removing App Delegate listener
|
|
1431
1756
|
this.onRemoteAudioStatsDelegate = null;
|
|
1432
1757
|
break;
|
|
1433
|
-
|
|
1758
|
+
}
|
|
1759
|
+
case HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS: {
|
|
1760
|
+
const subscription =
|
|
1761
|
+
this.emitterSubscriptions[
|
|
1762
|
+
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS
|
|
1763
|
+
];
|
|
1764
|
+
// Removing ON_REMOTE_VIDEO_STATS native listener
|
|
1765
|
+
if (subscription) {
|
|
1766
|
+
subscription.remove();
|
|
1767
|
+
|
|
1768
|
+
this.emitterSubscriptions[
|
|
1769
|
+
HMSUpdateListenerActions.ON_REMOTE_VIDEO_STATS
|
|
1770
|
+
] = undefined;
|
|
1771
|
+
}
|
|
1772
|
+
// Removing App Delegate listener
|
|
1434
1773
|
this.onRemoteVideoStatsDelegate = null;
|
|
1435
1774
|
break;
|
|
1436
|
-
|
|
1775
|
+
}
|
|
1776
|
+
case HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED: {
|
|
1777
|
+
const subscription =
|
|
1778
|
+
this.emitterSubscriptions[
|
|
1779
|
+
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED
|
|
1780
|
+
];
|
|
1781
|
+
// Removing ON_AUDIO_DEVICE_CHANGED native listener
|
|
1782
|
+
if (subscription) {
|
|
1783
|
+
subscription.remove();
|
|
1784
|
+
|
|
1785
|
+
this.emitterSubscriptions[
|
|
1786
|
+
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED
|
|
1787
|
+
] = undefined;
|
|
1788
|
+
}
|
|
1789
|
+
// Removing App Delegate listener
|
|
1437
1790
|
this.onAudioDeviceChangedDelegate = null;
|
|
1438
1791
|
break;
|
|
1439
|
-
|
|
1440
|
-
|
|
1792
|
+
}
|
|
1793
|
+
case HMSPIPListenerActions.ON_PIP_ROOM_LEAVE: {
|
|
1794
|
+
if (Platform.OS === 'android') {
|
|
1795
|
+
const subscription =
|
|
1796
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_ROOM_LEAVE];
|
|
1797
|
+
// Removing ON_PIP_ROOM_LEAVE native listener
|
|
1798
|
+
if (subscription) {
|
|
1799
|
+
subscription.remove();
|
|
1800
|
+
|
|
1801
|
+
this.emitterSubscriptions[HMSPIPListenerActions.ON_PIP_ROOM_LEAVE] =
|
|
1802
|
+
undefined;
|
|
1803
|
+
}
|
|
1804
|
+
// Removing App Delegate listener
|
|
1805
|
+
this.onPIPRoomLeaveDelegate = null;
|
|
1806
|
+
}
|
|
1441
1807
|
break;
|
|
1808
|
+
}
|
|
1442
1809
|
default:
|
|
1443
1810
|
}
|
|
1444
1811
|
};
|
|
@@ -1464,6 +1831,16 @@ export class HMSSDK {
|
|
|
1464
1831
|
this.onRemovedFromRoomDelegate = null;
|
|
1465
1832
|
this.onPIPRoomLeaveDelegate = null;
|
|
1466
1833
|
|
|
1834
|
+
// Getting list of all available `emitterSubscription` objects
|
|
1835
|
+
Object.values(this.emitterSubscriptions)
|
|
1836
|
+
.filter(Boolean)
|
|
1837
|
+
.forEach((emitterSubscription) => {
|
|
1838
|
+
emitterSubscription.remove();
|
|
1839
|
+
});
|
|
1840
|
+
|
|
1841
|
+
// clearing reference of all `emitterSubscription` objects
|
|
1842
|
+
this.emitterSubscriptions = {};
|
|
1843
|
+
|
|
1467
1844
|
logger?.verbose('#Function REMOVE_ALL_LISTENER', { id: this.id });
|
|
1468
1845
|
};
|
|
1469
1846
|
|
|
@@ -1523,6 +1900,8 @@ export class HMSSDK {
|
|
|
1523
1900
|
const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room, this.id);
|
|
1524
1901
|
const type = data.type;
|
|
1525
1902
|
|
|
1903
|
+
getHmsRoomCache()?.updateRoomCache(data.room, data.type);
|
|
1904
|
+
|
|
1526
1905
|
if (this.onRoomDelegate) {
|
|
1527
1906
|
logger?.verbose('#Listener ON_ROOM_LISTENER_CALL', {
|
|
1528
1907
|
room,
|
|
@@ -1532,12 +1911,24 @@ export class HMSSDK {
|
|
|
1532
1911
|
}
|
|
1533
1912
|
};
|
|
1534
1913
|
|
|
1535
|
-
onPeerListener = (
|
|
1536
|
-
|
|
1537
|
-
|
|
1914
|
+
onPeerListener = (peerData: any) => {
|
|
1915
|
+
const data: { peer: any; type: any } = {
|
|
1916
|
+
peer: peerData,
|
|
1917
|
+
type: null,
|
|
1918
|
+
};
|
|
1919
|
+
|
|
1920
|
+
for (const ordinal of HMSPeerUpdateOrdinals.keys()) {
|
|
1921
|
+
if (ordinal in peerData) {
|
|
1922
|
+
data.peer.peerID = peerData[ordinal];
|
|
1923
|
+
data.type = ordinal;
|
|
1924
|
+
break;
|
|
1925
|
+
}
|
|
1538
1926
|
}
|
|
1539
|
-
|
|
1540
|
-
const
|
|
1927
|
+
|
|
1928
|
+
const peer: HMSPeer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
1929
|
+
const type = HMSEncoder.encodeHmsPeerUpdate(data.type) || data.type;
|
|
1930
|
+
|
|
1931
|
+
getHmsPeersCache()?.updatePeerCache(data.peer.peerID, data.peer, type);
|
|
1541
1932
|
|
|
1542
1933
|
if (this.onPeerDelegate) {
|
|
1543
1934
|
logger?.verbose('#Listener ON_PEER_LISTENER_CALL', {
|
|
@@ -1553,9 +1944,11 @@ export class HMSSDK {
|
|
|
1553
1944
|
return;
|
|
1554
1945
|
}
|
|
1555
1946
|
const track: HMSTrack = HMSEncoder.encodeHmsTrack(data.track, this.id);
|
|
1556
|
-
const peer: HMSPeer = HMSEncoder.encodeHmsPeer(data.peer
|
|
1947
|
+
const peer: HMSPeer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
1557
1948
|
const type = data.type;
|
|
1558
1949
|
|
|
1950
|
+
getHmsPeersCache()?.updatePeerCache(data.peer.peerID, { track }, data.type);
|
|
1951
|
+
|
|
1559
1952
|
if (
|
|
1560
1953
|
this.muteStatus &&
|
|
1561
1954
|
data?.type === 'TRACK_ADDED' &&
|
|
@@ -1582,7 +1975,7 @@ export class HMSSDK {
|
|
|
1582
1975
|
if (data.id !== this.id) {
|
|
1583
1976
|
return;
|
|
1584
1977
|
}
|
|
1585
|
-
const message = HMSEncoder.encodeHMSMessage(data
|
|
1978
|
+
const message = HMSEncoder.encodeHMSMessage(data);
|
|
1586
1979
|
if (this.onMessageDelegate) {
|
|
1587
1980
|
logger?.verbose('#Listener ON_MESSAGE_LISTENER_CALL', message);
|
|
1588
1981
|
this.onMessageDelegate(message);
|
|
@@ -1617,10 +2010,8 @@ export class HMSSDK {
|
|
|
1617
2010
|
return;
|
|
1618
2011
|
}
|
|
1619
2012
|
if (this.onRoleChangeRequestDelegate) {
|
|
1620
|
-
const encodedRoleChangeRequest =
|
|
1621
|
-
data
|
|
1622
|
-
this.id
|
|
1623
|
-
);
|
|
2013
|
+
const encodedRoleChangeRequest =
|
|
2014
|
+
HMSEncoder.encodeHmsRoleChangeRequest(data);
|
|
1624
2015
|
logger?.verbose(
|
|
1625
2016
|
'#Listener ON_ROLE_CHANGE_LISTENER_CALL',
|
|
1626
2017
|
encodedRoleChangeRequest
|
|
@@ -1635,7 +2026,7 @@ export class HMSSDK {
|
|
|
1635
2026
|
}
|
|
1636
2027
|
if (this.onChangeTrackStateRequestDelegate) {
|
|
1637
2028
|
const encodedRoleChangeRequest =
|
|
1638
|
-
HMSEncoder.encodeHmsChangeTrackStateRequest(data
|
|
2029
|
+
HMSEncoder.encodeHmsChangeTrackStateRequest(data);
|
|
1639
2030
|
logger?.verbose(
|
|
1640
2031
|
'#Listener ON_CHANGE_TRACK_STATE_REQUEST_LISTENER_CALL',
|
|
1641
2032
|
encodedRoleChangeRequest
|
|
@@ -1648,10 +2039,12 @@ export class HMSSDK {
|
|
|
1648
2039
|
if (data.id !== this.id) {
|
|
1649
2040
|
return;
|
|
1650
2041
|
}
|
|
2042
|
+
this.roomLeaveCleanup();
|
|
2043
|
+
|
|
1651
2044
|
if (this.onRemovedFromRoomDelegate) {
|
|
1652
2045
|
let requestedBy = null;
|
|
1653
2046
|
if (data.requestedBy) {
|
|
1654
|
-
requestedBy = HMSEncoder.encodeHmsPeer(data.requestedBy
|
|
2047
|
+
requestedBy = HMSEncoder.encodeHmsPeer(data.requestedBy);
|
|
1655
2048
|
}
|
|
1656
2049
|
const reason = data.reason;
|
|
1657
2050
|
const roomEnded = data.roomEnded;
|
|
@@ -1705,7 +2098,7 @@ export class HMSSDK {
|
|
|
1705
2098
|
}
|
|
1706
2099
|
|
|
1707
2100
|
let localAudioStats = new HMSLocalAudioStats(data.localAudioStats);
|
|
1708
|
-
let peer = HMSEncoder.encodeHmsPeer(data.peer
|
|
2101
|
+
let peer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
1709
2102
|
let track = HMSEncoder.encodeHmsLocalAudioTrack(data.track, this.id);
|
|
1710
2103
|
|
|
1711
2104
|
if (this.onLocalAudioStatsDelegate) {
|
|
@@ -1725,7 +2118,7 @@ export class HMSSDK {
|
|
|
1725
2118
|
}
|
|
1726
2119
|
|
|
1727
2120
|
let localVideoStats = new HMSLocalVideoStats(data.localVideoStats);
|
|
1728
|
-
let peer = HMSEncoder.encodeHmsPeer(data.peer
|
|
2121
|
+
let peer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
1729
2122
|
let track = HMSEncoder.encodeHmsLocalVideoTrack(data.track, this.id);
|
|
1730
2123
|
|
|
1731
2124
|
if (this.onLocalVideoStatsDelegate) {
|
|
@@ -1745,7 +2138,7 @@ export class HMSSDK {
|
|
|
1745
2138
|
}
|
|
1746
2139
|
|
|
1747
2140
|
let remoteAudioStats = new HMSRemoteAudioStats(data.remoteAudioStats);
|
|
1748
|
-
let peer = HMSEncoder.encodeHmsPeer(data.peer
|
|
2141
|
+
let peer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
1749
2142
|
let track = HMSEncoder.encodeHmsRemoteAudioTrack(data.track, this.id);
|
|
1750
2143
|
|
|
1751
2144
|
if (this.onRemoteAudioStatsDelegate) {
|
|
@@ -1770,7 +2163,7 @@ export class HMSSDK {
|
|
|
1770
2163
|
}
|
|
1771
2164
|
|
|
1772
2165
|
let remoteVideoStats = new HMSRemoteVideoStats(data.remoteVideoStats);
|
|
1773
|
-
let peer = HMSEncoder.encodeHmsPeer(data.peer
|
|
2166
|
+
let peer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
1774
2167
|
let track = HMSEncoder.encodeHmsRemoteVideoTrack(data.track, this.id);
|
|
1775
2168
|
|
|
1776
2169
|
if (this.onRemoteVideoStatsDelegate) {
|
|
@@ -1809,8 +2202,8 @@ export class HMSSDK {
|
|
|
1809
2202
|
if (data.id !== this.id) {
|
|
1810
2203
|
return;
|
|
1811
2204
|
}
|
|
1812
|
-
|
|
1813
|
-
this
|
|
2205
|
+
|
|
2206
|
+
this.roomLeaveCleanup();
|
|
1814
2207
|
|
|
1815
2208
|
if (this.onPIPRoomLeaveDelegate) {
|
|
1816
2209
|
logger?.verbose('#Listener onPIPRoomLeave_CALL', data);
|