@100mslive/react-native-hms 1.3.0 → 1.5.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 +59 -5
- package/android/build.gradle +3 -2
- package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +189 -55
- package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +1 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +49 -14
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +240 -46
- package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +5 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +29 -21
- package/android/src/main/res/layout/hms_view.xml +2 -2
- package/ios/HMSConstants.swift +31 -0
- package/ios/HMSDecoder.swift +371 -156
- package/ios/HMSManager.m +10 -2
- package/ios/HMSManager.swift +149 -74
- package/ios/HMSRNSDK.swift +431 -181
- package/ios/HMSView.m +1 -0
- package/ios/HMSView.swift +21 -19
- package/lib/commonjs/classes/HMSAudioTrackSettings.js +1 -1
- package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSCameraControl.js +28 -0
- package/lib/commonjs/classes/HMSCameraControl.js.map +1 -0
- package/lib/commonjs/classes/HMSEncoder.js +95 -13
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSException.js +3 -4
- package/lib/commonjs/classes/HMSException.js.map +1 -1
- package/lib/commonjs/classes/HMSLayer.js +14 -0
- package/lib/commonjs/classes/HMSLayer.js.map +1 -0
- package/lib/commonjs/classes/HMSLocalVideoStats.js +11 -0
- package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalVideoTrack.js +5 -6
- package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSMessage.js +1 -2
- package/lib/commonjs/classes/HMSMessage.js.map +1 -1
- package/lib/commonjs/classes/HMSPeer.js +3 -4
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSPublishSettings.js +2 -0
- package/lib/commonjs/classes/HMSPublishSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSQualityLimitationReason.js +16 -0
- package/lib/commonjs/classes/HMSQualityLimitationReason.js.map +1 -0
- package/lib/commonjs/classes/HMSQualityLimitationReasons.js +27 -0
- package/lib/commonjs/classes/HMSQualityLimitationReasons.js.map +1 -0
- package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
- package/lib/commonjs/classes/HMSRemoteVideoTrack.js +39 -4
- package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSRoom.js +4 -0
- package/lib/commonjs/classes/HMSRoom.js.map +1 -1
- package/lib/commonjs/classes/HMSRoomUpdate.js +1 -0
- package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +70 -62
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSSimulcastLayerDefinition.js +19 -0
- package/lib/commonjs/classes/HMSSimulcastLayerDefinition.js.map +1 -0
- package/lib/commonjs/classes/HMSSimulcastLayerSettingsPolicy.js +23 -0
- package/lib/commonjs/classes/HMSSimulcastLayerSettingsPolicy.js.map +1 -0
- package/lib/commonjs/classes/HMSSimulcastSettings.js +5 -4
- package/lib/commonjs/classes/HMSSimulcastSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSSimulcastSettingsPolicy.js +17 -0
- package/lib/commonjs/classes/HMSSimulcastSettingsPolicy.js.map +1 -0
- package/lib/commonjs/classes/HMSSubscribeDegradationPolicy.js +21 -0
- package/lib/commonjs/classes/HMSSubscribeDegradationPolicy.js.map +1 -0
- package/lib/commonjs/classes/HMSSubscribeSettings.js +2 -0
- package/lib/commonjs/classes/HMSSubscribeSettings.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoResolution.js.map +1 -1
- package/lib/commonjs/classes/HMSVideoTrackSettings.js +1 -1
- package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/commonjs/classes/HmsView.js +2 -0
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/index.js +60 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/classes/HMSAudioTrackSettings.js +1 -1
- package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
- package/lib/module/classes/HMSCameraControl.js +21 -0
- package/lib/module/classes/HMSCameraControl.js.map +1 -0
- package/lib/module/classes/HMSEncoder.js +95 -13
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSException.js +3 -4
- package/lib/module/classes/HMSException.js.map +1 -1
- package/lib/module/classes/HMSLayer.js +7 -0
- package/lib/module/classes/HMSLayer.js.map +1 -0
- package/lib/module/classes/HMSLocalVideoStats.js +11 -0
- package/lib/module/classes/HMSLocalVideoStats.js.map +1 -1
- package/lib/module/classes/HMSLocalVideoTrack.js +5 -6
- package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSMessage.js +1 -2
- package/lib/module/classes/HMSMessage.js.map +1 -1
- package/lib/module/classes/HMSPeer.js +3 -4
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSPublishSettings.js +2 -0
- package/lib/module/classes/HMSPublishSettings.js.map +1 -1
- package/lib/module/classes/HMSQualityLimitationReason.js +9 -0
- package/lib/module/classes/HMSQualityLimitationReason.js.map +1 -0
- package/lib/module/classes/HMSQualityLimitationReasons.js +20 -0
- package/lib/module/classes/HMSQualityLimitationReasons.js.map +1 -0
- package/lib/module/classes/HMSRemotePeer.js.map +1 -1
- package/lib/module/classes/HMSRemoteVideoTrack.js +39 -4
- package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
- package/lib/module/classes/HMSRoom.js +4 -0
- package/lib/module/classes/HMSRoom.js.map +1 -1
- package/lib/module/classes/HMSRoomUpdate.js +1 -0
- package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +71 -62
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSSimulcastLayerDefinition.js +12 -0
- package/lib/module/classes/HMSSimulcastLayerDefinition.js.map +1 -0
- package/lib/module/classes/HMSSimulcastLayerSettingsPolicy.js +16 -0
- package/lib/module/classes/HMSSimulcastLayerSettingsPolicy.js.map +1 -0
- package/lib/module/classes/HMSSimulcastSettings.js +5 -4
- package/lib/module/classes/HMSSimulcastSettings.js.map +1 -1
- package/lib/module/classes/HMSSimulcastSettingsPolicy.js +10 -0
- package/lib/module/classes/HMSSimulcastSettingsPolicy.js.map +1 -0
- package/lib/module/classes/HMSSubscribeDegradationPolicy.js +14 -0
- package/lib/module/classes/HMSSubscribeDegradationPolicy.js.map +1 -0
- package/lib/module/classes/HMSSubscribeSettings.js +2 -0
- package/lib/module/classes/HMSSubscribeSettings.js.map +1 -1
- package/lib/module/classes/HMSVideoResolution.js.map +1 -1
- package/lib/module/classes/HMSVideoTrackSettings.js +1 -1
- package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/module/classes/HmsView.js +2 -0
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/classes/HMSCameraControl.d.ts +9 -0
- package/lib/typescript/classes/HMSEncoder.d.ts +13 -1
- package/lib/typescript/classes/HMSLayer.d.ts +5 -0
- package/lib/typescript/classes/HMSLocalVideoStats.d.ts +6 -0
- package/lib/typescript/classes/HMSPeer.d.ts +1 -1
- package/lib/typescript/classes/HMSPublishSettings.d.ts +3 -0
- package/lib/typescript/classes/HMSQualityLimitationReason.d.ts +7 -0
- package/lib/typescript/classes/HMSQualityLimitationReasons.d.ts +17 -0
- package/lib/typescript/classes/HMSRemotePeer.d.ts +0 -1
- package/lib/typescript/classes/HMSRemoteVideoTrack.d.ts +6 -2
- package/lib/typescript/classes/HMSRoomUpdate.d.ts +2 -1
- package/lib/typescript/classes/HMSSDK.d.ts +24 -42
- package/lib/typescript/classes/HMSSimulcastLayerDefinition.d.ts +10 -0
- package/lib/typescript/classes/HMSSimulcastLayerSettingsPolicy.d.ts +12 -0
- package/lib/typescript/classes/HMSSimulcastSettings.d.ts +7 -3
- package/lib/typescript/classes/HMSSimulcastSettingsPolicy.d.ts +7 -0
- package/lib/typescript/classes/HMSSubscribeDegradationPolicy.d.ts +10 -0
- package/lib/typescript/classes/HMSSubscribeSettings.d.ts +5 -2
- package/lib/typescript/classes/HMSVideoResolution.d.ts +2 -2
- package/lib/typescript/classes/HmsView.d.ts +2 -2
- package/lib/typescript/index.d.ts +5 -0
- package/package.json +2 -2
- package/sdk-versions.json +3 -3
- package/src/classes/HMSCameraControl.ts +21 -0
- package/src/classes/HMSEncoder.ts +125 -11
- package/src/classes/HMSLayer.ts +5 -0
- package/src/classes/HMSLocalVideoStats.ts +21 -0
- package/src/classes/HMSPeer.ts +1 -1
- package/src/classes/HMSPublishSettings.ts +4 -0
- package/src/classes/HMSQualityLimitationReason.ts +7 -0
- package/src/classes/HMSQualityLimitationReasons.ts +27 -0
- package/src/classes/HMSRemotePeer.ts +0 -1
- package/src/classes/HMSRemoteVideoTrack.ts +52 -4
- package/src/classes/HMSRoom.ts +2 -0
- package/src/classes/HMSRoomUpdate.ts +1 -0
- package/src/classes/HMSSDK.tsx +99 -67
- package/src/classes/HMSSimulcastLayerDefinition.ts +12 -0
- package/src/classes/HMSSimulcastLayerSettingsPolicy.ts +18 -0
- package/src/classes/HMSSimulcastSettings.ts +12 -3
- package/src/classes/HMSSimulcastSettingsPolicy.ts +9 -0
- package/src/classes/HMSSubscribeDegradationPolicy.ts +15 -0
- package/src/classes/HMSSubscribeSettings.ts +10 -2
- package/src/classes/HMSVideoResolution.ts +1 -1
- package/src/classes/HmsView.tsx +5 -1
- package/src/index.ts +5 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class HMSSubscribeDegradationPolicy {
|
|
2
|
+
packetLossThreshold?: number;
|
|
3
|
+
degradeGracePeriodSeconds?: number;
|
|
4
|
+
recoverGracePeriodSeconds?: number;
|
|
5
|
+
constructor(params: {
|
|
6
|
+
packetLossThreshold?: number;
|
|
7
|
+
degradeGracePeriodSeconds?: number;
|
|
8
|
+
recoverGracePeriodSeconds?: number;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { HMSSubscribeDegradationPolicy } from './HMSSubscribeDegradationPolicy';
|
|
1
2
|
export declare class HMSSubscribeSettings {
|
|
2
|
-
subscribeTo?: [
|
|
3
|
+
subscribeTo?: string[];
|
|
3
4
|
maxSubsBitRate: number;
|
|
5
|
+
subscribeDegradation?: HMSSubscribeDegradationPolicy;
|
|
4
6
|
constructor(params: {
|
|
5
|
-
subscribeTo?: [
|
|
7
|
+
subscribeTo?: string[];
|
|
6
8
|
maxSubsBitRate: number;
|
|
9
|
+
subscribeDegradation?: HMSSubscribeDegradationPolicy;
|
|
7
10
|
});
|
|
8
11
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ViewStyle } from 'react-native';
|
|
3
3
|
import { HMSVideoViewMode } from './HMSVideoViewMode';
|
|
4
|
-
interface HmsComponentProps {
|
|
4
|
+
export interface HmsComponentProps {
|
|
5
5
|
trackId: string;
|
|
6
6
|
style?: ViewStyle;
|
|
7
7
|
mirror?: boolean;
|
|
8
|
+
autoSimulcast?: boolean;
|
|
8
9
|
scaleType?: HMSVideoViewMode;
|
|
9
10
|
setZOrderMediaOverlay?: boolean;
|
|
10
11
|
id: string;
|
|
11
12
|
}
|
|
12
13
|
export declare const HmsViewComponent: React.ForwardRefExoticComponent<HmsComponentProps & React.RefAttributes<any>>;
|
|
13
|
-
export {};
|
|
@@ -75,6 +75,11 @@ export * from './classes/HMSLogSettings';
|
|
|
75
75
|
export * from './classes/HMSLogAlarmManager';
|
|
76
76
|
export * from './classes/HMSMessageType';
|
|
77
77
|
export * from './classes/HMSPIPListenerActions';
|
|
78
|
+
export * from './classes/HMSLayer';
|
|
79
|
+
export * from './classes/HMSSimulcastLayerDefinition';
|
|
80
|
+
export * from './classes/HMSQualityLimitationReasons';
|
|
81
|
+
export * from './classes/HMSQualityLimitationReason';
|
|
82
|
+
export * from './classes/HMSCameraControl';
|
|
78
83
|
export type { HmsViewComponent as HMSView } from './classes/HmsView';
|
|
79
84
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
80
85
|
export default HmsManager;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@100mslive/react-native-hms",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "Integrate Real Time Audio and Video conferencing, Interactive Live Streaming, and Chat in your apps with 100ms React Native SDK. With support for HLS and RTMP Live Streaming and Recording, Picture-in-Picture (PiP), one-to-one Video Call Modes, Audio Rooms, Video Player and much more, add immersive real-time communications to your apps.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
7
7
|
"types": "lib/typescript/index.d.ts",
|
package/sdk-versions.json
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NativeModules } from 'react-native';
|
|
2
|
+
import { HMSConstants } from './HMSConstants';
|
|
3
|
+
|
|
4
|
+
const { HMSManager } = NativeModules;
|
|
5
|
+
|
|
6
|
+
export class HMSCameraControl {
|
|
7
|
+
/**
|
|
8
|
+
* It captures the image from the device camera at max possible resolution.
|
|
9
|
+
*
|
|
10
|
+
* @param {boolean} [flash=false] flash - value indicating whether to use flash while capturing image or not
|
|
11
|
+
* @returns Promise - which is resolved with the file path of the captured image saved on the disk
|
|
12
|
+
*/
|
|
13
|
+
static captureImageAtMaxSupportedResolution(
|
|
14
|
+
flash: boolean = false
|
|
15
|
+
): Promise<string> {
|
|
16
|
+
return HMSManager.captureImageAtMaxSupportedResolution({
|
|
17
|
+
id: HMSConstants.DEFAULT_SDK_ID,
|
|
18
|
+
flash,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -32,6 +32,13 @@ import { HMSMessageRecipient } from './HMSMessageRecipient';
|
|
|
32
32
|
import { HMSException } from './HMSException';
|
|
33
33
|
import { HMSConstants } from './HMSConstants';
|
|
34
34
|
import { HMSPeerUpdateOrdinals } from './HMSPeerUpdate';
|
|
35
|
+
import { HMSLocalAudioStats } from './HMSLocalAudioStats';
|
|
36
|
+
import { HMSLocalVideoStats } from './HMSLocalVideoStats';
|
|
37
|
+
import { HMSRemoteAudioStats } from './HMSRemoteAudioStats';
|
|
38
|
+
import { HMSRemoteVideoStats } from './HMSRemoteVideoStats';
|
|
39
|
+
import { HMSLayer } from './HMSLayer';
|
|
40
|
+
import { HMSSimulcastLayerDefinition } from './HMSSimulcastLayerDefinition';
|
|
41
|
+
import { HMSQualityLimitationReasons } from './HMSQualityLimitationReasons';
|
|
35
42
|
|
|
36
43
|
const { HMSManager } = NativeModules;
|
|
37
44
|
|
|
@@ -46,10 +53,10 @@ export class HMSEncoder {
|
|
|
46
53
|
this.data = { roles: {} };
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
static encodeHmsRoom(room:
|
|
56
|
+
static encodeHmsRoom(room: any, id: string) {
|
|
50
57
|
const encodedObj = {
|
|
51
58
|
id: room?.id,
|
|
52
|
-
sessionId: room?.sessionId,
|
|
59
|
+
sessionId: room?.sessionId || undefined,
|
|
53
60
|
metaData: room?.metaData,
|
|
54
61
|
name: room?.name,
|
|
55
62
|
peerCount: room?.peerCount,
|
|
@@ -70,6 +77,7 @@ export class HMSEncoder {
|
|
|
70
77
|
room?.hlsRecordingState
|
|
71
78
|
),
|
|
72
79
|
localPeer: HMSEncoder.encodeHmsLocalPeer(room?.localPeer, id),
|
|
80
|
+
// startedAt: HMSEncoder.encodeDate(room?.startedAt),
|
|
73
81
|
};
|
|
74
82
|
|
|
75
83
|
return new HMSRoom(encodedObj);
|
|
@@ -278,7 +286,6 @@ export class HMSEncoder {
|
|
|
278
286
|
trackId: peer?.remoteVideoTrackData?.trackId,
|
|
279
287
|
source: peer?.remoteVideoTrackData?.source,
|
|
280
288
|
trackDescription: peer?.remoteVideoTrackData?.trackDescription,
|
|
281
|
-
layer: peer?.remoteVideoTrackData?.layer,
|
|
282
289
|
isMute: peer?.remoteVideoTrackData?.isMute,
|
|
283
290
|
playbackAllowed: peer?.remoteVideoTrackData?.playbackAllowed,
|
|
284
291
|
}
|
|
@@ -307,7 +314,6 @@ export class HMSEncoder {
|
|
|
307
314
|
trackId: track?.trackId,
|
|
308
315
|
source: track?.source,
|
|
309
316
|
trackDescription: track?.trackDescription,
|
|
310
|
-
layer: track?.layer,
|
|
311
317
|
isMute: track?.isMute,
|
|
312
318
|
playbackAllowed: track?.playbackAllowed,
|
|
313
319
|
};
|
|
@@ -393,14 +399,24 @@ export class HMSEncoder {
|
|
|
393
399
|
}
|
|
394
400
|
|
|
395
401
|
static encodeRTCStatsUnit(data: any) {
|
|
402
|
+
const [
|
|
403
|
+
bitrateReceived,
|
|
404
|
+
bitrateSent,
|
|
405
|
+
bytesReceived,
|
|
406
|
+
bytesSent,
|
|
407
|
+
packetsLost,
|
|
408
|
+
packetsReceived,
|
|
409
|
+
roundTripTime,
|
|
410
|
+
] = data;
|
|
411
|
+
|
|
396
412
|
return new HMSRTCStats({
|
|
397
|
-
bitrateReceived
|
|
398
|
-
bitrateSent
|
|
399
|
-
bytesReceived
|
|
400
|
-
bytesSent
|
|
401
|
-
packetsLost
|
|
402
|
-
packetsReceived
|
|
403
|
-
roundTripTime
|
|
413
|
+
bitrateReceived,
|
|
414
|
+
bitrateSent,
|
|
415
|
+
bytesReceived,
|
|
416
|
+
bytesSent,
|
|
417
|
+
packetsLost,
|
|
418
|
+
packetsReceived,
|
|
419
|
+
roundTripTime,
|
|
404
420
|
});
|
|
405
421
|
}
|
|
406
422
|
|
|
@@ -544,4 +560,102 @@ export class HMSEncoder {
|
|
|
544
560
|
canRetry: data?.error?.canRetry,
|
|
545
561
|
});
|
|
546
562
|
}
|
|
563
|
+
|
|
564
|
+
static encodeHMSLocalAudioStats(data: any) {
|
|
565
|
+
const [bitrate, bytesSent, roundTripTime] = data;
|
|
566
|
+
|
|
567
|
+
return new HMSLocalAudioStats({
|
|
568
|
+
bitrate: bitrate >= 0 ? bitrate : undefined,
|
|
569
|
+
bytesSent: bytesSent ? bytesSent : undefined,
|
|
570
|
+
roundTripTime: roundTripTime >= 0 ? roundTripTime : undefined,
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
static encodeHMSLocalVideoStats(data: any[]) {
|
|
575
|
+
return data.map((item: any) => {
|
|
576
|
+
const [
|
|
577
|
+
bitrate,
|
|
578
|
+
bytesSent,
|
|
579
|
+
roundTripTime,
|
|
580
|
+
frameRate,
|
|
581
|
+
resolution,
|
|
582
|
+
layer,
|
|
583
|
+
qualityLimitationReasons,
|
|
584
|
+
] = item;
|
|
585
|
+
|
|
586
|
+
return new HMSLocalVideoStats({
|
|
587
|
+
bitrate: bitrate >= 0 ? bitrate : undefined,
|
|
588
|
+
bytesSent: bytesSent ? bytesSent : undefined,
|
|
589
|
+
roundTripTime: roundTripTime >= 0 ? roundTripTime : undefined,
|
|
590
|
+
frameRate: frameRate >= 0 ? frameRate : undefined,
|
|
591
|
+
resolution: resolution
|
|
592
|
+
? { width: resolution[0], height: resolution[1] }
|
|
593
|
+
: undefined, // resolution: [width, height]
|
|
594
|
+
layer: layer ? layer : undefined,
|
|
595
|
+
qualityLimitationReasons: qualityLimitationReasons
|
|
596
|
+
? this.encodeHMSQualityLimitationReasons(qualityLimitationReasons)
|
|
597
|
+
: undefined,
|
|
598
|
+
});
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
static encodeHMSRemoteAudioStats(data: any) {
|
|
603
|
+
const [bitrate, bytesReceived, jitter, packetsLost, packetsReceived] = data;
|
|
604
|
+
|
|
605
|
+
return new HMSRemoteAudioStats({
|
|
606
|
+
bitrate: bitrate >= 0 ? bitrate : undefined,
|
|
607
|
+
bytesReceived: bytesReceived ? bytesReceived : undefined,
|
|
608
|
+
jitter: jitter >= 0 ? jitter : undefined,
|
|
609
|
+
packetsLost: packetsLost >= 0 ? packetsLost : undefined,
|
|
610
|
+
packetsReceived: packetsReceived ? packetsReceived : undefined,
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
static encodeHMSRemoteVideoStats(data: any) {
|
|
615
|
+
const [
|
|
616
|
+
bitrate,
|
|
617
|
+
bytesReceived,
|
|
618
|
+
frameRate,
|
|
619
|
+
jitter,
|
|
620
|
+
packetsLost,
|
|
621
|
+
packetsReceived,
|
|
622
|
+
resolution,
|
|
623
|
+
] = data;
|
|
624
|
+
|
|
625
|
+
return new HMSRemoteVideoStats({
|
|
626
|
+
bitrate: bitrate >= 0 ? bitrate : undefined,
|
|
627
|
+
bytesReceived: bytesReceived ? bytesReceived : undefined,
|
|
628
|
+
frameRate: frameRate >= 0 ? frameRate : undefined,
|
|
629
|
+
jitter: jitter >= 0 ? jitter : undefined,
|
|
630
|
+
packetsLost: packetsLost >= 0 ? packetsLost : undefined,
|
|
631
|
+
packetsReceived: packetsReceived ? packetsReceived : undefined,
|
|
632
|
+
resolution: resolution
|
|
633
|
+
? { width: resolution[0], height: resolution[1] }
|
|
634
|
+
: undefined, // resolution: [width, height]
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
static encodeHMSSimulcastLayerDefinition(data: any[]) {
|
|
639
|
+
return data.map((sld) => {
|
|
640
|
+
return new HMSSimulcastLayerDefinition({
|
|
641
|
+
layer: HMSLayer[sld.layer as HMSLayer], // DOUBT: This can be invalid. Should we throw error?
|
|
642
|
+
resolution: this.encodeHmsVideoResolution({
|
|
643
|
+
width: sld.resolution[0],
|
|
644
|
+
height: sld.resolution[1],
|
|
645
|
+
}),
|
|
646
|
+
});
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
static encodeHMSQualityLimitationReasons(data: any) {
|
|
651
|
+
return new HMSQualityLimitationReasons({
|
|
652
|
+
reason: data.reason,
|
|
653
|
+
bandwidth: data.bandwidth,
|
|
654
|
+
cpu: data.cpu,
|
|
655
|
+
none: data.none,
|
|
656
|
+
other: data.other,
|
|
657
|
+
qualityLimitationResolutionChanges:
|
|
658
|
+
data.qualityLimitationResolutionChanges,
|
|
659
|
+
});
|
|
660
|
+
}
|
|
547
661
|
}
|
|
@@ -1,23 +1,44 @@
|
|
|
1
|
+
import type { HMSLayer } from './HMSLayer';
|
|
2
|
+
import type { HMSQualityLimitationReasons } from './HMSQualityLimitationReasons';
|
|
1
3
|
import type { HMSVideoResolution } from './HMSVideoResolution';
|
|
2
4
|
|
|
3
5
|
export class HMSLocalVideoStats {
|
|
6
|
+
// Outgoing bitrate of this track observed since previous report in Kb/s.
|
|
4
7
|
bitrate?: number;
|
|
8
|
+
|
|
9
|
+
// Total bytes sent by this track in the current session.
|
|
5
10
|
bytesSent?: number;
|
|
11
|
+
|
|
12
|
+
// Round trip time observed since previous report
|
|
6
13
|
roundTripTime?: number;
|
|
14
|
+
|
|
15
|
+
// Frame rate of video frames being sent (FPS)
|
|
7
16
|
frameRate?: number;
|
|
17
|
+
|
|
18
|
+
// Resolution of video frames being sent
|
|
8
19
|
resolution?: HMSVideoResolution;
|
|
9
20
|
|
|
21
|
+
// Reason for quality limitations
|
|
22
|
+
qualityLimitationReasons?: HMSQualityLimitationReasons;
|
|
23
|
+
|
|
24
|
+
/// Simulcast Layer
|
|
25
|
+
layer?: HMSLayer;
|
|
26
|
+
|
|
10
27
|
constructor(params: {
|
|
11
28
|
bitrate?: number;
|
|
12
29
|
bytesSent?: number;
|
|
13
30
|
roundTripTime?: number;
|
|
14
31
|
frameRate?: number;
|
|
15
32
|
resolution?: HMSVideoResolution;
|
|
33
|
+
qualityLimitationReasons?: HMSQualityLimitationReasons;
|
|
34
|
+
layer?: HMSLayer;
|
|
16
35
|
}) {
|
|
17
36
|
this.bitrate = params.bitrate;
|
|
18
37
|
this.bytesSent = params.bytesSent;
|
|
19
38
|
this.roundTripTime = params.roundTripTime;
|
|
20
39
|
this.frameRate = params.frameRate;
|
|
21
40
|
this.resolution = params.resolution;
|
|
41
|
+
this.qualityLimitationReasons = params.qualityLimitationReasons;
|
|
42
|
+
this.layer = params.layer;
|
|
22
43
|
}
|
|
23
44
|
}
|
package/src/classes/HMSPeer.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { HMSConstants } from './HMSConstants';
|
|
|
9
9
|
export class HMSPeer {
|
|
10
10
|
peerID: string;
|
|
11
11
|
/**
|
|
12
|
-
* @deprecated customerDescription has been deprecated in favor of metadata
|
|
12
|
+
* @deprecated customerDescription property has been deprecated in favor of metadata property
|
|
13
13
|
*/
|
|
14
14
|
customerDescription?: string;
|
|
15
15
|
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import type { HMSAudioSettings } from './HMSAudioSettings';
|
|
2
2
|
import type { HMSVideoSettings } from './HMSVideoSettings';
|
|
3
|
+
import type { HMSSimulcastSettings } from './HMSSimulcastSettings';
|
|
3
4
|
|
|
4
5
|
export class HMSPublishSettings {
|
|
5
6
|
audio?: HMSAudioSettings;
|
|
6
7
|
video?: HMSVideoSettings;
|
|
7
8
|
screen?: HMSVideoSettings;
|
|
8
9
|
allowed?: string[];
|
|
10
|
+
simulcast?: HMSSimulcastSettings;
|
|
9
11
|
|
|
10
12
|
constructor(params: {
|
|
11
13
|
audio?: HMSAudioSettings;
|
|
12
14
|
video?: HMSVideoSettings;
|
|
13
15
|
screen?: HMSVideoSettings;
|
|
14
16
|
allowed?: string[];
|
|
17
|
+
simulcast?: HMSSimulcastSettings;
|
|
15
18
|
}) {
|
|
16
19
|
this.audio = params.audio;
|
|
17
20
|
this.video = params.video;
|
|
18
21
|
this.screen = params.screen;
|
|
19
22
|
this.allowed = params.allowed;
|
|
23
|
+
this.simulcast = params.simulcast;
|
|
20
24
|
}
|
|
21
25
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HMSQualityLimitationReason } from './HMSQualityLimitationReason';
|
|
2
|
+
|
|
3
|
+
export class HMSQualityLimitationReasons {
|
|
4
|
+
bandwidth?: number;
|
|
5
|
+
cpu?: number;
|
|
6
|
+
none?: number;
|
|
7
|
+
other?: number;
|
|
8
|
+
qualityLimitationResolutionChanges?: number;
|
|
9
|
+
reason: HMSQualityLimitationReason;
|
|
10
|
+
|
|
11
|
+
constructor(params: {
|
|
12
|
+
bandwidth?: number;
|
|
13
|
+
cpu?: number;
|
|
14
|
+
none?: number;
|
|
15
|
+
other?: number;
|
|
16
|
+
qualityLimitationResolutionChanges?: number;
|
|
17
|
+
reason: HMSQualityLimitationReason;
|
|
18
|
+
}) {
|
|
19
|
+
this.bandwidth = params.bandwidth;
|
|
20
|
+
this.cpu = params.cpu;
|
|
21
|
+
this.none = params.none;
|
|
22
|
+
this.other = params.other;
|
|
23
|
+
this.qualityLimitationResolutionChanges =
|
|
24
|
+
params.qualityLimitationResolutionChanges;
|
|
25
|
+
this.reason = params.reason;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -2,6 +2,9 @@ import { NativeModules } from 'react-native';
|
|
|
2
2
|
import { getLogger } from './HMSLogger';
|
|
3
3
|
import { HMSVideoTrack } from './HMSVideoTrack';
|
|
4
4
|
import type { HMSTrackType } from './HMSTrackType';
|
|
5
|
+
import type { HMSLayer } from './HMSLayer';
|
|
6
|
+
import type { HMSSimulcastLayerDefinition } from './HMSSimulcastLayerDefinition';
|
|
7
|
+
import { HMSEncoder } from './HMSEncoder';
|
|
5
8
|
|
|
6
9
|
const {
|
|
7
10
|
/**
|
|
@@ -11,8 +14,6 @@ const {
|
|
|
11
14
|
} = NativeModules;
|
|
12
15
|
|
|
13
16
|
export class HMSRemoteVideoTrack extends HMSVideoTrack {
|
|
14
|
-
layer?: any; //TODO: layer to be made HMSSimulcastLayer type
|
|
15
|
-
|
|
16
17
|
/**
|
|
17
18
|
* Switches Video of remote user on/off depending upon the value of playbackAllowed
|
|
18
19
|
*
|
|
@@ -54,17 +55,64 @@ export class HMSRemoteVideoTrack extends HMSVideoTrack {
|
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
57
|
|
|
58
|
+
async getLayer() {
|
|
59
|
+
const logger = getLogger();
|
|
60
|
+
logger?.verbose('#Function getLayer', {
|
|
61
|
+
id: this.id,
|
|
62
|
+
trackId: this.trackId,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const layer: HMSLayer = await HMSManager.getVideoTrackLayer({
|
|
66
|
+
id: this.id,
|
|
67
|
+
trackId: this.trackId,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return layer;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async getLayerDefinition() {
|
|
74
|
+
const logger = getLogger();
|
|
75
|
+
logger?.verbose('#Function getLayerDefinition', {
|
|
76
|
+
id: this.id,
|
|
77
|
+
trackId: this.trackId,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const layerDefinition: HMSSimulcastLayerDefinition[] =
|
|
81
|
+
await HMSManager.getVideoTrackLayerDefinition({
|
|
82
|
+
id: this.id,
|
|
83
|
+
trackId: this.trackId,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return HMSEncoder.encodeHMSSimulcastLayerDefinition(layerDefinition);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async setLayer(layer: HMSLayer) {
|
|
90
|
+
const logger = getLogger();
|
|
91
|
+
logger?.verbose('#Function setVideoTrackLayer', {
|
|
92
|
+
id: this.id,
|
|
93
|
+
trackId: this.trackId,
|
|
94
|
+
layer,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const success = await HMSManager.setVideoTrackLayer({
|
|
98
|
+
id: this.id,
|
|
99
|
+
trackId: this.trackId,
|
|
100
|
+
layer,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return success;
|
|
104
|
+
}
|
|
105
|
+
|
|
57
106
|
constructor(params: {
|
|
58
107
|
trackId: string;
|
|
59
108
|
source?: number | string;
|
|
60
109
|
trackDescription?: string;
|
|
61
110
|
isMute?: boolean;
|
|
62
|
-
layer?: any;
|
|
63
111
|
playbackAllowed?: boolean;
|
|
64
112
|
id: string;
|
|
113
|
+
isDegraded?: boolean;
|
|
65
114
|
type?: HMSTrackType;
|
|
66
115
|
}) {
|
|
67
116
|
super(params);
|
|
68
|
-
this.layer = params.layer;
|
|
69
117
|
}
|
|
70
118
|
}
|
package/src/classes/HMSRoom.ts
CHANGED
|
@@ -10,9 +10,11 @@ import { HMSConstants } from './HMSConstants';
|
|
|
10
10
|
|
|
11
11
|
export class HMSRoom {
|
|
12
12
|
id: string;
|
|
13
|
+
// startedAt?: Date;
|
|
13
14
|
|
|
14
15
|
constructor(params: { id: string }) {
|
|
15
16
|
this.id = params.id;
|
|
17
|
+
// this.startedAt = params.startedAt;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
get sessionId(): string {
|
|
@@ -6,4 +6,5 @@ export enum HMSRoomUpdate {
|
|
|
6
6
|
BROWSER_RECORDING_STATE_UPDATED = 'BROWSER_RECORDING_STATE_UPDATED',
|
|
7
7
|
HLS_STREAMING_STATE_UPDATED = 'HLS_STREAMING_STATE_UPDATED',
|
|
8
8
|
HLS_RECORDING_STATE_UPDATED = 'HLS_RECORDING_STATE_UPDATED',
|
|
9
|
+
ROOM_PEER_COUNT_UPDATED = 'ROOM_PEER_COUNT_UPDATED',
|
|
9
10
|
}
|