@100mslive/react-native-hms 1.0.0 → 1.1.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 +44 -29
- package/android/build.gradle +5 -1
- package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +23 -23
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +289 -32
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +649 -548
- package/android/src/main/java/com/reactnativehmssdk/PipActionReceiver.kt +66 -0
- package/android/src/main/res/drawable/ic_call_end_24.xml +10 -0
- package/android/src/main/res/drawable/ic_camera_toggle_off.xml +11 -0
- package/android/src/main/res/drawable/ic_camera_toggle_on.xml +10 -0
- package/android/src/main/res/drawable/ic_mic_24.xml +10 -0
- package/android/src/main/res/drawable/ic_mic_off_24.xml +10 -0
- package/ios/HMSDecoder.swift +3 -5
- package/ios/HMSHelper.swift +18 -12
- package/ios/HMSManager.m +2 -0
- package/ios/HMSManager.swift +15 -0
- package/ios/HMSRNSDK.swift +36 -0
- package/lib/commonjs/classes/HMSPIPListenerActions.js +12 -0
- package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -0
- package/lib/commonjs/classes/HMSSDK.js +60 -7
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/classes/HMSPIPListenerActions.js +5 -0
- package/lib/module/classes/HMSPIPListenerActions.js.map +1 -0
- package/lib/module/classes/HMSSDK.js +60 -7
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/classes/HMSPIPListenerActions.d.ts +3 -0
- package/lib/typescript/classes/HMSSDK.d.ts +41 -2
- package/lib/typescript/index.d.ts +1 -0
- package/package.json +1 -1
- package/react-native-hms.podspec +2 -1
- package/src/classes/HMSPIPListenerActions.ts +3 -0
- package/src/classes/HMSSDK.tsx +111 -7
- package/src/index.ts +1 -0
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HMSSDK","HmsManager"],"sources":["index.ts"],"sourcesContent":["export * from './classes/HMSConfig';\nexport * from './classes/HMSUpdateListenerActions';\nexport * from './classes/HMSMessage';\nexport * from './classes/HMSVideoTrackSettings';\nexport * from './classes/HMSVideoTrack';\nexport * from './classes/HMSVideoSettings';\nexport * from './classes/HMSVideoCodec';\nexport * from './classes/HMSTrackSettings';\nexport * from './classes/HMSTrack';\nexport * from './classes/HMSTrackType';\nexport * from './classes/HMSTrackSource';\nexport * from './classes/HMSSubscribeSettings';\nexport * from './classes/HMSSimulcastSettings';\nexport * from './classes/HMSSimulcastLayerSettings';\nexport * from './classes/HMSSDK';\nexport * from './classes/HMSRoom';\nexport * from './classes/HMSRoleChangeRequest';\nexport * from './classes/HMSRole';\nexport * from './classes/HMSRemoteVideoTrack';\nexport * from './classes/HMSRemotePeer';\nexport * from './classes/HMSRemoteAudioTrack';\nexport * from './classes/HMSPublishSettings';\nexport * from './classes/HMSPermissions';\nexport * from './classes/HMSPeer';\nexport * from './classes/HMSLocalVideoTrack';\nexport * from './classes/HMSLocalPeer';\nexport * from './classes/HMSLocalAudioTrack';\nexport * from './classes/HMSHelper';\nexport * from './classes/HMSEncoder';\nexport * from './classes/HMSAudioTrackSettings';\nexport * from './classes/HMSAudioTrack';\nexport * from './classes/HMSAudioSettings';\nexport * from './classes/HMSAudioCodec';\nexport * from './classes/HMSPeerUpdate';\nexport * from './classes/HMSRoomUpdate';\nexport * from './classes/HMSTrackUpdate';\nexport * from './classes/HMSLogger';\nexport * from './classes/HMSLogLevel';\nexport * from './classes/HMSVideoViewMode';\nexport * from './classes/HMSChangeTrackStateRequest';\nexport * from './classes/HMSSpeaker';\nexport * from './classes/HMSCameraFacing';\nexport * from './classes/HMSException';\nexport * from './classes/HMSRtmpStreamingState';\nexport * from './classes/HMSServerRecordingState';\nexport * from './classes/HMSBrowserRecordingState';\nexport * from './classes/HMSRTMPConfig';\nexport * from './classes/HMSHLSConfig';\nexport * from './classes/HMSHLSMeetingURLVariant';\nexport * from './classes/HMSHLSVariant';\nexport * from './classes/HMSHLSStreamingState';\nexport * from './classes/HMSVideoResolution';\nexport * from './classes/HMSLocalAudioStats';\nexport * from './classes/HMSLocalVideoStats';\nexport * from './classes/HMSRTCStats';\nexport * from './classes/HMSRTCStatsReport';\nexport * from './classes/HMSRemoteAudioStats';\nexport * from './classes/HMSRemoteVideoStats';\nexport * from './classes/HMSHLSRecordingConfig';\nexport * from './classes/HMSHLSRecordingState';\nexport * from './classes/HMSMessageRecipient';\nexport * from './classes/HMSMessageRecipientType';\nexport * from './classes/HMSNetworkQuality';\nexport * from './classes/HMSRtmpVideoResolution';\nexport * from './classes/HMSAudioDevice';\nexport * from './classes/HMSAudioMode';\nexport * from './classes/HMSAudioMixingMode';\nexport * from './classes/HMSAudioNode';\nexport * from './classes/HMSMicNode';\nexport * from './classes/HMSScreenBroadcastAudioReceiverNode';\nexport * from './classes/HMSAudioFilePlayerNode';\nexport * from './classes/HMSAudioMixerSource';\nexport * from './classes/HMSTrackSettingsInitState';\nexport * from './classes/HMSLogSettings';\nexport * from './classes/HMSLogAlarmManager';\nexport * from './classes/HMSMessageType';\n\nimport { HMSSDK as HmsManager } from './classes/HMSSDK';\nexport default HmsManager;\n"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,oCAAoC;AAClD,cAAc,sBAAsB;AACpC,cAAc,iCAAiC;AAC/C,cAAc,yBAAyB;AACvC,cAAc,4BAA4B;AAC1C,cAAc,yBAAyB;AACvC,cAAc,4BAA4B;AAC1C,cAAc,oBAAoB;AAClC,cAAc,wBAAwB;AACtC,cAAc,0BAA0B;AACxC,cAAc,gCAAgC;AAC9C,cAAc,gCAAgC;AAC9C,cAAc,qCAAqC;AACnD,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,gCAAgC;AAC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;
|
|
1
|
+
{"version":3,"names":["HMSSDK","HmsManager"],"sources":["index.ts"],"sourcesContent":["export * from './classes/HMSConfig';\nexport * from './classes/HMSUpdateListenerActions';\nexport * from './classes/HMSMessage';\nexport * from './classes/HMSVideoTrackSettings';\nexport * from './classes/HMSVideoTrack';\nexport * from './classes/HMSVideoSettings';\nexport * from './classes/HMSVideoCodec';\nexport * from './classes/HMSTrackSettings';\nexport * from './classes/HMSTrack';\nexport * from './classes/HMSTrackType';\nexport * from './classes/HMSTrackSource';\nexport * from './classes/HMSSubscribeSettings';\nexport * from './classes/HMSSimulcastSettings';\nexport * from './classes/HMSSimulcastLayerSettings';\nexport * from './classes/HMSSDK';\nexport * from './classes/HMSRoom';\nexport * from './classes/HMSRoleChangeRequest';\nexport * from './classes/HMSRole';\nexport * from './classes/HMSRemoteVideoTrack';\nexport * from './classes/HMSRemotePeer';\nexport * from './classes/HMSRemoteAudioTrack';\nexport * from './classes/HMSPublishSettings';\nexport * from './classes/HMSPermissions';\nexport * from './classes/HMSPeer';\nexport * from './classes/HMSLocalVideoTrack';\nexport * from './classes/HMSLocalPeer';\nexport * from './classes/HMSLocalAudioTrack';\nexport * from './classes/HMSHelper';\nexport * from './classes/HMSEncoder';\nexport * from './classes/HMSAudioTrackSettings';\nexport * from './classes/HMSAudioTrack';\nexport * from './classes/HMSAudioSettings';\nexport * from './classes/HMSAudioCodec';\nexport * from './classes/HMSPeerUpdate';\nexport * from './classes/HMSRoomUpdate';\nexport * from './classes/HMSTrackUpdate';\nexport * from './classes/HMSLogger';\nexport * from './classes/HMSLogLevel';\nexport * from './classes/HMSVideoViewMode';\nexport * from './classes/HMSChangeTrackStateRequest';\nexport * from './classes/HMSSpeaker';\nexport * from './classes/HMSCameraFacing';\nexport * from './classes/HMSException';\nexport * from './classes/HMSRtmpStreamingState';\nexport * from './classes/HMSServerRecordingState';\nexport * from './classes/HMSBrowserRecordingState';\nexport * from './classes/HMSRTMPConfig';\nexport * from './classes/HMSHLSConfig';\nexport * from './classes/HMSHLSMeetingURLVariant';\nexport * from './classes/HMSHLSVariant';\nexport * from './classes/HMSHLSStreamingState';\nexport * from './classes/HMSVideoResolution';\nexport * from './classes/HMSLocalAudioStats';\nexport * from './classes/HMSLocalVideoStats';\nexport * from './classes/HMSRTCStats';\nexport * from './classes/HMSRTCStatsReport';\nexport * from './classes/HMSRemoteAudioStats';\nexport * from './classes/HMSRemoteVideoStats';\nexport * from './classes/HMSHLSRecordingConfig';\nexport * from './classes/HMSHLSRecordingState';\nexport * from './classes/HMSMessageRecipient';\nexport * from './classes/HMSMessageRecipientType';\nexport * from './classes/HMSNetworkQuality';\nexport * from './classes/HMSRtmpVideoResolution';\nexport * from './classes/HMSAudioDevice';\nexport * from './classes/HMSAudioMode';\nexport * from './classes/HMSAudioMixingMode';\nexport * from './classes/HMSAudioNode';\nexport * from './classes/HMSMicNode';\nexport * from './classes/HMSScreenBroadcastAudioReceiverNode';\nexport * from './classes/HMSAudioFilePlayerNode';\nexport * from './classes/HMSAudioMixerSource';\nexport * from './classes/HMSTrackSettingsInitState';\nexport * from './classes/HMSLogSettings';\nexport * from './classes/HMSLogAlarmManager';\nexport * from './classes/HMSMessageType';\nexport * from './classes/HMSPIPListenerActions';\n\nimport { HMSSDK as HmsManager } from './classes/HMSSDK';\nexport default HmsManager;\n"],"mappings":"AAAA,cAAc,qBAAqB;AACnC,cAAc,oCAAoC;AAClD,cAAc,sBAAsB;AACpC,cAAc,iCAAiC;AAC/C,cAAc,yBAAyB;AACvC,cAAc,4BAA4B;AAC1C,cAAc,yBAAyB;AACvC,cAAc,4BAA4B;AAC1C,cAAc,oBAAoB;AAClC,cAAc,wBAAwB;AACtC,cAAc,0BAA0B;AACxC,cAAc,gCAAgC;AAC9C,cAAc,gCAAgC;AAC9C,cAAc,qCAAqC;AACnD,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,cAAc,gCAAgC;AAC9C,cAAc,mBAAmB;AACjC,cAAc,+BAA+B;AAC7C,cAA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AAU,QAAQ,kBAAkB;AACvD,eAAeA,UAAU"}
|
|
@@ -19,6 +19,7 @@ import type { HMSAudioMode } from './HMSAudioMode';
|
|
|
19
19
|
import type { HMSAudioMixingMode } from './HMSAudioMixingMode';
|
|
20
20
|
import type { HMSLogSettings } from './HMSLogSettings';
|
|
21
21
|
import { HMSMessageType } from './HMSMessageType';
|
|
22
|
+
import { HMSPIPListenerActions } from './HMSPIPListenerActions';
|
|
22
23
|
interface HmsViewProps {
|
|
23
24
|
trackId: string;
|
|
24
25
|
style?: ViewStyle;
|
|
@@ -28,6 +29,9 @@ interface HmsViewProps {
|
|
|
28
29
|
}
|
|
29
30
|
interface PIPConfig {
|
|
30
31
|
aspectRatio?: [number, number];
|
|
32
|
+
endButton?: boolean;
|
|
33
|
+
audioButton?: boolean;
|
|
34
|
+
videoButton?: boolean;
|
|
31
35
|
}
|
|
32
36
|
export declare class HMSSDK {
|
|
33
37
|
id: string;
|
|
@@ -52,6 +56,7 @@ export declare class HMSSDK {
|
|
|
52
56
|
private onRemoteAudioStatsDelegate?;
|
|
53
57
|
private onRemoteVideoStatsDelegate?;
|
|
54
58
|
private onAudioDeviceChangedDelegate?;
|
|
59
|
+
private onPIPRoomLeaveDelegate?;
|
|
55
60
|
private constructor();
|
|
56
61
|
/**
|
|
57
62
|
* - Returns an instance of [HMSSDK] {@link HMSSDK}
|
|
@@ -237,6 +242,8 @@ export declare class HMSSDK {
|
|
|
237
242
|
*/
|
|
238
243
|
stopHLSStreaming: () => Promise<any>;
|
|
239
244
|
/**
|
|
245
|
+
* @deprecated This function has been deprecated in favor of #Function changeRoleOfPeer
|
|
246
|
+
*
|
|
240
247
|
* - This function can be used in a situation when we want to change role hence manipulate their
|
|
241
248
|
* access and rights in the current room, it takes the peer {@link HMSPeer} whom role we want to change,
|
|
242
249
|
* role {@link HMSRole} which will be the new role for that peer and weather to forcefully change
|
|
@@ -251,6 +258,35 @@ export declare class HMSSDK {
|
|
|
251
258
|
* @memberof HMSSDK
|
|
252
259
|
*/
|
|
253
260
|
changeRole: (peer: HMSPeer, role: HMSRole, force?: boolean) => Promise<any>;
|
|
261
|
+
/**
|
|
262
|
+
* - This function can be used in a situation when we want to change role hence manipulate their
|
|
263
|
+
* access and rights in the current room, it takes the peer {@link HMSPeer} whom role we want to change,
|
|
264
|
+
* role {@link HMSRole} which will be the new role for that peer and weather to forcefully change
|
|
265
|
+
* the role or ask the to accept the role change request using a boolean force.
|
|
266
|
+
*
|
|
267
|
+
* - if we change the role forcefully the peer's role will be updated without asking the peer
|
|
268
|
+
* otherwise the user will get the roleChangeRequest in roleChangeRequest listener.
|
|
269
|
+
* for more information on this checkout {@link onRoleChangeRequestListener}
|
|
270
|
+
*
|
|
271
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
|
|
272
|
+
*
|
|
273
|
+
* @memberof HMSSDK
|
|
274
|
+
*/
|
|
275
|
+
changeRoleOfPeer: (peer: HMSPeer, role: HMSRole, force?: boolean) => Promise<any>;
|
|
276
|
+
/**
|
|
277
|
+
* - This function can be used in a situation when we want to change role of multiple peers by specifying their roles.
|
|
278
|
+
* Hence manipulate their access and rights in the current room.
|
|
279
|
+
* It takes the list of roles {@link HMSRole} whom role we want to change
|
|
280
|
+
* and role {@link HMSRole} which will be the new role for peers.
|
|
281
|
+
*
|
|
282
|
+
* - Note that role will be updated without asking the peers.
|
|
283
|
+
* Meaning, Peers will not get the roleChangeRequest in roleChangeRequest listener.
|
|
284
|
+
*
|
|
285
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
|
|
286
|
+
*
|
|
287
|
+
* @memberof HMSSDK
|
|
288
|
+
*/
|
|
289
|
+
changeRoleOfPeersWithRoles: (ofRoles: HMSRole[], toRole: HMSRole) => Promise<any>;
|
|
254
290
|
/**
|
|
255
291
|
* - This function can be used to manipulate mute status of any track.
|
|
256
292
|
* - Targeted peer affected by this action will get a callback in onChangeTrackStateRequestListener.
|
|
@@ -516,7 +552,7 @@ export declare class HMSSDK {
|
|
|
516
552
|
* @param {*} callback
|
|
517
553
|
* @memberof HMSSDK
|
|
518
554
|
*/
|
|
519
|
-
addEventListener: (action: HMSUpdateListenerActions, callback: any) => void;
|
|
555
|
+
addEventListener: (action: HMSUpdateListenerActions | HMSPIPListenerActions, callback: any) => void;
|
|
520
556
|
/**
|
|
521
557
|
* - This is a prototype event listener that takes action and listens for updates related to that particular action
|
|
522
558
|
*
|
|
@@ -524,7 +560,7 @@ export declare class HMSSDK {
|
|
|
524
560
|
* @param {*} callback
|
|
525
561
|
* @memberof HMSSDK
|
|
526
562
|
*/
|
|
527
|
-
removeEventListener: (action: HMSUpdateListenerActions) => void;
|
|
563
|
+
removeEventListener: (action: HMSUpdateListenerActions | HMSPIPListenerActions) => void;
|
|
528
564
|
/**
|
|
529
565
|
* removes all the listeners
|
|
530
566
|
*
|
|
@@ -568,6 +604,9 @@ export declare class HMSSDK {
|
|
|
568
604
|
device: string;
|
|
569
605
|
audioDevicesList: string[];
|
|
570
606
|
}) => void;
|
|
607
|
+
onPIPRoomLeaveListener: (data: {
|
|
608
|
+
id: string;
|
|
609
|
+
}) => void;
|
|
571
610
|
isPipModeSupported(): Promise<undefined | boolean>;
|
|
572
611
|
enablePipMode(data?: PIPConfig): Promise<undefined | boolean>;
|
|
573
612
|
setPipParams(data?: PIPConfig): Promise<undefined | boolean>;
|
|
@@ -74,5 +74,6 @@ export * from './classes/HMSTrackSettingsInitState';
|
|
|
74
74
|
export * from './classes/HMSLogSettings';
|
|
75
75
|
export * from './classes/HMSLogAlarmManager';
|
|
76
76
|
export * from './classes/HMSMessageType';
|
|
77
|
+
export * from './classes/HMSPIPListenerActions';
|
|
77
78
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
78
79
|
export default HmsManager;
|
package/package.json
CHANGED
package/react-native-hms.podspec
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
sdkVersions = JSON.parse(File.read(File.join(__dir__, "sdk-versions.json")))
|
|
4
5
|
|
|
5
6
|
Pod::Spec.new do |s|
|
|
6
7
|
s.name = "react-native-hms"
|
|
@@ -16,6 +17,6 @@ Pod::Spec.new do |s|
|
|
|
16
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
18
|
|
|
18
19
|
s.dependency "React-Core"
|
|
19
|
-
s.dependency "HMSSDK", "
|
|
20
|
+
s.dependency "HMSSDK", sdkVersions["ios"]
|
|
20
21
|
s.dependency 'HMSBroadcastExtensionSDK', '0.0.5'
|
|
21
22
|
end
|
package/src/classes/HMSSDK.tsx
CHANGED
|
@@ -35,6 +35,7 @@ import type { HMSAudioMode } from './HMSAudioMode';
|
|
|
35
35
|
import type { HMSAudioMixingMode } from './HMSAudioMixingMode';
|
|
36
36
|
import type { HMSLogSettings } from './HMSLogSettings';
|
|
37
37
|
import { HMSMessageType } from './HMSMessageType';
|
|
38
|
+
import { HMSPIPListenerActions } from './HMSPIPListenerActions';
|
|
38
39
|
|
|
39
40
|
interface HmsViewProps {
|
|
40
41
|
trackId: string;
|
|
@@ -46,6 +47,9 @@ interface HmsViewProps {
|
|
|
46
47
|
|
|
47
48
|
interface PIPConfig {
|
|
48
49
|
aspectRatio?: [number, number];
|
|
50
|
+
endButton?: boolean;
|
|
51
|
+
audioButton?: boolean;
|
|
52
|
+
videoButton?: boolean;
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
const {
|
|
@@ -85,6 +89,7 @@ export class HMSSDK {
|
|
|
85
89
|
private onRemoteAudioStatsDelegate?: any;
|
|
86
90
|
private onRemoteVideoStatsDelegate?: any;
|
|
87
91
|
private onAudioDeviceChangedDelegate?: any;
|
|
92
|
+
private onPIPRoomLeaveDelegate?: any;
|
|
88
93
|
|
|
89
94
|
private constructor(id: string) {
|
|
90
95
|
this.id = id;
|
|
@@ -259,6 +264,13 @@ export class HMSSDK {
|
|
|
259
264
|
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED,
|
|
260
265
|
this.onAudioDeviceChangedListener
|
|
261
266
|
);
|
|
267
|
+
|
|
268
|
+
if (Platform.OS === 'android') {
|
|
269
|
+
HmsEventEmitter.addListener(
|
|
270
|
+
HMSPIPListenerActions.ON_PIP_ROOM_LEAVE,
|
|
271
|
+
this.onPIPRoomLeaveListener
|
|
272
|
+
);
|
|
273
|
+
}
|
|
262
274
|
};
|
|
263
275
|
|
|
264
276
|
/**
|
|
@@ -361,6 +373,13 @@ export class HMSSDK {
|
|
|
361
373
|
HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED,
|
|
362
374
|
this.onAudioDeviceChangedListener
|
|
363
375
|
);
|
|
376
|
+
|
|
377
|
+
if (Platform.OS === 'android') {
|
|
378
|
+
HmsEventEmitter.removeListener(
|
|
379
|
+
HMSPIPListenerActions.ON_PIP_ROOM_LEAVE,
|
|
380
|
+
this.onPIPRoomLeaveListener
|
|
381
|
+
);
|
|
382
|
+
}
|
|
364
383
|
};
|
|
365
384
|
|
|
366
385
|
/**
|
|
@@ -620,6 +639,8 @@ export class HMSSDK {
|
|
|
620
639
|
};
|
|
621
640
|
|
|
622
641
|
/**
|
|
642
|
+
* @deprecated This function has been deprecated in favor of #Function changeRoleOfPeer
|
|
643
|
+
*
|
|
623
644
|
* - This function can be used in a situation when we want to change role hence manipulate their
|
|
624
645
|
* access and rights in the current room, it takes the peer {@link HMSPeer} whom role we want to change,
|
|
625
646
|
* role {@link HMSRole} which will be the new role for that peer and weather to forcefully change
|
|
@@ -644,6 +665,58 @@ export class HMSSDK {
|
|
|
644
665
|
return await HMSManager.changeRole(data);
|
|
645
666
|
};
|
|
646
667
|
|
|
668
|
+
/**
|
|
669
|
+
* - This function can be used in a situation when we want to change role hence manipulate their
|
|
670
|
+
* access and rights in the current room, it takes the peer {@link HMSPeer} whom role we want to change,
|
|
671
|
+
* role {@link HMSRole} which will be the new role for that peer and weather to forcefully change
|
|
672
|
+
* the role or ask the to accept the role change request using a boolean force.
|
|
673
|
+
*
|
|
674
|
+
* - if we change the role forcefully the peer's role will be updated without asking the peer
|
|
675
|
+
* otherwise the user will get the roleChangeRequest in roleChangeRequest listener.
|
|
676
|
+
* for more information on this checkout {@link onRoleChangeRequestListener}
|
|
677
|
+
*
|
|
678
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
|
|
679
|
+
*
|
|
680
|
+
* @memberof HMSSDK
|
|
681
|
+
*/
|
|
682
|
+
changeRoleOfPeer = async (
|
|
683
|
+
peer: HMSPeer,
|
|
684
|
+
role: HMSRole,
|
|
685
|
+
force: boolean = false
|
|
686
|
+
) => {
|
|
687
|
+
const data = {
|
|
688
|
+
peerId: peer.peerID,
|
|
689
|
+
role: role.name,
|
|
690
|
+
force: force,
|
|
691
|
+
id: this.id,
|
|
692
|
+
};
|
|
693
|
+
logger?.verbose('#Function changeRoleOfPeer', data);
|
|
694
|
+
return HMSManager.changeRoleOfPeer(data);
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* - This function can be used in a situation when we want to change role of multiple peers by specifying their roles.
|
|
699
|
+
* Hence manipulate their access and rights in the current room.
|
|
700
|
+
* It takes the list of roles {@link HMSRole} whom role we want to change
|
|
701
|
+
* and role {@link HMSRole} which will be the new role for peers.
|
|
702
|
+
*
|
|
703
|
+
* - Note that role will be updated without asking the peers.
|
|
704
|
+
* Meaning, Peers will not get the roleChangeRequest in roleChangeRequest listener.
|
|
705
|
+
*
|
|
706
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
|
|
707
|
+
*
|
|
708
|
+
* @memberof HMSSDK
|
|
709
|
+
*/
|
|
710
|
+
changeRoleOfPeersWithRoles = async (ofRoles: HMSRole[], toRole: HMSRole) => {
|
|
711
|
+
const data = {
|
|
712
|
+
ofRoles: ofRoles.map((ofRole) => ofRole.name).filter(Boolean),
|
|
713
|
+
toRole: toRole.name,
|
|
714
|
+
id: this.id,
|
|
715
|
+
};
|
|
716
|
+
logger?.verbose('#Function changeRoleOfPeersWithRoles', data);
|
|
717
|
+
return HMSManager.changeRoleOfPeersWithRoles(data);
|
|
718
|
+
};
|
|
719
|
+
|
|
647
720
|
/**
|
|
648
721
|
* - This function can be used to manipulate mute status of any track.
|
|
649
722
|
* - Targeted peer affected by this action will get a callback in onChangeTrackStateRequestListener.
|
|
@@ -1221,7 +1294,10 @@ export class HMSSDK {
|
|
|
1221
1294
|
* @param {*} callback
|
|
1222
1295
|
* @memberof HMSSDK
|
|
1223
1296
|
*/
|
|
1224
|
-
addEventListener = (
|
|
1297
|
+
addEventListener = (
|
|
1298
|
+
action: HMSUpdateListenerActions | HMSPIPListenerActions,
|
|
1299
|
+
callback: any
|
|
1300
|
+
) => {
|
|
1225
1301
|
logger?.verbose('#Function addEventListener', {
|
|
1226
1302
|
action,
|
|
1227
1303
|
id: this.id,
|
|
@@ -1284,6 +1360,9 @@ export class HMSSDK {
|
|
|
1284
1360
|
case HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED:
|
|
1285
1361
|
this.onAudioDeviceChangedDelegate = callback;
|
|
1286
1362
|
break;
|
|
1363
|
+
case HMSPIPListenerActions.ON_PIP_ROOM_LEAVE:
|
|
1364
|
+
this.onPIPRoomLeaveDelegate = callback;
|
|
1365
|
+
break;
|
|
1287
1366
|
default:
|
|
1288
1367
|
}
|
|
1289
1368
|
};
|
|
@@ -1295,7 +1374,9 @@ export class HMSSDK {
|
|
|
1295
1374
|
* @param {*} callback
|
|
1296
1375
|
* @memberof HMSSDK
|
|
1297
1376
|
*/
|
|
1298
|
-
removeEventListener = (
|
|
1377
|
+
removeEventListener = (
|
|
1378
|
+
action: HMSUpdateListenerActions | HMSPIPListenerActions
|
|
1379
|
+
) => {
|
|
1299
1380
|
logger?.verbose('#Function removeEventListener', { action, id: this.id });
|
|
1300
1381
|
switch (action) {
|
|
1301
1382
|
case HMSUpdateListenerActions.ON_PREVIEW:
|
|
@@ -1355,6 +1436,9 @@ export class HMSSDK {
|
|
|
1355
1436
|
case HMSUpdateListenerActions.ON_AUDIO_DEVICE_CHANGED:
|
|
1356
1437
|
this.onAudioDeviceChangedDelegate = null;
|
|
1357
1438
|
break;
|
|
1439
|
+
case HMSPIPListenerActions.ON_PIP_ROOM_LEAVE:
|
|
1440
|
+
this.onPIPRoomLeaveDelegate = null;
|
|
1441
|
+
break;
|
|
1358
1442
|
default:
|
|
1359
1443
|
}
|
|
1360
1444
|
};
|
|
@@ -1378,6 +1462,7 @@ export class HMSSDK {
|
|
|
1378
1462
|
this.onRoleChangeRequestDelegate = null;
|
|
1379
1463
|
this.onChangeTrackStateRequestDelegate = null;
|
|
1380
1464
|
this.onRemovedFromRoomDelegate = null;
|
|
1465
|
+
this.onPIPRoomLeaveDelegate = null;
|
|
1381
1466
|
|
|
1382
1467
|
logger?.verbose('#Function REMOVE_ALL_LISTENER', { id: this.id });
|
|
1383
1468
|
};
|
|
@@ -1720,17 +1805,36 @@ export class HMSSDK {
|
|
|
1720
1805
|
}
|
|
1721
1806
|
};
|
|
1722
1807
|
|
|
1808
|
+
onPIPRoomLeaveListener = (data: { id: string }) => {
|
|
1809
|
+
if (data.id !== this.id) {
|
|
1810
|
+
return;
|
|
1811
|
+
}
|
|
1812
|
+
this.muteStatus = undefined;
|
|
1813
|
+
this?.appStateSubscription?.remove();
|
|
1814
|
+
|
|
1815
|
+
if (this.onPIPRoomLeaveDelegate) {
|
|
1816
|
+
logger?.verbose('#Listener onPIPRoomLeave_CALL', data);
|
|
1817
|
+
this.onPIPRoomLeaveDelegate({
|
|
1818
|
+
...data,
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
};
|
|
1822
|
+
|
|
1723
1823
|
async isPipModeSupported(): Promise<undefined | boolean> {
|
|
1724
|
-
return HMSManager.handlePipActions('isPipModeSupported',
|
|
1824
|
+
return HMSManager.handlePipActions('isPipModeSupported', { id: this.id });
|
|
1725
1825
|
}
|
|
1726
1826
|
|
|
1727
1827
|
async enablePipMode(data?: PIPConfig): Promise<undefined | boolean> {
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1828
|
+
return HMSManager.handlePipActions('enablePipMode', {
|
|
1829
|
+
...data,
|
|
1830
|
+
id: this.id,
|
|
1831
|
+
});
|
|
1731
1832
|
}
|
|
1732
1833
|
|
|
1733
1834
|
async setPipParams(data?: PIPConfig): Promise<undefined | boolean> {
|
|
1734
|
-
return HMSManager.handlePipActions('setPictureInPictureParams',
|
|
1835
|
+
return HMSManager.handlePipActions('setPictureInPictureParams', {
|
|
1836
|
+
...data,
|
|
1837
|
+
id: this.id,
|
|
1838
|
+
});
|
|
1735
1839
|
}
|
|
1736
1840
|
}
|
package/src/index.ts
CHANGED
|
@@ -74,6 +74,7 @@ export * from './classes/HMSTrackSettingsInitState';
|
|
|
74
74
|
export * from './classes/HMSLogSettings';
|
|
75
75
|
export * from './classes/HMSLogAlarmManager';
|
|
76
76
|
export * from './classes/HMSMessageType';
|
|
77
|
+
export * from './classes/HMSPIPListenerActions';
|
|
77
78
|
|
|
78
79
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
79
80
|
export default HmsManager;
|