@100mslive/react-native-hms 1.4.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/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 +42 -14
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +202 -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 +9 -2
- package/ios/HMSManager.swift +142 -74
- package/ios/HMSRNSDK.swift +393 -181
- package/ios/HMSView.m +1 -0
- package/ios/HMSView.swift +21 -19
- 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/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/HMSPeer.js +1 -1
- 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 -3
- 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 +32 -45
- 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/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/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/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/HMSPeer.js +1 -1
- 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 -3
- 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 +33 -45
- 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/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 +5 -31
- 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 +1 -1
- 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 +54 -48
- 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
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
|
}
|
package/src/classes/HMSSDK.tsx
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AppState, NativeModules, Platform
|
|
2
|
+
import { AppState, NativeModules, Platform } from 'react-native';
|
|
3
3
|
import { HMSEncoder } from './HMSEncoder';
|
|
4
4
|
import { HMSHelper } from './HMSHelper';
|
|
5
|
-
import { HMSLocalAudioStats } from './HMSLocalAudioStats';
|
|
6
|
-
import { HMSLocalVideoStats } from './HMSLocalVideoStats';
|
|
7
5
|
import { getLogger, logger, setLogger } from './HMSLogger';
|
|
8
|
-
import { HMSRemoteAudioStats } from './HMSRemoteAudioStats';
|
|
9
|
-
import { HMSRemoteVideoStats } from './HMSRemoteVideoStats';
|
|
10
6
|
import { HMSTrackType } from './HMSTrackType';
|
|
11
7
|
import { HMSUpdateListenerActions } from './HMSUpdateListenerActions';
|
|
12
|
-
import { HmsViewComponent } from './HmsView';
|
|
8
|
+
import { HmsViewComponent, HmsComponentProps } from './HmsView';
|
|
13
9
|
|
|
14
10
|
import type { HMSConfig } from './HMSConfig';
|
|
15
11
|
import type { HMSLocalPeer } from './HMSLocalPeer';
|
|
@@ -47,14 +43,9 @@ import {
|
|
|
47
43
|
} from './HMSRoomCache';
|
|
48
44
|
import { HMSPeerUpdateOrdinals } from './HMSPeerUpdate';
|
|
49
45
|
|
|
50
|
-
|
|
51
|
-
trackId: string;
|
|
52
|
-
style?: ViewStyle;
|
|
53
|
-
mirror?: boolean;
|
|
54
|
-
scaleType?: HMSVideoViewMode;
|
|
55
|
-
setZOrderMediaOverlay?: boolean;
|
|
56
|
-
}
|
|
46
|
+
type HmsViewProps = Omit<HmsComponentProps, 'id'>;
|
|
57
47
|
|
|
48
|
+
// TODO: Rename to HMSPIPConfig & to be moved to a separate file
|
|
58
49
|
interface PIPConfig {
|
|
59
50
|
aspectRatio?: [number, number];
|
|
60
51
|
endButton?: boolean;
|
|
@@ -250,6 +241,7 @@ export class HMSSDK {
|
|
|
250
241
|
* - The appearance of tile is completely customizable with style prop.
|
|
251
242
|
* - Scale type can determine how the incoming video will fit in the canvas check {@link HMSVideoViewMode} for more information.
|
|
252
243
|
* - Mirror to flip the video vertically.
|
|
244
|
+
* - Auto Simulcast to automatically select the best Streaming Quality of track if feature is enabled in Room.
|
|
253
245
|
*
|
|
254
246
|
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/render-video} for more info
|
|
255
247
|
*
|
|
@@ -257,12 +249,20 @@ export class HMSSDK {
|
|
|
257
249
|
* @memberof HMSSDK
|
|
258
250
|
*/
|
|
259
251
|
HmsView = React.forwardRef<any, HmsViewProps>((props, ref) => {
|
|
260
|
-
const {
|
|
252
|
+
const {
|
|
253
|
+
trackId,
|
|
254
|
+
style,
|
|
255
|
+
mirror,
|
|
256
|
+
scaleType,
|
|
257
|
+
setZOrderMediaOverlay,
|
|
258
|
+
autoSimulcast,
|
|
259
|
+
} = props;
|
|
261
260
|
return (
|
|
262
261
|
<HmsViewComponent
|
|
263
262
|
ref={ref}
|
|
264
263
|
trackId={trackId}
|
|
265
264
|
style={style}
|
|
265
|
+
autoSimulcast={autoSimulcast}
|
|
266
266
|
setZOrderMediaOverlay={setZOrderMediaOverlay}
|
|
267
267
|
mirror={mirror}
|
|
268
268
|
scaleType={scaleType}
|
|
@@ -845,36 +845,6 @@ export class HMSSDK {
|
|
|
845
845
|
return await HMSManager.stopScreenshare({ id: this.id });
|
|
846
846
|
};
|
|
847
847
|
|
|
848
|
-
/**
|
|
849
|
-
* - enableRTCStats sets a boolean in native side which in turn allows several events to be passed
|
|
850
|
-
* through the bridge these events are {@link RTCStatsListener}, {@link onRemoteVideoStatsListener},
|
|
851
|
-
* {@link onRemoteAudioStatsListener}, {@link onLocalAudioStatsListener} and {@link onLocalVideoStatsListener}
|
|
852
|
-
*
|
|
853
|
-
* - These listeners get various dataPoints for current peers and their connectivity to the room
|
|
854
|
-
* such as jitter, latency etc.
|
|
855
|
-
*
|
|
856
|
-
* - currently available for iOS only
|
|
857
|
-
*
|
|
858
|
-
* @memberof HMSSDK
|
|
859
|
-
*/
|
|
860
|
-
enableRTCStats = () => {
|
|
861
|
-
logger?.verbose('#Function enableRTCStats', { id: this.id });
|
|
862
|
-
HMSManager.enableRTCStats({ id: this.id });
|
|
863
|
-
};
|
|
864
|
-
|
|
865
|
-
/**
|
|
866
|
-
* - disable RTCStats sets the same boolean to false that was set true by enableRTCStats.
|
|
867
|
-
* that activates a check which filters out the events acquired in native listeners and don't
|
|
868
|
-
* let them pass through bridge
|
|
869
|
-
*
|
|
870
|
-
* - currently available for iOS only.
|
|
871
|
-
* @memberof HMSSDK
|
|
872
|
-
*/
|
|
873
|
-
disableRTCStats = () => {
|
|
874
|
-
logger?.verbose('#Function disableRTCStats', { id: this.id });
|
|
875
|
-
HMSManager.disableRTCStats({ id: this.id });
|
|
876
|
-
};
|
|
877
|
-
|
|
878
848
|
enableNetworkQualityUpdates = () => {
|
|
879
849
|
logger?.verbose('#Function enableNetworkQualityUpdates', { id: this.id });
|
|
880
850
|
HMSManager.enableNetworkQualityUpdates({ id: this.id });
|
|
@@ -1106,6 +1076,34 @@ export class HMSSDK {
|
|
|
1106
1076
|
return await HMSManager.getSessionMetaData({ id: this.id });
|
|
1107
1077
|
};
|
|
1108
1078
|
|
|
1079
|
+
getRemoteVideoTrackFromTrackId = async (trackId: string) => {
|
|
1080
|
+
logger?.verbose('#Function getRemoteVideoTrackFromTrackId', {
|
|
1081
|
+
id: this.id,
|
|
1082
|
+
trackId,
|
|
1083
|
+
});
|
|
1084
|
+
|
|
1085
|
+
const remoteVideoTrackData =
|
|
1086
|
+
await HMSManager.getRemoteVideoTrackFromTrackId({
|
|
1087
|
+
id: this.id,
|
|
1088
|
+
trackId,
|
|
1089
|
+
});
|
|
1090
|
+
return HMSEncoder.encodeHmsRemoteVideoTrack(remoteVideoTrackData, this.id);
|
|
1091
|
+
};
|
|
1092
|
+
|
|
1093
|
+
getRemoteAudioTrackFromTrackId = async (trackId: string) => {
|
|
1094
|
+
logger?.verbose('#Function getRemoteAudioTrackFromTrackId', {
|
|
1095
|
+
id: this.id,
|
|
1096
|
+
trackId,
|
|
1097
|
+
});
|
|
1098
|
+
|
|
1099
|
+
const remoteAudioTrackData =
|
|
1100
|
+
await HMSManager.getRemoteAudioTrackFromTrackId({
|
|
1101
|
+
id: this.id,
|
|
1102
|
+
trackId,
|
|
1103
|
+
});
|
|
1104
|
+
return HMSEncoder.encodeHmsRemoteAudioTrack(remoteAudioTrackData, this.id);
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1109
1107
|
/**
|
|
1110
1108
|
* - This is a prototype event listener that takes action and listens for updates related to that particular action
|
|
1111
1109
|
*
|
|
@@ -2105,7 +2103,9 @@ export class HMSSDK {
|
|
|
2105
2103
|
return;
|
|
2106
2104
|
}
|
|
2107
2105
|
|
|
2108
|
-
let localAudioStats =
|
|
2106
|
+
let localAudioStats = HMSEncoder.encodeHMSLocalAudioStats(
|
|
2107
|
+
data.localAudioStats
|
|
2108
|
+
);
|
|
2109
2109
|
let peer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
2110
2110
|
let track = HMSEncoder.encodeHmsLocalAudioTrack(data.track, this.id);
|
|
2111
2111
|
|
|
@@ -2125,7 +2125,9 @@ export class HMSSDK {
|
|
|
2125
2125
|
return;
|
|
2126
2126
|
}
|
|
2127
2127
|
|
|
2128
|
-
let localVideoStats =
|
|
2128
|
+
let localVideoStats = HMSEncoder.encodeHMSLocalVideoStats(
|
|
2129
|
+
data.localVideoStats
|
|
2130
|
+
);
|
|
2129
2131
|
let peer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
2130
2132
|
let track = HMSEncoder.encodeHmsLocalVideoTrack(data.track, this.id);
|
|
2131
2133
|
|
|
@@ -2145,7 +2147,9 @@ export class HMSSDK {
|
|
|
2145
2147
|
return;
|
|
2146
2148
|
}
|
|
2147
2149
|
|
|
2148
|
-
let remoteAudioStats =
|
|
2150
|
+
let remoteAudioStats = HMSEncoder.encodeHMSRemoteAudioStats(
|
|
2151
|
+
data.remoteAudioStats
|
|
2152
|
+
);
|
|
2149
2153
|
let peer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
2150
2154
|
let track = HMSEncoder.encodeHmsRemoteAudioTrack(data.track, this.id);
|
|
2151
2155
|
|
|
@@ -2170,7 +2174,9 @@ export class HMSSDK {
|
|
|
2170
2174
|
return;
|
|
2171
2175
|
}
|
|
2172
2176
|
|
|
2173
|
-
let remoteVideoStats =
|
|
2177
|
+
let remoteVideoStats = HMSEncoder.encodeHMSRemoteVideoStats(
|
|
2178
|
+
data.remoteVideoStats
|
|
2179
|
+
);
|
|
2174
2180
|
let peer = HMSEncoder.encodeHmsPeer(data.peer);
|
|
2175
2181
|
let track = HMSEncoder.encodeHmsRemoteVideoTrack(data.track, this.id);
|
|
2176
2182
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HMSLayer } from './HMSLayer';
|
|
2
|
+
import type { HMSVideoResolution } from './HMSVideoResolution';
|
|
3
|
+
|
|
4
|
+
export class HMSSimulcastLayerDefinition {
|
|
5
|
+
layer: HMSLayer;
|
|
6
|
+
resolution: HMSVideoResolution;
|
|
7
|
+
|
|
8
|
+
constructor(params: { layer: HMSLayer; resolution: HMSVideoResolution }) {
|
|
9
|
+
this.layer = params.layer;
|
|
10
|
+
this.resolution = params.resolution;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class HMSSimulcastLayerSettingsPolicy {
|
|
2
|
+
rid?: string;
|
|
3
|
+
scaleResolutionDownBy?: number;
|
|
4
|
+
maxBitrate?: number;
|
|
5
|
+
maxFramerate?: number;
|
|
6
|
+
|
|
7
|
+
constructor(params: {
|
|
8
|
+
rid?: string;
|
|
9
|
+
scaleResolutionDownBy?: number;
|
|
10
|
+
maxBitrate?: number;
|
|
11
|
+
maxFramerate?: number;
|
|
12
|
+
}) {
|
|
13
|
+
this.rid = params.rid;
|
|
14
|
+
this.scaleResolutionDownBy = params.scaleResolutionDownBy;
|
|
15
|
+
this.maxBitrate = params.maxBitrate;
|
|
16
|
+
this.maxFramerate = params.maxFramerate;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
import type { HMSSimulcastSettingsPolicy } from './HMSSimulcastSettingsPolicy';
|
|
2
|
+
|
|
1
3
|
export class HMSSimulcastSettings {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
video?: HMSSimulcastSettingsPolicy;
|
|
5
|
+
screen?: HMSSimulcastSettingsPolicy;
|
|
6
|
+
|
|
7
|
+
constructor(params: {
|
|
8
|
+
video?: HMSSimulcastSettingsPolicy;
|
|
9
|
+
screen?: HMSSimulcastSettingsPolicy;
|
|
10
|
+
}) {
|
|
11
|
+
this.video = params.video;
|
|
12
|
+
this.screen = params.screen;
|
|
13
|
+
}
|
|
5
14
|
}
|