@100mslive/react-native-hms 0.8.0 → 0.8.4
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/6.9/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- 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/build.gradle +1 -2
- package/android/src/main/java/com/reactnativehmssdk/HmsDecoder.kt +249 -230
- package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +145 -13
- package/android/src/main/java/com/reactnativehmssdk/HmsModule.kt +56 -21
- package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +463 -247
- package/android/src/main/java/com/reactnativehmssdk/HmsView.kt +15 -18
- package/android/src/main/java/com/reactnativehmssdk/HmssdkPackage.kt +1 -2
- package/android/src/main/java/com/reactnativehmssdk/HmssdkViewManager.kt +4 -10
- package/ios/HmsDecoder.swift +135 -35
- package/ios/HmsHelper.swift +103 -1
- package/ios/HmsManager.m +13 -9
- package/ios/HmsManager.swift +59 -24
- package/ios/HmsSDK.swift +322 -85
- package/ios/HmsView.swift +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/HMSChangeTrackStateRequest.js +3 -0
- package/lib/commonjs/classes/HMSChangeTrackStateRequest.js.map +1 -1
- package/lib/commonjs/classes/HMSConfig.js +3 -1
- package/lib/commonjs/classes/HMSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSEncoder.js +27 -7
- 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 +32 -0
- package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalVideoTrack.js +18 -0
- 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 +19 -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 +19 -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 +229 -125
- 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 +2 -19
- 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/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/HMSVideoTrackSettings.js +0 -3
- package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/commonjs/index.js +98 -0
- package/lib/commonjs/index.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/HMSChangeTrackStateRequest.js +3 -0
- package/lib/module/classes/HMSChangeTrackStateRequest.js.map +1 -1
- package/lib/module/classes/HMSConfig.js +3 -1
- package/lib/module/classes/HMSConfig.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +26 -7
- 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 +30 -1
- package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSLocalPeer.js.map +1 -1
- package/lib/module/classes/HMSLocalVideoTrack.js +15 -0
- 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 +16 -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 +16 -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 +227 -125
- 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 +2 -17
- 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/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/HMSVideoTrackSettings.js +0 -3
- package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -1
- 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/HMSChangeTrackStateRequest.d.ts +2 -0
- package/lib/typescript/classes/HMSConfig.d.ts +2 -0
- package/lib/typescript/classes/HMSEncoder.d.ts +3 -1
- package/lib/typescript/classes/HMSException.d.ts +22 -0
- package/lib/typescript/classes/HMSLocalAudioTrack.d.ts +1 -0
- package/lib/typescript/classes/HMSLocalPeer.d.ts +4 -0
- package/lib/typescript/classes/HMSLogger.d.ts +7 -0
- 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/HMSRemotePeer.d.ts +1 -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 +22 -13
- package/lib/typescript/classes/HMSServerRecordingState.d.ts +9 -0
- package/lib/typescript/classes/HMSTrack.d.ts +1 -1
- package/lib/typescript/classes/HMSTrackSettings.d.ts +2 -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/HMSVideoTrackSettings.d.ts +13 -10
- package/lib/typescript/index.d.ts +7 -0
- package/package.json +2 -1
- package/src/classes/HMSAudioTrackSettings.ts +9 -1
- package/src/classes/HMSBrowserRecordingState.ts +11 -0
- package/src/classes/HMSCameraFacing.ts +4 -0
- package/src/classes/HMSChangeTrackStateRequest.ts +7 -1
- package/src/classes/HMSConfig.ts +3 -1
- package/src/classes/HMSEncoder.ts +22 -2
- package/src/classes/HMSException.ts +33 -0
- package/src/classes/HMSHelper.ts +2 -2
- package/src/classes/HMSLocalAudioTrack.ts +29 -1
- package/src/classes/HMSLocalPeer.ts +4 -0
- package/src/classes/HMSLocalVideoTrack.ts +15 -0
- package/src/classes/HMSLogger.ts +14 -1
- 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 +16 -0
- package/src/classes/HMSRemotePeer.ts +1 -0
- package/src/classes/HMSRemoteVideoTrack.ts +16 -0
- package/src/classes/HMSRoom.ts +12 -0
- package/src/classes/HMSRtmpStreamingState.ts +11 -0
- package/src/classes/HMSSDK.tsx +170 -71
- package/src/classes/HMSServerRecordingState.ts +11 -0
- package/src/classes/HMSTrack.ts +2 -15
- package/src/classes/HMSTrackSettings.ts +3 -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/HMSVideoTrackSettings.ts +13 -10
- package/src/index.ts +7 -0
- package/android/.gradle/6.9/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.9/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/6.9/javaCompile/classAnalysis.bin +0 -0
- package/android/.gradle/6.9/javaCompile/jarAnalysis.bin +0 -0
- package/android/.gradle/6.9/javaCompile/javaCompile.lock +0 -0
- package/android/.gradle/6.9/javaCompile/taskHistory.bin +0 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.project +0 -34
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import type { HMSPeer } from './HMSPeer';
|
|
2
|
+
import type { HMSRtmpStreamingState } from './HMSRtmpStreamingState';
|
|
3
|
+
import type { HMSServerRecordingState } from './HMSServerRecordingState';
|
|
4
|
+
import type { HMSBrowserRecordingState } from './HMSBrowserRecordingState';
|
|
2
5
|
export declare class HMSRoom {
|
|
3
6
|
id: string;
|
|
4
7
|
name: string;
|
|
5
8
|
metaData?: string;
|
|
6
9
|
peers: HMSPeer[];
|
|
10
|
+
browserRecordingState: HMSBrowserRecordingState;
|
|
11
|
+
rtmpHMSRtmpStreamingState: HMSRtmpStreamingState;
|
|
12
|
+
serverRecordingState: HMSServerRecordingState;
|
|
7
13
|
constructor(params: {
|
|
8
14
|
id: string;
|
|
9
15
|
name: string;
|
|
10
16
|
metaData?: string;
|
|
11
17
|
peers: HMSPeer[];
|
|
18
|
+
browserRecordingState: HMSBrowserRecordingState;
|
|
19
|
+
rtmpHMSRtmpStreamingState: HMSRtmpStreamingState;
|
|
20
|
+
serverRecordingState: HMSServerRecordingState;
|
|
12
21
|
});
|
|
13
22
|
}
|
|
@@ -11,6 +11,8 @@ import type { HMSTrackType } from './HMSTrackType';
|
|
|
11
11
|
import type { HMSLogger } from './HMSLogger';
|
|
12
12
|
import type { HMSPeer } from './HMSPeer';
|
|
13
13
|
import { HMSVideoViewMode } from './HMSVideoViewMode';
|
|
14
|
+
import type { HMSTrackSettings } from './HMSTrackSettings';
|
|
15
|
+
import type { HMSRTMPConfig } from './HMSRTMPConfig';
|
|
14
16
|
interface HmsComponentProps {
|
|
15
17
|
trackId: string;
|
|
16
18
|
sink: boolean;
|
|
@@ -24,8 +26,8 @@ export declare class HMSSDK {
|
|
|
24
26
|
localPeer?: HMSLocalPeer;
|
|
25
27
|
remotePeers?: HMSRemotePeer[];
|
|
26
28
|
knownRoles?: HMSRole[];
|
|
27
|
-
logger?: HMSLogger;
|
|
28
29
|
id: string;
|
|
30
|
+
private muteStatus;
|
|
29
31
|
onPreviewDelegate?: any;
|
|
30
32
|
onJoinDelegate?: any;
|
|
31
33
|
onRoomDelegate?: any;
|
|
@@ -48,7 +50,11 @@ export declare class HMSSDK {
|
|
|
48
50
|
* @returns
|
|
49
51
|
* @memberof HMSSDK
|
|
50
52
|
*/
|
|
51
|
-
static build(
|
|
53
|
+
static build(params?: {
|
|
54
|
+
trackSettings?: HMSTrackSettings;
|
|
55
|
+
}): Promise<HMSSDK>;
|
|
56
|
+
static getLogger(): HMSLogger | undefined;
|
|
57
|
+
setLogger: (hmsLogger: HMSLogger) => void;
|
|
52
58
|
destroy: () => void;
|
|
53
59
|
attachPreviewListener: () => void;
|
|
54
60
|
attachListeners: () => void;
|
|
@@ -68,18 +74,22 @@ export declare class HMSSDK {
|
|
|
68
74
|
*
|
|
69
75
|
* @memberof HMSSDK
|
|
70
76
|
*/
|
|
71
|
-
leave: () => Promise<
|
|
72
|
-
sendBroadcastMessage: (message: string, type?: string | undefined) =>
|
|
73
|
-
sendGroupMessage: (message: string, roles: HMSRole[], type?: string | undefined) =>
|
|
74
|
-
sendDirectMessage: (message: string, peerId: string, type?: string | undefined) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
leave: () => Promise<any>;
|
|
78
|
+
sendBroadcastMessage: (message: string, type?: string | undefined) => Promise<any>;
|
|
79
|
+
sendGroupMessage: (message: string, roles: HMSRole[], type?: string | undefined) => Promise<any>;
|
|
80
|
+
sendDirectMessage: (message: string, peerId: string, type?: string | undefined) => Promise<any>;
|
|
81
|
+
changeMetadata: (metadata: string) => void;
|
|
82
|
+
startRTMPOrRecording: (data: HMSRTMPConfig) => Promise<any>;
|
|
83
|
+
stopRtmpAndRecording: () => Promise<any>;
|
|
84
|
+
changeRole: (peer: HMSPeer, role: HMSRole, force?: boolean) => Promise<any>;
|
|
85
|
+
changeTrackState: (track: HMSTrack, mute: boolean) => Promise<any>;
|
|
86
|
+
changeTrackStateRoles: (type: HMSTrackType, mute: boolean, source: string, roles: Array<HMSRole>) => Promise<any>;
|
|
87
|
+
removePeer: (peerId: string, reason: string) => Promise<any>;
|
|
88
|
+
endRoom: (lock: boolean, reason: string) => Promise<any>;
|
|
89
|
+
acceptRoleChange: () => Promise<any>;
|
|
81
90
|
muteAllPeersAudio: (mute: boolean) => void;
|
|
82
91
|
getRoom: () => Promise<HMSRoom>;
|
|
92
|
+
setVolume: (track: HMSTrack, volume: number) => void;
|
|
83
93
|
/**
|
|
84
94
|
* - This is a prototype event listener that takes action and listens for updates related to that particular action
|
|
85
95
|
* - This method will be @deprecated in future and event listener will be passed in join method
|
|
@@ -104,7 +114,6 @@ export declare class HMSSDK {
|
|
|
104
114
|
* @memberof HMSSDK
|
|
105
115
|
*/
|
|
106
116
|
removeAllListeners: () => void;
|
|
107
|
-
setLogger: (hmsLogger: HMSLogger) => void;
|
|
108
117
|
onPreviewListener: (data: any) => void;
|
|
109
118
|
onJoinListener: (data: any) => void;
|
|
110
119
|
onRoomListener: (data: any) => void;
|
|
@@ -3,8 +3,10 @@ import type { HMSVideoTrackSettings } from './HMSVideoTrackSettings';
|
|
|
3
3
|
export declare class HMSTrackSettings {
|
|
4
4
|
video?: HMSVideoTrackSettings;
|
|
5
5
|
audio?: HMSAudioTrackSettings;
|
|
6
|
+
useHardwareEchoCancellation?: boolean;
|
|
6
7
|
constructor(params?: {
|
|
7
8
|
video?: HMSVideoTrackSettings;
|
|
8
9
|
audio?: HMSAudioTrackSettings;
|
|
10
|
+
useHardwareEchoCancellation?: boolean;
|
|
9
11
|
});
|
|
10
12
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HMSVideoCodec } from '..';
|
|
2
2
|
export declare class HMSVideoSettings {
|
|
3
3
|
bitrate?: number;
|
|
4
4
|
frameRate: number;
|
|
5
5
|
width: number;
|
|
6
6
|
height: number;
|
|
7
|
-
codec:
|
|
7
|
+
codec: HMSVideoCodec;
|
|
8
8
|
constructor(params: {
|
|
9
9
|
bitrate?: number;
|
|
10
10
|
frameRate: number;
|
|
11
11
|
width: number;
|
|
12
12
|
height: number;
|
|
13
|
-
codec:
|
|
13
|
+
codec: HMSVideoCodec;
|
|
14
14
|
});
|
|
15
15
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
import type { HMSVideoCodec } from './HMSVideoCodec';
|
|
1
2
|
import type { HMSSimulcastLayerSettings } from './HMSSimulcastLayerSettings';
|
|
3
|
+
import type { HMSCameraFacing } from './HMSCameraFacing';
|
|
4
|
+
import type { HMSVideoResolution } from './HMSVideoResolution';
|
|
2
5
|
export declare class HMSVideoTrackSettings {
|
|
3
|
-
codec
|
|
4
|
-
resolution
|
|
5
|
-
maxBitrate
|
|
6
|
-
maxFrameRate
|
|
7
|
-
cameraFacing
|
|
6
|
+
codec: HMSVideoCodec;
|
|
7
|
+
resolution: HMSVideoResolution;
|
|
8
|
+
maxBitrate: number;
|
|
9
|
+
maxFrameRate: number;
|
|
10
|
+
cameraFacing: HMSCameraFacing;
|
|
8
11
|
trackDescription?: string;
|
|
9
12
|
simulcastSettings?: HMSSimulcastLayerSettings[];
|
|
10
13
|
constructor(params: {
|
|
11
|
-
codec
|
|
12
|
-
resolution
|
|
13
|
-
maxBitrate
|
|
14
|
-
maxFrameRate
|
|
15
|
-
cameraFacing
|
|
14
|
+
codec: HMSVideoCodec;
|
|
15
|
+
resolution: HMSVideoResolution;
|
|
16
|
+
maxBitrate: number;
|
|
17
|
+
maxFrameRate: number;
|
|
18
|
+
cameraFacing: HMSCameraFacing;
|
|
16
19
|
trackDescription?: string;
|
|
17
20
|
simulcastSettings?: HMSSimulcastLayerSettings[];
|
|
18
21
|
});
|
|
@@ -40,5 +40,12 @@ export * from './classes/HMSVideoViewMode';
|
|
|
40
40
|
export * from './classes/HMSChangeTrackStateRequest';
|
|
41
41
|
export * from './classes/HMSSpeaker';
|
|
42
42
|
export * from './classes/HMSSpeakerUpdate';
|
|
43
|
+
export * from './classes/HMSCameraFacing';
|
|
44
|
+
export * from './classes/HMSException';
|
|
45
|
+
export * from './classes/HMSRtmpStreamingState';
|
|
46
|
+
export * from './classes/HMSServerRecordingState';
|
|
47
|
+
export * from './classes/HMSBrowserRecordingState';
|
|
48
|
+
export * from './classes/HMSRTMPConfig';
|
|
49
|
+
export * from './classes/HMSVideoResolution';
|
|
43
50
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
44
51
|
export default HmsManager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@100mslive/react-native-hms",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "The React Native package for 100ms SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
"prettier": "^2.0.5",
|
|
96
96
|
"react-native-builder-bob": "^0.18.0",
|
|
97
97
|
"release-it": "^14.2.2",
|
|
98
|
+
"typedoc": "^0.22.10",
|
|
98
99
|
"typescript": "^4.1.3"
|
|
99
100
|
},
|
|
100
101
|
"peerDependencies": {
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import type { HMSAudioCodec } from './HMSAudioCodec';
|
|
2
|
+
|
|
1
3
|
export class HMSAudioTrackSettings {
|
|
2
4
|
maxBitrate?: number;
|
|
3
5
|
trackDescription?: string;
|
|
4
|
-
|
|
6
|
+
codec?: HMSAudioCodec;
|
|
7
|
+
constructor(params: {
|
|
8
|
+
maxBitrate: number;
|
|
9
|
+
trackDescription?: string;
|
|
10
|
+
codec: HMSAudioCodec;
|
|
11
|
+
}) {
|
|
5
12
|
this.maxBitrate = params.maxBitrate;
|
|
6
13
|
this.trackDescription = params.trackDescription;
|
|
14
|
+
this.codec = params.codec;
|
|
7
15
|
}
|
|
8
16
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HMSException } from './HMSException';
|
|
2
|
+
|
|
3
|
+
export class HMSBrowserRecordingState {
|
|
4
|
+
running: string;
|
|
5
|
+
error: HMSException;
|
|
6
|
+
|
|
7
|
+
constructor(params: { running: string; error: HMSException }) {
|
|
8
|
+
this.running = params.running;
|
|
9
|
+
this.error = params.error;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -3,9 +3,15 @@ import type { HMSPeer } from './HMSPeer';
|
|
|
3
3
|
export class HMSChangeTrackStateRequest {
|
|
4
4
|
requestedBy: HMSPeer;
|
|
5
5
|
trackType: string;
|
|
6
|
+
mute: boolean;
|
|
6
7
|
|
|
7
|
-
constructor(params: {
|
|
8
|
+
constructor(params: {
|
|
9
|
+
requestedBy: HMSPeer;
|
|
10
|
+
trackType: string;
|
|
11
|
+
mute: boolean;
|
|
12
|
+
}) {
|
|
8
13
|
this.requestedBy = params.requestedBy;
|
|
9
14
|
this.trackType = params.trackType;
|
|
15
|
+
this.mute = params.mute;
|
|
10
16
|
}
|
|
11
17
|
}
|
package/src/classes/HMSConfig.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
export class HMSConfig {
|
|
2
|
-
// endpoint: string;
|
|
3
2
|
username: string;
|
|
4
3
|
authToken: string;
|
|
5
4
|
endpoint?: string;
|
|
5
|
+
metadata?: string;
|
|
6
6
|
|
|
7
7
|
constructor(params: {
|
|
8
8
|
username: string;
|
|
9
9
|
authToken: string;
|
|
10
10
|
endpoint?: string;
|
|
11
|
+
metadata?: string;
|
|
11
12
|
}) {
|
|
12
13
|
this.username = params.username;
|
|
13
14
|
this.authToken = params.authToken;
|
|
14
15
|
this.endpoint = params.endpoint;
|
|
16
|
+
this.metadata = params.metadata;
|
|
15
17
|
}
|
|
16
18
|
}
|
|
@@ -14,14 +14,18 @@ import { HMSLocalAudioTrack } from './HMSLocalAudioTrack';
|
|
|
14
14
|
import { HMSRole } from './HMSRole';
|
|
15
15
|
import { HMSRoleChangeRequest } from './HMSRoleChangeRequest';
|
|
16
16
|
import { HMSChangeTrackStateRequest } from './HMSChangeTrackStateRequest';
|
|
17
|
+
import { HMSVideoResolution } from './HMSVideoResolution';
|
|
17
18
|
|
|
18
19
|
export class HMSEncoder {
|
|
19
|
-
static encodeHmsRoom(room:
|
|
20
|
+
static encodeHmsRoom(room: HMSRoom, id: string) {
|
|
20
21
|
const encodedObj = {
|
|
21
22
|
id: room?.id,
|
|
22
23
|
metaData: room?.metaData,
|
|
23
24
|
name: room?.name,
|
|
24
25
|
peers: HMSEncoder.encodeHmsPeers(room?.peers, id),
|
|
26
|
+
browserRecordingState: room?.browserRecordingState,
|
|
27
|
+
rtmpHMSRtmpStreamingState: room?.rtmpHMSRtmpStreamingState,
|
|
28
|
+
serverRecordingState: room?.serverRecordingState,
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
return new HMSRoom(encodedObj);
|
|
@@ -44,6 +48,7 @@ export class HMSEncoder {
|
|
|
44
48
|
role: HMSEncoder.encodeHmsRole(peer?.role),
|
|
45
49
|
customerUserID: peer?.customerUserID,
|
|
46
50
|
customerDescription: peer?.customerDescription,
|
|
51
|
+
metadata: peer?.metadata,
|
|
47
52
|
audioTrack: HMSEncoder.encodeHmsAudioTrack(peer?.audioTrack, id),
|
|
48
53
|
videoTrack: HMSEncoder.encodeHmsVideoTrack(peer?.videoTrack, id),
|
|
49
54
|
auxiliaryTracks: HMSEncoder.encodeHmsAuxiliaryTracks(
|
|
@@ -110,6 +115,7 @@ export class HMSEncoder {
|
|
|
110
115
|
isLocal: peer.isLocal,
|
|
111
116
|
customerUserID: peer.customerUserID,
|
|
112
117
|
customerDescription: peer.customerDescription,
|
|
118
|
+
metadata: peer.metadata,
|
|
113
119
|
role: HMSEncoder.encodeHmsRole(peer?.role),
|
|
114
120
|
audioTrack: HMSEncoder.encodeHmsAudioTrack(peer.audioTrack, id),
|
|
115
121
|
videoTrack: HMSEncoder.encodeHmsVideoTrack(peer.videoTrack, id),
|
|
@@ -126,6 +132,7 @@ export class HMSEncoder {
|
|
|
126
132
|
settings: HMSEncoder.encodeHmsAudioTrackSettings(
|
|
127
133
|
peer?.localAudioTrackData?.settings
|
|
128
134
|
),
|
|
135
|
+
type: peer?.localAudioTrackData?.type,
|
|
129
136
|
},
|
|
130
137
|
localVideoTrackData: {
|
|
131
138
|
id: id,
|
|
@@ -136,6 +143,7 @@ export class HMSEncoder {
|
|
|
136
143
|
settings: HMSEncoder.encodeHmsVideoTrackSettings(
|
|
137
144
|
peer?.localVideoTrackData?.settings
|
|
138
145
|
),
|
|
146
|
+
type: peer?.localVideoTrackData?.type,
|
|
139
147
|
},
|
|
140
148
|
};
|
|
141
149
|
|
|
@@ -146,6 +154,7 @@ export class HMSEncoder {
|
|
|
146
154
|
const encodedObj = {
|
|
147
155
|
maxBitrate: settings?.maxBitrate,
|
|
148
156
|
trackDescription: settings?.trackDescription,
|
|
157
|
+
codec: settings?.codec,
|
|
149
158
|
};
|
|
150
159
|
|
|
151
160
|
return new HMSAudioTrackSettings(encodedObj);
|
|
@@ -154,7 +163,7 @@ export class HMSEncoder {
|
|
|
154
163
|
static encodeHmsVideoTrackSettings(settings: any) {
|
|
155
164
|
const encodedObj = {
|
|
156
165
|
codec: settings?.codec,
|
|
157
|
-
resolution: settings?.resolution,
|
|
166
|
+
resolution: HMSEncoder.encodeHmsVideoResolution(settings?.resolution),
|
|
158
167
|
maxBitrate: settings?.maxBitrate,
|
|
159
168
|
maxFrameRate: settings?.maxFrameRate,
|
|
160
169
|
cameraFacing: settings?.cameraFacing,
|
|
@@ -164,6 +173,15 @@ export class HMSEncoder {
|
|
|
164
173
|
return new HMSVideoTrackSettings(encodedObj);
|
|
165
174
|
}
|
|
166
175
|
|
|
176
|
+
static encodeHmsVideoResolution(resolution: any) {
|
|
177
|
+
const encodedObj = {
|
|
178
|
+
height: resolution?.height,
|
|
179
|
+
width: resolution?.width,
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
return new HMSVideoResolution(encodedObj);
|
|
183
|
+
}
|
|
184
|
+
|
|
167
185
|
static encodeHmsRemotePeers(peers: any, id: string) {
|
|
168
186
|
const hmsPeers: any[] = [];
|
|
169
187
|
|
|
@@ -183,6 +201,7 @@ export class HMSEncoder {
|
|
|
183
201
|
isLocal: peer.isLocal,
|
|
184
202
|
customerUserID: peer.customerUserID,
|
|
185
203
|
customerDescription: peer.customerDescription,
|
|
204
|
+
metadata: peer.metadata,
|
|
186
205
|
role: HMSEncoder.encodeHmsRole(peer?.role),
|
|
187
206
|
audioTrack: HMSEncoder.encodeHmsAudioTrack(peer.audioTrack, id),
|
|
188
207
|
videoTrack: HMSEncoder.encodeHmsVideoTrack(peer.videoTrack, id),
|
|
@@ -257,6 +276,7 @@ export class HMSEncoder {
|
|
|
257
276
|
const encodedChangeTrackStateRequest = {
|
|
258
277
|
requestedBy: HMSEncoder.encodeHmsPeer(data.requestedBy, id),
|
|
259
278
|
trackType: data.trackType,
|
|
279
|
+
mute: data.mute,
|
|
260
280
|
};
|
|
261
281
|
|
|
262
282
|
return new HMSChangeTrackStateRequest(encodedChangeTrackStateRequest);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export class HMSException {
|
|
2
|
+
public error: {
|
|
3
|
+
code: number;
|
|
4
|
+
description: string;
|
|
5
|
+
localizedDescription: string;
|
|
6
|
+
message: string;
|
|
7
|
+
name: string;
|
|
8
|
+
action: string;
|
|
9
|
+
};
|
|
10
|
+
public event: string;
|
|
11
|
+
|
|
12
|
+
constructor(params: {
|
|
13
|
+
error: {
|
|
14
|
+
code: number;
|
|
15
|
+
description: string;
|
|
16
|
+
localizedDescription: string;
|
|
17
|
+
message: string;
|
|
18
|
+
name: string;
|
|
19
|
+
action: string;
|
|
20
|
+
};
|
|
21
|
+
event: string;
|
|
22
|
+
}) {
|
|
23
|
+
this.error = {
|
|
24
|
+
code: params.error.code,
|
|
25
|
+
description: params.error.description,
|
|
26
|
+
localizedDescription: params.error.localizedDescription,
|
|
27
|
+
message: params.error.message,
|
|
28
|
+
name: params.error.name,
|
|
29
|
+
action: params.error.action,
|
|
30
|
+
};
|
|
31
|
+
this.event = params.event;
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/classes/HMSHelper.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
2
|
import { HMSAudioTrack } from './HMSAudioTrack';
|
|
3
|
+
import { HMSSDK } from './HMSSDK';
|
|
3
4
|
import type { HMSAudioTrackSettings } from './HMSAudioTrackSettings';
|
|
4
5
|
import type { HMSTrackType } from './HMSTrackType';
|
|
5
6
|
|
|
@@ -21,9 +22,36 @@ export class HMSLocalAudioTrack extends HMSAudioTrack {
|
|
|
21
22
|
* @memberof HMSLocalAudioTrack
|
|
22
23
|
*/
|
|
23
24
|
setMute(isMute: boolean) {
|
|
25
|
+
const logger = HMSSDK.getLogger();
|
|
26
|
+
logger?.verbose('#Function setMute', {
|
|
27
|
+
trackId: this.trackId,
|
|
28
|
+
id: this.id,
|
|
29
|
+
source: this.source,
|
|
30
|
+
type: this.type,
|
|
31
|
+
isMute,
|
|
32
|
+
});
|
|
24
33
|
HmsManager.setLocalMute({ isMute, id: this.id });
|
|
25
34
|
}
|
|
26
35
|
|
|
36
|
+
getVolume = async () => {
|
|
37
|
+
const logger = HMSSDK.getLogger();
|
|
38
|
+
logger?.verbose('#Function getVolume', {
|
|
39
|
+
trackId: this.trackId,
|
|
40
|
+
id: this.id,
|
|
41
|
+
source: this.source,
|
|
42
|
+
type: this.type,
|
|
43
|
+
});
|
|
44
|
+
if (Platform.OS === 'ios') {
|
|
45
|
+
return 'This API not available for IOS';
|
|
46
|
+
}
|
|
47
|
+
const volume = await HmsManager.getVolume({
|
|
48
|
+
trackId: this.trackId,
|
|
49
|
+
id: this.id,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return volume;
|
|
53
|
+
};
|
|
54
|
+
|
|
27
55
|
constructor(params: {
|
|
28
56
|
id: string;
|
|
29
57
|
trackId: string;
|
|
@@ -7,6 +7,7 @@ import type { HMSAudioTrackSettings } from './HMSAudioTrackSettings';
|
|
|
7
7
|
import { HMSLocalAudioTrack } from './HMSLocalAudioTrack';
|
|
8
8
|
import { HMSLocalVideoTrack } from './HMSLocalVideoTrack';
|
|
9
9
|
import type { HMSRole } from './HMSRole';
|
|
10
|
+
import type { HMSTrackType } from './HMSTrackType';
|
|
10
11
|
|
|
11
12
|
export class HMSLocalPeer extends HMSPeer {
|
|
12
13
|
private localAudio?: HMSLocalAudioTrack;
|
|
@@ -25,6 +26,7 @@ export class HMSLocalPeer extends HMSPeer {
|
|
|
25
26
|
isLocal?: boolean;
|
|
26
27
|
customerUserID?: string;
|
|
27
28
|
customerDescription?: string;
|
|
29
|
+
metadata?: string;
|
|
28
30
|
audioTrack?: HMSAudioTrack;
|
|
29
31
|
videoTrack?: HMSVideoTrack;
|
|
30
32
|
role?: HMSRole;
|
|
@@ -36,6 +38,7 @@ export class HMSLocalPeer extends HMSPeer {
|
|
|
36
38
|
trackDescription?: string;
|
|
37
39
|
isMute?: boolean;
|
|
38
40
|
settings?: HMSAudioTrackSettings;
|
|
41
|
+
type: HMSTrackType;
|
|
39
42
|
};
|
|
40
43
|
localVideoTrackData?: {
|
|
41
44
|
id: string;
|
|
@@ -44,6 +47,7 @@ export class HMSLocalPeer extends HMSPeer {
|
|
|
44
47
|
trackDescription?: string;
|
|
45
48
|
isMute?: boolean;
|
|
46
49
|
settings?: HMSVideoTrackSettings;
|
|
50
|
+
type: HMSTrackType;
|
|
47
51
|
};
|
|
48
52
|
}) {
|
|
49
53
|
super(params);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
2
|
import { HMSVideoTrack } from './HMSVideoTrack';
|
|
3
|
+
import { HMSSDK } from './HMSSDK';
|
|
3
4
|
import type { HMSVideoTrackSettings } from './HMSVideoTrackSettings';
|
|
4
5
|
import type { HMSTrackType } from './HMSTrackType';
|
|
5
6
|
|
|
@@ -22,6 +23,13 @@ export class HMSLocalVideoTrack extends HMSVideoTrack {
|
|
|
22
23
|
* @memberof HMSSDK
|
|
23
24
|
*/
|
|
24
25
|
switchCamera = () => {
|
|
26
|
+
const logger = HMSSDK.getLogger();
|
|
27
|
+
logger?.verbose('#Function switchCamera', {
|
|
28
|
+
trackId: this.trackId,
|
|
29
|
+
source: this.source,
|
|
30
|
+
type: this.type,
|
|
31
|
+
id: this.id,
|
|
32
|
+
});
|
|
25
33
|
HmsManager.switchCamera({ id: this.id });
|
|
26
34
|
};
|
|
27
35
|
|
|
@@ -32,6 +40,13 @@ export class HMSLocalVideoTrack extends HMSVideoTrack {
|
|
|
32
40
|
* @memberof HMSLocalVideoTrack
|
|
33
41
|
*/
|
|
34
42
|
setMute(isMute: boolean) {
|
|
43
|
+
const logger = HMSSDK.getLogger();
|
|
44
|
+
logger?.verbose('#Function setMute', {
|
|
45
|
+
trackId: this.trackId,
|
|
46
|
+
source: this.source,
|
|
47
|
+
type: this.type,
|
|
48
|
+
id: this.id,
|
|
49
|
+
});
|
|
35
50
|
HmsManager.setLocalVideoMute({ isMute, id: this.id });
|
|
36
51
|
}
|
|
37
52
|
|
package/src/classes/HMSLogger.ts
CHANGED
|
@@ -4,6 +4,12 @@ export class HMSLogger {
|
|
|
4
4
|
private _verbose: boolean = false;
|
|
5
5
|
private _warning: boolean = false;
|
|
6
6
|
private _error: boolean = false;
|
|
7
|
+
private logs: {
|
|
8
|
+
type: 'verbose' | 'warn' | 'error';
|
|
9
|
+
message: string;
|
|
10
|
+
data: any;
|
|
11
|
+
id: string;
|
|
12
|
+
}[] = [];
|
|
7
13
|
|
|
8
14
|
constructor(params?: { verbose: boolean; warning: boolean; error: boolean }) {
|
|
9
15
|
if (params) {
|
|
@@ -14,21 +20,28 @@ export class HMSLogger {
|
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
verbose(message: string, data: any) {
|
|
17
|
-
if (this._verbose
|
|
23
|
+
if (this._verbose) {
|
|
18
24
|
console.log(message, data);
|
|
19
25
|
}
|
|
26
|
+
this.logs.push({ type: 'verbose', message, data, id: data?.id });
|
|
20
27
|
}
|
|
21
28
|
|
|
22
29
|
warn(message: string, data: any) {
|
|
23
30
|
if (this._warning) {
|
|
24
31
|
console.warn(message, data);
|
|
25
32
|
}
|
|
33
|
+
this.logs.push({ type: 'warn', message, data, id: data?.id });
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
error(message: string, data: any) {
|
|
29
37
|
if (this._error) {
|
|
30
38
|
console.error(message, data);
|
|
31
39
|
}
|
|
40
|
+
this.logs.push({ type: 'error', message, data, id: data?.id });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getLogs() {
|
|
44
|
+
return this.logs;
|
|
32
45
|
}
|
|
33
46
|
|
|
34
47
|
updateLogLevel(level: HMSLogLevel, value: boolean) {
|
package/src/classes/HMSPeer.ts
CHANGED
|
@@ -9,6 +9,7 @@ export class HMSPeer {
|
|
|
9
9
|
isLocal?: boolean;
|
|
10
10
|
customerUserID?: string;
|
|
11
11
|
customerDescription?: string;
|
|
12
|
+
metadata?: string;
|
|
12
13
|
role?: HMSRole;
|
|
13
14
|
|
|
14
15
|
audioTrack?: HMSAudioTrack;
|
|
@@ -22,6 +23,7 @@ export class HMSPeer {
|
|
|
22
23
|
isLocal?: boolean;
|
|
23
24
|
customerUserID?: string;
|
|
24
25
|
customerDescription?: string;
|
|
26
|
+
metadata?: string;
|
|
25
27
|
role?: HMSRole;
|
|
26
28
|
audioTrack?: HMSAudioTrack;
|
|
27
29
|
videoTrack?: HMSVideoTrack;
|
|
@@ -36,5 +38,6 @@ export class HMSPeer {
|
|
|
36
38
|
this.videoTrack = params.videoTrack;
|
|
37
39
|
this.auxiliaryTracks = params.auxiliaryTracks;
|
|
38
40
|
this.role = params.role;
|
|
41
|
+
this.metadata = params.metadata;
|
|
39
42
|
}
|
|
40
43
|
}
|