@100mslive/react-native-hms 0.7.3 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -39
- 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/.project +34 -0
- package/android/build.gradle +1 -2
- package/android/src/main/java/com/reactnativehmssdk/HmsDecoder.kt +268 -232
- package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +122 -12
- package/android/src/main/java/com/reactnativehmssdk/HmsModule.kt +143 -508
- package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +935 -0
- package/android/src/main/java/com/reactnativehmssdk/HmsView.kt +34 -22
- package/android/src/main/java/com/reactnativehmssdk/HmssdkPackage.kt +1 -2
- package/android/src/main/java/com/reactnativehmssdk/HmssdkViewManager.kt +9 -13
- package/ios/HmsDecoder.swift +168 -33
- package/ios/HmsHelper.swift +121 -1
- package/ios/HmsManager.m +20 -14
- package/ios/HmsManager.swift +122 -394
- package/ios/HmsSDK.swift +784 -0
- package/ios/HmsView.swift +16 -8
- package/lib/commonjs/classes/HMSAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSAudioTrackSettings.js +3 -0
- package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSBrowserRecordingState.js +23 -0
- package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -0
- package/lib/commonjs/classes/HMSCameraFacing.js +14 -0
- package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -0
- package/lib/commonjs/classes/HMSConfig.js +3 -7
- package/lib/commonjs/classes/HMSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSEncoder.js +65 -35
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSException.js +30 -0
- package/lib/commonjs/classes/HMSException.js.map +1 -0
- package/lib/commonjs/classes/HMSHelper.js +2 -2
- package/lib/commonjs/classes/HMSHelper.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalAudioTrack.js +39 -1
- package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalVideoTrack.js +28 -2
- package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLogger.js +28 -1
- package/lib/commonjs/classes/HMSLogger.js.map +1 -1
- package/lib/commonjs/classes/HMSPeer.js +3 -0
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSPeerUpdate.js +1 -0
- package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSPermissions.js +6 -0
- package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
- package/lib/commonjs/classes/HMSRTMPConfig.js +26 -0
- package/lib/commonjs/classes/HMSRTMPConfig.js.map +1 -0
- package/lib/commonjs/classes/HMSRemoteAudioTrack.js +21 -0
- package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteVideoTrack.js +21 -0
- package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSRoom.js +9 -0
- package/lib/commonjs/classes/HMSRoom.js.map +1 -1
- package/lib/commonjs/classes/HMSRtmpStreamingState.js +23 -0
- package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -0
- package/lib/commonjs/classes/HMSSDK.js +419 -151
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSServerRecordingState.js +23 -0
- package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -0
- package/lib/commonjs/classes/HMSTrack.js +8 -18
- package/lib/commonjs/classes/HMSTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackSettings.js +3 -0
- package/lib/commonjs/classes/HMSTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSTrackType.js +14 -0
- package/lib/commonjs/classes/HMSTrackType.js.map +1 -0
- package/lib/commonjs/classes/HMSVideoCodec.js +4 -4
- package/lib/commonjs/classes/HMSVideoCodec.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoResolution.js +23 -0
- package/lib/commonjs/classes/HMSVideoResolution.js.map +1 -0
- package/lib/commonjs/classes/HMSVideoSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrack.js +2 -0
- package/lib/commonjs/classes/HMSVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrackSettings.js +0 -3
- package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HmsView.js +10 -7
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/index.js +112 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/classes/HMSAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSAudioTrackSettings.js +3 -0
- package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSBrowserRecordingState.js +14 -0
- package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -0
- package/lib/module/classes/HMSCameraFacing.js +7 -0
- package/lib/module/classes/HMSCameraFacing.js.map +1 -0
- package/lib/module/classes/HMSConfig.js +3 -7
- package/lib/module/classes/HMSConfig.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +64 -35
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSException.js +21 -0
- package/lib/module/classes/HMSException.js.map +1 -0
- package/lib/module/classes/HMSHelper.js +2 -2
- package/lib/module/classes/HMSHelper.js.map +1 -1
- package/lib/module/classes/HMSLocalAudioTrack.js +37 -2
- package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSLocalPeer.js.map +1 -1
- package/lib/module/classes/HMSLocalVideoTrack.js +25 -2
- package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSLogger.js +28 -1
- package/lib/module/classes/HMSLogger.js.map +1 -1
- package/lib/module/classes/HMSPeer.js +3 -0
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSPeerUpdate.js +1 -0
- package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/module/classes/HMSPermissions.js +6 -0
- package/lib/module/classes/HMSPermissions.js.map +1 -1
- package/lib/module/classes/HMSRTMPConfig.js +17 -0
- package/lib/module/classes/HMSRTMPConfig.js.map +1 -0
- package/lib/module/classes/HMSRemoteAudioTrack.js +18 -0
- package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSRemotePeer.js.map +1 -1
- package/lib/module/classes/HMSRemoteVideoTrack.js +18 -0
- package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSRoom.js +9 -0
- package/lib/module/classes/HMSRoom.js.map +1 -1
- package/lib/module/classes/HMSRtmpStreamingState.js +14 -0
- package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -0
- package/lib/module/classes/HMSSDK.js +408 -151
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSServerRecordingState.js +14 -0
- package/lib/module/classes/HMSServerRecordingState.js.map +1 -0
- package/lib/module/classes/HMSTrack.js +8 -16
- package/lib/module/classes/HMSTrack.js.map +1 -1
- package/lib/module/classes/HMSTrackSettings.js +3 -0
- package/lib/module/classes/HMSTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSTrackType.js +7 -0
- package/lib/module/classes/HMSTrackType.js.map +1 -0
- package/lib/module/classes/HMSVideoCodec.js +4 -4
- package/lib/module/classes/HMSVideoCodec.js.map +1 -1
- package/lib/module/classes/HMSVideoResolution.js +14 -0
- package/lib/module/classes/HMSVideoResolution.js.map +1 -0
- package/lib/module/classes/HMSVideoSettings.js.map +1 -1
- package/lib/module/classes/HMSVideoTrack.js +2 -0
- package/lib/module/classes/HMSVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSVideoTrackSettings.js +0 -3
- package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/module/classes/HmsView.js +10 -7
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/classes/HMSAudioTrack.d.ts +3 -0
- package/lib/typescript/classes/HMSAudioTrackSettings.d.ts +3 -0
- package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +9 -0
- package/lib/typescript/classes/HMSCameraFacing.d.ts +4 -0
- package/lib/typescript/classes/HMSConfig.d.ts +2 -4
- package/lib/typescript/classes/HMSEncoder.d.ts +14 -12
- package/lib/typescript/classes/HMSException.d.ts +22 -0
- package/lib/typescript/classes/HMSLocalAudioTrack.d.ts +5 -0
- package/lib/typescript/classes/HMSLocalPeer.d.ts +6 -0
- package/lib/typescript/classes/HMSLocalVideoTrack.d.ts +4 -0
- package/lib/typescript/classes/HMSLogger.d.ts +11 -4
- package/lib/typescript/classes/HMSPeer.d.ts +2 -0
- package/lib/typescript/classes/HMSPeerUpdate.d.ts +1 -0
- package/lib/typescript/classes/HMSPermissions.d.ts +4 -0
- package/lib/typescript/classes/HMSRTMPConfig.d.ts +10 -0
- package/lib/typescript/classes/HMSRemoteAudioTrack.d.ts +4 -0
- package/lib/typescript/classes/HMSRemotePeer.d.ts +3 -0
- package/lib/typescript/classes/HMSRemoteVideoTrack.d.ts +4 -0
- package/lib/typescript/classes/HMSRoom.d.ts +9 -0
- package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +9 -0
- package/lib/typescript/classes/HMSSDK.d.ts +41 -11
- package/lib/typescript/classes/HMSServerRecordingState.d.ts +9 -0
- package/lib/typescript/classes/HMSTrack.d.ts +6 -1
- package/lib/typescript/classes/HMSTrackSettings.d.ts +2 -0
- package/lib/typescript/classes/HMSTrackType.d.ts +4 -0
- package/lib/typescript/classes/HMSVideoCodec.d.ts +4 -4
- package/lib/typescript/classes/HMSVideoResolution.d.ts +8 -0
- package/lib/typescript/classes/HMSVideoSettings.d.ts +3 -3
- package/lib/typescript/classes/HMSVideoTrack.d.ts +5 -1
- package/lib/typescript/classes/HMSVideoTrackSettings.d.ts +13 -10
- package/lib/typescript/classes/HmsView.d.ts +2 -1
- package/lib/typescript/index.d.ts +8 -0
- package/package.json +1 -1
- package/src/classes/HMSAudioTrack.ts +3 -0
- package/src/classes/HMSAudioTrackSettings.ts +9 -1
- package/src/classes/HMSBrowserRecordingState.ts +11 -0
- package/src/classes/HMSCameraFacing.ts +4 -0
- package/src/classes/HMSConfig.ts +3 -7
- package/src/classes/HMSEncoder.ts +64 -28
- package/src/classes/HMSException.ts +33 -0
- package/src/classes/HMSHelper.ts +2 -2
- package/src/classes/HMSLocalAudioTrack.ts +35 -2
- package/src/classes/HMSLocalPeer.ts +6 -0
- package/src/classes/HMSLocalVideoTrack.ts +22 -2
- package/src/classes/HMSLogger.ts +19 -6
- package/src/classes/HMSPeer.ts +3 -0
- package/src/classes/HMSPeerUpdate.ts +1 -0
- package/src/classes/HMSPermissions.ts +6 -0
- package/src/classes/HMSRTMPConfig.ts +15 -0
- package/src/classes/HMSRemoteAudioTrack.ts +29 -2
- package/src/classes/HMSRemotePeer.ts +3 -0
- package/src/classes/HMSRemoteVideoTrack.ts +29 -2
- package/src/classes/HMSRoom.ts +12 -0
- package/src/classes/HMSRtmpStreamingState.ts +11 -0
- package/src/classes/{HMSSDK.ts → HMSSDK.tsx} +396 -97
- package/src/classes/HMSServerRecordingState.ts +11 -0
- package/src/classes/HMSTrack.ts +9 -15
- package/src/classes/HMSTrackSettings.ts +3 -0
- package/src/classes/HMSTrackType.ts +4 -0
- package/src/classes/HMSVideoCodec.ts +4 -4
- package/src/classes/HMSVideoResolution.ts +9 -0
- package/src/classes/HMSVideoSettings.ts +3 -3
- package/src/classes/HMSVideoTrack.ts +6 -1
- package/src/classes/HMSVideoTrackSettings.ts +13 -10
- package/src/classes/HmsView.tsx +4 -0
- package/src/index.ts +8 -0
- package/ios/Hmssdk.m +0 -8
- package/ios/Hmssdk.swift +0 -8
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NativeEventEmitter, NativeModules, ViewStyle } from 'react-native';
|
|
2
3
|
import { HMSUpdateListenerActions } from './HMSUpdateListenerActions';
|
|
3
4
|
import type { HMSConfig } from './HMSConfig';
|
|
4
5
|
import type { HMSLocalPeer } from './HMSLocalPeer';
|
|
@@ -9,7 +10,22 @@ import { HMSEncoder } from './HMSEncoder';
|
|
|
9
10
|
import { HMSMessage } from './HMSMessage';
|
|
10
11
|
import { HMSHelper } from './HMSHelper';
|
|
11
12
|
import type { HMSTrack } from './HMSTrack';
|
|
13
|
+
import type { HMSTrackType } from './HMSTrackType';
|
|
12
14
|
import type { HMSLogger } from './HMSLogger';
|
|
15
|
+
import type { HMSPeer } from './HMSPeer';
|
|
16
|
+
import { HmsView as HMSViewComponent } from './HmsView';
|
|
17
|
+
import { HMSVideoViewMode } from './HMSVideoViewMode';
|
|
18
|
+
import type { HMSTrackSettings } from './HMSTrackSettings';
|
|
19
|
+
import type { HMSRTMPConfig } from './HMSRTMPConfig';
|
|
20
|
+
|
|
21
|
+
interface HmsComponentProps {
|
|
22
|
+
trackId: string;
|
|
23
|
+
sink: boolean;
|
|
24
|
+
style: ViewStyle;
|
|
25
|
+
mirror?: boolean;
|
|
26
|
+
scaleType: HMSVideoViewMode;
|
|
27
|
+
id?: string | null;
|
|
28
|
+
}
|
|
13
29
|
|
|
14
30
|
const {
|
|
15
31
|
/**
|
|
@@ -22,12 +38,15 @@ const HmsEventEmitter = new NativeEventEmitter(HmsManager);
|
|
|
22
38
|
|
|
23
39
|
let HmsSdk: HMSSDK | undefined;
|
|
24
40
|
|
|
41
|
+
let logger: HMSLogger | undefined;
|
|
42
|
+
|
|
25
43
|
export class HMSSDK {
|
|
26
44
|
room?: HMSRoom;
|
|
27
45
|
localPeer?: HMSLocalPeer;
|
|
28
46
|
remotePeers?: HMSRemotePeer[];
|
|
29
47
|
knownRoles?: HMSRole[];
|
|
30
|
-
|
|
48
|
+
id: string;
|
|
49
|
+
private muteStatus: boolean | undefined;
|
|
31
50
|
|
|
32
51
|
onPreviewDelegate?: any;
|
|
33
52
|
onJoinDelegate?: any;
|
|
@@ -43,6 +62,10 @@ export class HMSSDK {
|
|
|
43
62
|
onChangeTrackStateRequestDelegate?: any;
|
|
44
63
|
onRemovedFromRoomDelegate?: any;
|
|
45
64
|
|
|
65
|
+
constructor(id: string) {
|
|
66
|
+
this.id = id;
|
|
67
|
+
}
|
|
68
|
+
|
|
46
69
|
/**
|
|
47
70
|
* - Returns an instance of [HMSSDK]{@link HMSSDK}
|
|
48
71
|
* - This function must be called to get an instance of HMSSDK class and only then user can interact with its methods
|
|
@@ -51,15 +74,27 @@ export class HMSSDK {
|
|
|
51
74
|
* @returns
|
|
52
75
|
* @memberof HMSSDK
|
|
53
76
|
*/
|
|
54
|
-
static build() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
HmsSdk = new HMSSDK();
|
|
77
|
+
static async build(params?: { trackSettings?: HMSTrackSettings }) {
|
|
78
|
+
let id = await HmsManager.build(params?.trackSettings || {});
|
|
79
|
+
HmsSdk = new HMSSDK(id);
|
|
80
|
+
HmsSdk.attachPreviewListener();
|
|
81
|
+
HmsSdk.attachListeners();
|
|
60
82
|
return HmsSdk;
|
|
61
83
|
}
|
|
62
84
|
|
|
85
|
+
static getLogger() {
|
|
86
|
+
return logger;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
setLogger = (hmsLogger: HMSLogger) => {
|
|
90
|
+
logger = hmsLogger;
|
|
91
|
+
hmsLogger.verbose('#Function setLogger', { id: this.id });
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
destroy = () => {
|
|
95
|
+
this.removeListeners();
|
|
96
|
+
};
|
|
97
|
+
|
|
63
98
|
attachPreviewListener = () => {
|
|
64
99
|
HmsEventEmitter.addListener(
|
|
65
100
|
HMSUpdateListenerActions.ON_PREVIEW,
|
|
@@ -129,6 +164,68 @@ export class HMSSDK {
|
|
|
129
164
|
);
|
|
130
165
|
};
|
|
131
166
|
|
|
167
|
+
removeListeners = () => {
|
|
168
|
+
HmsEventEmitter.removeListener(
|
|
169
|
+
HMSUpdateListenerActions.ON_JOIN,
|
|
170
|
+
this.onJoinListener
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
HmsEventEmitter.removeListener(
|
|
174
|
+
HMSUpdateListenerActions.ON_ROOM_UPDATE,
|
|
175
|
+
this.onRoomListener
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
HmsEventEmitter.removeListener(
|
|
179
|
+
HMSUpdateListenerActions.ON_PEER_UPDATE,
|
|
180
|
+
this.onPeerListener
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
HmsEventEmitter.removeListener(
|
|
184
|
+
HMSUpdateListenerActions.ON_TRACK_UPDATE,
|
|
185
|
+
this.onTrackListener
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
HmsEventEmitter.removeListener(
|
|
189
|
+
HMSUpdateListenerActions.ON_ERROR,
|
|
190
|
+
this.onErrorListener
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
HmsEventEmitter.removeListener(
|
|
194
|
+
HMSUpdateListenerActions.ON_MESSAGE,
|
|
195
|
+
this.onMessageListener
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
HmsEventEmitter.removeListener(
|
|
199
|
+
HMSUpdateListenerActions.ON_SPEAKER,
|
|
200
|
+
this.onSpeakerListener
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
HmsEventEmitter.removeListener(
|
|
204
|
+
HMSUpdateListenerActions.RECONNECTING,
|
|
205
|
+
this.reconnectingListener
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
HmsEventEmitter.removeListener(
|
|
209
|
+
HMSUpdateListenerActions.RECONNECTED,
|
|
210
|
+
this.reconnectedListener
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
HmsEventEmitter.removeListener(
|
|
214
|
+
HMSUpdateListenerActions.ON_ROLE_CHANGE_REQUEST,
|
|
215
|
+
this.onRoleChangeRequestListener
|
|
216
|
+
);
|
|
217
|
+
|
|
218
|
+
HmsEventEmitter.removeListener(
|
|
219
|
+
HMSUpdateListenerActions.ON_CHANGE_TRACK_STATE_REQUEST,
|
|
220
|
+
this.onChangeTrackStateRequestListener
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
HmsEventEmitter.removeListener(
|
|
224
|
+
HMSUpdateListenerActions.ON_REMOVED_FROM_ROOM,
|
|
225
|
+
this.onRemovedFromRoomListener
|
|
226
|
+
);
|
|
227
|
+
};
|
|
228
|
+
|
|
132
229
|
/**
|
|
133
230
|
* takes an instance of [HMSConfig]{@link HMSConfig} and joins the room
|
|
134
231
|
* after joining the room user will start receiving the events and updates of the room
|
|
@@ -137,15 +234,32 @@ export class HMSSDK {
|
|
|
137
234
|
* @memberof HMSSDK
|
|
138
235
|
*/
|
|
139
236
|
join = async (config: HMSConfig) => {
|
|
140
|
-
|
|
141
|
-
this.
|
|
142
|
-
await HmsManager.join(config);
|
|
237
|
+
logger?.verbose('#Function join', { config, id: this.id });
|
|
238
|
+
await HmsManager.join({ ...config, id: this.id });
|
|
143
239
|
};
|
|
144
240
|
|
|
145
241
|
preview = (config: HMSConfig) => {
|
|
146
|
-
|
|
147
|
-
this.
|
|
148
|
-
|
|
242
|
+
logger?.verbose('#Function preview', { config, id: this.id });
|
|
243
|
+
HmsManager.preview({ ...config, id: this.id });
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
HmsView = ({
|
|
247
|
+
sink,
|
|
248
|
+
trackId,
|
|
249
|
+
style,
|
|
250
|
+
mirror,
|
|
251
|
+
scaleType = HMSVideoViewMode.ASPECT_FIT,
|
|
252
|
+
}: HmsComponentProps) => {
|
|
253
|
+
return (
|
|
254
|
+
<HMSViewComponent
|
|
255
|
+
sink={sink}
|
|
256
|
+
trackId={trackId}
|
|
257
|
+
style={style}
|
|
258
|
+
mirror={mirror}
|
|
259
|
+
scaleType={scaleType}
|
|
260
|
+
id={this.id}
|
|
261
|
+
/>
|
|
262
|
+
);
|
|
149
263
|
};
|
|
150
264
|
|
|
151
265
|
/**
|
|
@@ -153,84 +267,199 @@ export class HMSSDK {
|
|
|
153
267
|
*
|
|
154
268
|
* @memberof HMSSDK
|
|
155
269
|
*/
|
|
156
|
-
leave = () => {
|
|
157
|
-
|
|
270
|
+
leave = async () => {
|
|
271
|
+
logger?.verbose('#Function leave', { id: this.id });
|
|
272
|
+
const data = {
|
|
273
|
+
id: this.id,
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const op = await HmsManager.leave(data);
|
|
277
|
+
this.muteStatus = undefined;
|
|
158
278
|
this.localPeer = undefined;
|
|
159
279
|
this.remotePeers = undefined;
|
|
160
280
|
this.room = undefined;
|
|
161
281
|
this.knownRoles = undefined;
|
|
162
|
-
|
|
282
|
+
return op;
|
|
163
283
|
};
|
|
164
284
|
|
|
165
|
-
sendBroadcastMessage = (message: string) => {
|
|
166
|
-
|
|
167
|
-
|
|
285
|
+
sendBroadcastMessage = async (message: string, type?: string) => {
|
|
286
|
+
logger?.verbose('#Function sendBroadcastMessage', {
|
|
287
|
+
message,
|
|
288
|
+
type: type || null,
|
|
289
|
+
id: this.id,
|
|
290
|
+
});
|
|
291
|
+
return await HmsManager.sendBroadcastMessage({
|
|
292
|
+
message,
|
|
293
|
+
type: type || null,
|
|
294
|
+
id: this.id,
|
|
295
|
+
});
|
|
168
296
|
};
|
|
169
297
|
|
|
170
|
-
sendGroupMessage = (
|
|
171
|
-
|
|
172
|
-
|
|
298
|
+
sendGroupMessage = async (
|
|
299
|
+
message: string,
|
|
300
|
+
roles: HMSRole[],
|
|
301
|
+
type?: string
|
|
302
|
+
) => {
|
|
303
|
+
logger?.verbose('#Function sendGroupMessage', {
|
|
304
|
+
message,
|
|
305
|
+
roles,
|
|
306
|
+
id: this.id,
|
|
307
|
+
type: type || null,
|
|
308
|
+
});
|
|
309
|
+
return await HmsManager.sendGroupMessage({
|
|
173
310
|
message,
|
|
174
311
|
roles: HMSHelper.getRoleNames(roles),
|
|
312
|
+
id: this.id,
|
|
313
|
+
type: type || null,
|
|
175
314
|
});
|
|
176
315
|
};
|
|
177
316
|
|
|
178
|
-
sendDirectMessage = (
|
|
179
|
-
|
|
180
|
-
|
|
317
|
+
sendDirectMessage = async (
|
|
318
|
+
message: string,
|
|
319
|
+
peerId: string,
|
|
320
|
+
type?: string
|
|
321
|
+
) => {
|
|
322
|
+
logger?.verbose('#Function sendDirectMessage', {
|
|
181
323
|
message,
|
|
182
324
|
peerId,
|
|
325
|
+
id: this.id,
|
|
326
|
+
type: type || null,
|
|
183
327
|
});
|
|
328
|
+
return await HmsManager.sendDirectMessage({
|
|
329
|
+
message,
|
|
330
|
+
peerId,
|
|
331
|
+
id: this.id,
|
|
332
|
+
type: type || null,
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
changeMetadata = (metadata: string) => {
|
|
337
|
+
logger?.verbose('#Function changeMetadata', { metadata, id: this.id });
|
|
338
|
+
HmsManager.changeMetadata({ metadata, id: this.id });
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
startRTMPOrRecording = async (data: HMSRTMPConfig) => {
|
|
342
|
+
logger?.verbose('#Function startRTMPOrRecording', {
|
|
343
|
+
...data,
|
|
344
|
+
id: this.id,
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
const op = await HmsManager.startRTMPOrRecording({ ...data, id: this.id });
|
|
348
|
+
return op;
|
|
184
349
|
};
|
|
185
350
|
|
|
186
|
-
|
|
351
|
+
stopRtmpAndRecording = async () => {
|
|
352
|
+
logger?.verbose('#Function stopRtmpAndRecording', {});
|
|
353
|
+
const op = await HmsManager.stopRtmpAndRecording({ id: this.id });
|
|
354
|
+
return op;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
changeRole = async (peer: HMSPeer, role: HMSRole, force: boolean = false) => {
|
|
187
358
|
const data = {
|
|
188
|
-
peerId:
|
|
189
|
-
role: role,
|
|
359
|
+
peerId: peer?.peerID,
|
|
360
|
+
role: role?.name,
|
|
190
361
|
force: force,
|
|
362
|
+
id: this.id,
|
|
191
363
|
};
|
|
192
|
-
|
|
193
|
-
HmsManager.changeRole(data);
|
|
364
|
+
logger?.verbose('#Function changeRole', data);
|
|
365
|
+
return await HmsManager.changeRole(data);
|
|
194
366
|
};
|
|
195
367
|
|
|
196
|
-
changeTrackState = (track: HMSTrack, mute: boolean) => {
|
|
197
|
-
|
|
368
|
+
changeTrackState = async (track: HMSTrack, mute: boolean) => {
|
|
369
|
+
logger?.verbose('#Function changeTrackState', {
|
|
370
|
+
track,
|
|
371
|
+
mute,
|
|
372
|
+
id: this.id,
|
|
373
|
+
});
|
|
198
374
|
const data = {
|
|
199
375
|
trackId: track.trackId,
|
|
200
376
|
mute,
|
|
377
|
+
id: this.id,
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
return await HmsManager.changeTrackState(data);
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
changeTrackStateRoles = async (
|
|
384
|
+
type: HMSTrackType,
|
|
385
|
+
mute: boolean,
|
|
386
|
+
source: string,
|
|
387
|
+
roles: Array<HMSRole>
|
|
388
|
+
) => {
|
|
389
|
+
logger?.verbose('#Function changeTrackStateRoles', {
|
|
390
|
+
source,
|
|
391
|
+
mute,
|
|
392
|
+
type,
|
|
393
|
+
roles,
|
|
394
|
+
id: this.id,
|
|
395
|
+
});
|
|
396
|
+
const data = {
|
|
397
|
+
source,
|
|
398
|
+
mute,
|
|
399
|
+
type,
|
|
400
|
+
roles: HMSHelper.getRoleNames(roles),
|
|
401
|
+
id: this.id,
|
|
201
402
|
};
|
|
202
403
|
|
|
203
|
-
HmsManager.
|
|
404
|
+
return await HmsManager.changeTrackStateRoles(data);
|
|
204
405
|
};
|
|
205
406
|
|
|
206
|
-
removePeer = (peerId: string, reason: string) => {
|
|
207
|
-
|
|
407
|
+
removePeer = async (peerId: string, reason: string) => {
|
|
408
|
+
logger?.verbose('#Function removePeer', { peerId, reason, id: this.id });
|
|
208
409
|
const data = {
|
|
209
410
|
peerId,
|
|
210
411
|
reason,
|
|
412
|
+
id: this.id,
|
|
211
413
|
};
|
|
212
414
|
|
|
213
|
-
HmsManager.removePeer(data);
|
|
415
|
+
return await HmsManager.removePeer(data);
|
|
214
416
|
};
|
|
215
417
|
|
|
216
|
-
endRoom = (lock: boolean, reason: string) => {
|
|
217
|
-
|
|
418
|
+
endRoom = async (lock: boolean, reason: string) => {
|
|
419
|
+
logger?.verbose('#Function endRoom', { lock, reason, id: this.id });
|
|
218
420
|
const data = {
|
|
219
421
|
lock,
|
|
220
422
|
reason,
|
|
423
|
+
id: this.id,
|
|
221
424
|
};
|
|
222
425
|
|
|
223
|
-
HmsManager.endRoom(data);
|
|
426
|
+
return await HmsManager.endRoom(data);
|
|
224
427
|
};
|
|
225
428
|
|
|
226
429
|
acceptRoleChange = () => {
|
|
227
|
-
|
|
228
|
-
HmsManager.acceptRoleChange();
|
|
430
|
+
logger?.verbose('#Function acceptRoleChange', { id: this.id });
|
|
431
|
+
HmsManager.acceptRoleChange({ id: this.id });
|
|
229
432
|
};
|
|
230
433
|
|
|
231
434
|
muteAllPeersAudio = (mute: boolean) => {
|
|
232
|
-
|
|
233
|
-
|
|
435
|
+
logger?.verbose('#Function muteAllPeersAudio', { mute, id: this.id });
|
|
436
|
+
this.muteStatus = mute;
|
|
437
|
+
HmsManager.muteAllPeersAudio({ mute, id: this.id });
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
getRoom = async () => {
|
|
441
|
+
logger?.verbose('#Function getRoom', {
|
|
442
|
+
roomID: this.room?.id,
|
|
443
|
+
id: this.id,
|
|
444
|
+
});
|
|
445
|
+
const hmsRoom = await HmsManager.getRoom({ id: this.id });
|
|
446
|
+
|
|
447
|
+
const encodedHmsRoom = HMSEncoder.encodeHmsRoom(hmsRoom, this.id);
|
|
448
|
+
return encodedHmsRoom;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
setVolume = (track: HMSTrack, volume: number) => {
|
|
452
|
+
logger?.verbose('#Function setVolume', {
|
|
453
|
+
track,
|
|
454
|
+
volume,
|
|
455
|
+
id: this.id,
|
|
456
|
+
});
|
|
457
|
+
HmsManager.setVolume({
|
|
458
|
+
id: this.id,
|
|
459
|
+
trackId: track.trackId,
|
|
460
|
+
volume,
|
|
461
|
+
});
|
|
462
|
+
return;
|
|
234
463
|
};
|
|
235
464
|
|
|
236
465
|
/**
|
|
@@ -242,7 +471,10 @@ export class HMSSDK {
|
|
|
242
471
|
* @memberof HMSSDK
|
|
243
472
|
*/
|
|
244
473
|
addEventListener = (action: HMSUpdateListenerActions, callback: any) => {
|
|
245
|
-
|
|
474
|
+
logger?.verbose('#Function addEventListener', {
|
|
475
|
+
action,
|
|
476
|
+
id: this.id,
|
|
477
|
+
});
|
|
246
478
|
switch (action) {
|
|
247
479
|
case HMSUpdateListenerActions.ON_PREVIEW:
|
|
248
480
|
this.onPreviewDelegate = callback;
|
|
@@ -296,7 +528,7 @@ export class HMSSDK {
|
|
|
296
528
|
* @memberof HMSSDK
|
|
297
529
|
*/
|
|
298
530
|
removeEventListener = (action: HMSUpdateListenerActions) => {
|
|
299
|
-
|
|
531
|
+
logger?.verbose('#Function removeEventListener', { action, id: this.id });
|
|
300
532
|
switch (action) {
|
|
301
533
|
case HMSUpdateListenerActions.ON_PREVIEW:
|
|
302
534
|
this.onPreviewDelegate = null;
|
|
@@ -361,19 +593,18 @@ export class HMSSDK {
|
|
|
361
593
|
this.onChangeTrackStateRequestDelegate = null;
|
|
362
594
|
this.onRemovedFromRoomDelegate = null;
|
|
363
595
|
|
|
364
|
-
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
setLogger = (hmsLogger: HMSLogger) => {
|
|
368
|
-
this.logger = hmsLogger;
|
|
369
|
-
hmsLogger.verbose('UPDATE_LOGGER', { hmsLogger });
|
|
596
|
+
logger?.verbose('#Function REMOVE_ALL_LISTENER', { id: this.id });
|
|
370
597
|
};
|
|
371
598
|
|
|
372
599
|
onPreviewListener = (data: any) => {
|
|
373
|
-
this.
|
|
374
|
-
|
|
600
|
+
if (data.id !== this.id) {
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
logger?.verbose('#Listener ON_PREVIEW', data);
|
|
604
|
+
const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room, this.id);
|
|
375
605
|
const localPeer: HMSLocalPeer = HMSEncoder.encodeHmsLocalPeer(
|
|
376
|
-
data.localPeer
|
|
606
|
+
data.localPeer,
|
|
607
|
+
this.id
|
|
377
608
|
);
|
|
378
609
|
|
|
379
610
|
const previewTracks = HMSEncoder.encodeHmsPreviewTracks(data.previewTracks);
|
|
@@ -381,7 +612,7 @@ export class HMSSDK {
|
|
|
381
612
|
this.localPeer = localPeer;
|
|
382
613
|
this.room = room;
|
|
383
614
|
if (this.onPreviewDelegate) {
|
|
384
|
-
|
|
615
|
+
logger?.verbose('#Listener ON_PREVIEW_LISTENER_CALL', {
|
|
385
616
|
...data,
|
|
386
617
|
room,
|
|
387
618
|
localPeer,
|
|
@@ -392,14 +623,19 @@ export class HMSSDK {
|
|
|
392
623
|
};
|
|
393
624
|
|
|
394
625
|
onJoinListener = (data: any) => {
|
|
395
|
-
this.
|
|
626
|
+
if (data.id !== this.id) {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
logger?.verbose('#LISTENER ON_JOIN', data);
|
|
396
630
|
// Preprocessing
|
|
397
|
-
const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room);
|
|
631
|
+
const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room, this.id);
|
|
398
632
|
const localPeer: HMSLocalPeer = HMSEncoder.encodeHmsLocalPeer(
|
|
399
|
-
data.localPeer
|
|
633
|
+
data.localPeer,
|
|
634
|
+
this.id
|
|
400
635
|
);
|
|
401
636
|
const remotePeers: HMSRemotePeer[] = HMSEncoder.encodeHmsRemotePeers(
|
|
402
|
-
data.remotePeers
|
|
637
|
+
data.remotePeers,
|
|
638
|
+
this.id
|
|
403
639
|
);
|
|
404
640
|
const roles: HMSRole[] = HMSEncoder.encodeHmsRoles(data.roles);
|
|
405
641
|
this.room = room;
|
|
@@ -407,7 +643,7 @@ export class HMSSDK {
|
|
|
407
643
|
this.remotePeers = remotePeers;
|
|
408
644
|
this.knownRoles = roles;
|
|
409
645
|
if (this.onJoinDelegate) {
|
|
410
|
-
|
|
646
|
+
logger?.verbose('#Listener ON_JOIN_LISTENER_CALL', {
|
|
411
647
|
...data,
|
|
412
648
|
room,
|
|
413
649
|
localPeer,
|
|
@@ -418,19 +654,24 @@ export class HMSSDK {
|
|
|
418
654
|
};
|
|
419
655
|
|
|
420
656
|
onRoomListener = (data: any) => {
|
|
421
|
-
this.
|
|
422
|
-
|
|
657
|
+
if (data.id !== this.id) {
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
logger?.verbose('#Listener ON_ROOM', data);
|
|
661
|
+
const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room, this.id);
|
|
423
662
|
const localPeer: HMSLocalPeer = HMSEncoder.encodeHmsLocalPeer(
|
|
424
|
-
data.localPeer
|
|
663
|
+
data.localPeer,
|
|
664
|
+
this.id
|
|
425
665
|
);
|
|
426
666
|
const remotePeers: HMSRemotePeer[] = HMSEncoder.encodeHmsRemotePeers(
|
|
427
|
-
data.remotePeers
|
|
667
|
+
data.remotePeers,
|
|
668
|
+
this.id
|
|
428
669
|
);
|
|
429
670
|
this.room = room;
|
|
430
671
|
this.localPeer = localPeer;
|
|
431
672
|
this.remotePeers = remotePeers;
|
|
432
673
|
if (this.onRoomDelegate) {
|
|
433
|
-
|
|
674
|
+
logger?.verbose('#Listener ON_ROOM_LISTENER_CALL', {
|
|
434
675
|
...data,
|
|
435
676
|
room,
|
|
436
677
|
localPeer,
|
|
@@ -441,71 +682,113 @@ export class HMSSDK {
|
|
|
441
682
|
};
|
|
442
683
|
|
|
443
684
|
onPeerListener = (data: any) => {
|
|
444
|
-
this.
|
|
685
|
+
if (data.id !== this.id) {
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
logger?.verbose('#Listener ON_PEER', data);
|
|
689
|
+
const peer: HMSPeer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
|
|
690
|
+
const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room, this.id);
|
|
445
691
|
const localPeer: HMSLocalPeer = HMSEncoder.encodeHmsLocalPeer(
|
|
446
|
-
data.localPeer
|
|
692
|
+
data.localPeer,
|
|
693
|
+
this.id
|
|
447
694
|
);
|
|
448
695
|
const remotePeers: HMSRemotePeer[] = HMSEncoder.encodeHmsRemotePeers(
|
|
449
|
-
data.remotePeers
|
|
696
|
+
data.remotePeers,
|
|
697
|
+
this.id
|
|
450
698
|
);
|
|
451
699
|
// this.room = room;
|
|
452
700
|
this.localPeer = localPeer;
|
|
453
701
|
this.remotePeers = remotePeers;
|
|
702
|
+
this.room = room;
|
|
454
703
|
if (this.onPeerDelegate) {
|
|
455
|
-
|
|
456
|
-
this.onPeerDelegate({ ...data, localPeer, remotePeers });
|
|
704
|
+
logger?.verbose('#Listener ON_PEER_LISTENER_CALL', data);
|
|
705
|
+
this.onPeerDelegate({ ...data, localPeer, remotePeers, room, peer });
|
|
457
706
|
}
|
|
458
707
|
};
|
|
459
708
|
|
|
460
709
|
onTrackListener = (data: any) => {
|
|
461
|
-
this.
|
|
462
|
-
|
|
710
|
+
if (data.id !== this.id) {
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
logger?.verbose('#Listener ON_TRACK', data);
|
|
714
|
+
const track: HMSTrack = HMSEncoder.encodeHmsTrack(data.track, this.id);
|
|
715
|
+
const peer: HMSPeer = HMSEncoder.encodeHmsPeer(data.peer, this.id);
|
|
716
|
+
const room: HMSRoom = HMSEncoder.encodeHmsRoom(data.room, this.id);
|
|
463
717
|
const localPeer: HMSLocalPeer = HMSEncoder.encodeHmsLocalPeer(
|
|
464
|
-
data.localPeer
|
|
718
|
+
data.localPeer,
|
|
719
|
+
this.id
|
|
465
720
|
);
|
|
466
721
|
const remotePeers: HMSRemotePeer[] = HMSEncoder.encodeHmsRemotePeers(
|
|
467
|
-
data.remotePeers
|
|
722
|
+
data.remotePeers,
|
|
723
|
+
this.id
|
|
468
724
|
);
|
|
469
|
-
|
|
725
|
+
if (this.muteStatus && data?.type === 'TRACK_ADDED') {
|
|
726
|
+
this.muteAllPeersAudio(this.muteStatus);
|
|
727
|
+
}
|
|
728
|
+
this.room = room;
|
|
470
729
|
this.localPeer = localPeer;
|
|
471
730
|
this.remotePeers = remotePeers;
|
|
472
731
|
if (this.onTrackDelegate) {
|
|
473
|
-
|
|
474
|
-
this.onTrackDelegate({
|
|
732
|
+
logger?.verbose('#Listener ON_TRACK_LISTENER_CALL', data);
|
|
733
|
+
this.onTrackDelegate({
|
|
734
|
+
...data,
|
|
735
|
+
localPeer,
|
|
736
|
+
remotePeers,
|
|
737
|
+
room,
|
|
738
|
+
peer,
|
|
739
|
+
track,
|
|
740
|
+
});
|
|
475
741
|
}
|
|
476
742
|
};
|
|
477
743
|
|
|
478
744
|
onMessageListener = (data: any) => {
|
|
479
|
-
this.
|
|
745
|
+
if (data.id !== this.id) {
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
logger?.verbose('#Listener ON_MESSAGE', data);
|
|
480
749
|
const message = new HMSMessage(data);
|
|
481
750
|
if (this.onMessageDelegate) {
|
|
482
|
-
|
|
751
|
+
logger?.verbose('#Listener ON_MESSAGE_LISTENER_CALL', message);
|
|
483
752
|
this.onMessageDelegate(message);
|
|
484
753
|
}
|
|
485
754
|
};
|
|
486
755
|
|
|
487
756
|
onSpeakerListener = (data: any) => {
|
|
488
|
-
this.
|
|
757
|
+
if (data.id !== this.id) {
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
logger?.verbose('#Listener ON_SPEAKER', data);
|
|
489
761
|
if (this.onSpeakerDelegate) {
|
|
762
|
+
logger?.verbose('#Listener ON_SPEAKER_LISTENER_CALL', data);
|
|
490
763
|
this.onSpeakerDelegate(data);
|
|
491
764
|
}
|
|
492
765
|
};
|
|
493
766
|
|
|
494
767
|
onErrorListener = (data: any) => {
|
|
495
|
-
this.
|
|
768
|
+
if (data.id !== this.id) {
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
logger?.warn('#Listener ON_ERROR', data);
|
|
772
|
+
logger?.verbose('#Listener ON_ERROR', data);
|
|
496
773
|
if (this.onErrorDelegate) {
|
|
497
|
-
|
|
774
|
+
logger?.verbose('#Listener ON_ERROR_LISTENER_CALL', data);
|
|
775
|
+
logger?.warn('#Listener ON_ERROR_LISTENER_CALL', data);
|
|
498
776
|
this.onErrorDelegate(data);
|
|
499
777
|
}
|
|
500
778
|
};
|
|
501
779
|
|
|
502
780
|
onRoleChangeRequestListener = (data: any) => {
|
|
503
|
-
this.
|
|
781
|
+
if (data.id !== this.id) {
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
logger?.verbose('#Listener ON_ROLE_CHANGE_REQUEST', data);
|
|
504
785
|
if (this.onRoleChangeRequestDelegate) {
|
|
505
|
-
const encodedRoleChangeRequest =
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
786
|
+
const encodedRoleChangeRequest = HMSEncoder.encodeHmsRoleChangeRequest(
|
|
787
|
+
data,
|
|
788
|
+
this.id
|
|
789
|
+
);
|
|
790
|
+
logger?.verbose(
|
|
791
|
+
'#Listener ON_ROLE_CHANGE_LISTENER_CALL',
|
|
509
792
|
encodedRoleChangeRequest
|
|
510
793
|
);
|
|
511
794
|
this.onRoleChangeRequestDelegate(encodedRoleChangeRequest);
|
|
@@ -513,12 +796,15 @@ export class HMSSDK {
|
|
|
513
796
|
};
|
|
514
797
|
|
|
515
798
|
onChangeTrackStateRequestListener = (data: any) => {
|
|
516
|
-
this.
|
|
799
|
+
if (data.id !== this.id) {
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
logger?.verbose('#Listener ON_CHANGE_TRACK_STATE_REQUEST', data);
|
|
517
803
|
if (this.onChangeTrackStateRequestDelegate) {
|
|
518
804
|
const encodedRoleChangeRequest =
|
|
519
|
-
HMSEncoder.encodeHmsChangeTrackStateRequest(data);
|
|
520
|
-
|
|
521
|
-
'ON_CHANGE_TRACK_STATE_REQUEST_LISTENER_CALL',
|
|
805
|
+
HMSEncoder.encodeHmsChangeTrackStateRequest(data, this.id);
|
|
806
|
+
logger?.verbose(
|
|
807
|
+
'#Listener ON_CHANGE_TRACK_STATE_REQUEST_LISTENER_CALL',
|
|
522
808
|
encodedRoleChangeRequest
|
|
523
809
|
);
|
|
524
810
|
this.onChangeTrackStateRequestDelegate(encodedRoleChangeRequest);
|
|
@@ -526,30 +812,43 @@ export class HMSSDK {
|
|
|
526
812
|
};
|
|
527
813
|
|
|
528
814
|
onRemovedFromRoomListener = (data: any) => {
|
|
529
|
-
this.
|
|
815
|
+
if (data.id !== this.id) {
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
logger?.verbose('#Listener ON_REMOVED_FROM_ROOM', data);
|
|
530
819
|
if (this.onRemovedFromRoomDelegate) {
|
|
531
|
-
|
|
820
|
+
let requestedBy = null;
|
|
821
|
+
if (data.requestedBy) {
|
|
822
|
+
requestedBy = HMSEncoder.encodeHmsPeer(data.requestedBy, this.id);
|
|
823
|
+
}
|
|
532
824
|
const reason = data.reason;
|
|
533
825
|
const roomEnded = data.roomEnded;
|
|
534
826
|
|
|
535
|
-
|
|
827
|
+
logger?.verbose('#Listener ON_REMOVED_FROM_ROOM_LISTENER_CALL', {
|
|
536
828
|
requestedBy,
|
|
537
829
|
reason,
|
|
538
830
|
roomEnded,
|
|
831
|
+
id: this.id,
|
|
539
832
|
});
|
|
540
833
|
this.onRemovedFromRoomDelegate({ requestedBy, reason, roomEnded });
|
|
541
834
|
}
|
|
542
835
|
};
|
|
543
836
|
|
|
544
837
|
reconnectingListener = (data: any) => {
|
|
545
|
-
this.
|
|
838
|
+
if (data.id !== this.id) {
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
logger?.verbose('#Listener ON_RECONNECTING', data);
|
|
546
842
|
if (this.onReconnectingDelegate) {
|
|
547
843
|
this.onReconnectingDelegate(data);
|
|
548
844
|
}
|
|
549
845
|
};
|
|
550
846
|
|
|
551
847
|
reconnectedListener = (data: any) => {
|
|
552
|
-
this.
|
|
848
|
+
if (data.id !== this.id) {
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
logger?.verbose('#Listener ON_RECONNECTED', data);
|
|
553
852
|
if (this.onReconnectedDelegate) {
|
|
554
853
|
this.onReconnectedDelegate(data);
|
|
555
854
|
}
|