@100mslive/react-native-hms 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -39
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativehmssdk/HmsDecoder.kt +91 -17
- package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +106 -0
- package/android/src/main/java/com/reactnativehmssdk/HmsModule.kt +38 -3
- package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +342 -183
- package/android/src/main/java/com/reactnativehmssdk/HmsView.kt +4 -1
- package/ios/HmsDecoder.swift +105 -18
- package/ios/HmsHelper.swift +92 -0
- package/ios/HmsManager.m +5 -1
- package/ios/HmsManager.swift +41 -6
- package/ios/HmsSDK.swift +199 -60
- 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/HMSConfig.js +3 -1
- package/lib/commonjs/classes/HMSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSEncoder.js +20 -3
- 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 +12 -0
- package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/commonjs/classes/HMSLocalPeer.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/HMSRemotePeer.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 +129 -70
- 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/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 +84 -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/HMSConfig.js +3 -1
- package/lib/module/classes/HMSConfig.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +19 -3
- 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 +13 -1
- package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
- package/lib/module/classes/HMSLocalPeer.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/HMSRemotePeer.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 +130 -70
- 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/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 +6 -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/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 +1 -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 +10 -1
- package/lib/typescript/classes/HMSServerRecordingState.d.ts +9 -0
- package/lib/typescript/classes/HMSTrack.d.ts +1 -1
- 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 +6 -0
- package/package.json +1 -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/HMSConfig.ts +3 -1
- package/src/classes/HMSEncoder.ts +19 -2
- package/src/classes/HMSException.ts +33 -0
- package/src/classes/HMSHelper.ts +2 -2
- package/src/classes/HMSLocalAudioTrack.ts +13 -1
- package/src/classes/HMSLocalPeer.ts +1 -0
- 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/HMSRemotePeer.ts +1 -0
- package/src/classes/HMSRoom.ts +12 -0
- package/src/classes/HMSRtmpStreamingState.ts +11 -0
- package/src/classes/HMSSDK.tsx +40 -2
- package/src/classes/HMSServerRecordingState.ts +11 -0
- package/src/classes/HMSTrack.ts +2 -15
- 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 +6 -0
|
@@ -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,11 @@ 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';
|
|
43
49
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
44
50
|
export default HmsManager;
|
package/package.json
CHANGED
|
@@ -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
|
+
}
|
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),
|
|
@@ -146,6 +152,7 @@ export class HMSEncoder {
|
|
|
146
152
|
const encodedObj = {
|
|
147
153
|
maxBitrate: settings?.maxBitrate,
|
|
148
154
|
trackDescription: settings?.trackDescription,
|
|
155
|
+
codec: settings?.codec,
|
|
149
156
|
};
|
|
150
157
|
|
|
151
158
|
return new HMSAudioTrackSettings(encodedObj);
|
|
@@ -154,7 +161,7 @@ export class HMSEncoder {
|
|
|
154
161
|
static encodeHmsVideoTrackSettings(settings: any) {
|
|
155
162
|
const encodedObj = {
|
|
156
163
|
codec: settings?.codec,
|
|
157
|
-
resolution: settings?.resolution,
|
|
164
|
+
resolution: HMSEncoder.encodeHmsVideoResolution(settings?.resolution),
|
|
158
165
|
maxBitrate: settings?.maxBitrate,
|
|
159
166
|
maxFrameRate: settings?.maxFrameRate,
|
|
160
167
|
cameraFacing: settings?.cameraFacing,
|
|
@@ -164,6 +171,15 @@ export class HMSEncoder {
|
|
|
164
171
|
return new HMSVideoTrackSettings(encodedObj);
|
|
165
172
|
}
|
|
166
173
|
|
|
174
|
+
static encodeHmsVideoResolution(resolution: any) {
|
|
175
|
+
const encodedObj = {
|
|
176
|
+
height: resolution?.height,
|
|
177
|
+
width: resolution?.width,
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
return new HMSVideoResolution(encodedObj);
|
|
181
|
+
}
|
|
182
|
+
|
|
167
183
|
static encodeHmsRemotePeers(peers: any, id: string) {
|
|
168
184
|
const hmsPeers: any[] = [];
|
|
169
185
|
|
|
@@ -183,6 +199,7 @@ export class HMSEncoder {
|
|
|
183
199
|
isLocal: peer.isLocal,
|
|
184
200
|
customerUserID: peer.customerUserID,
|
|
185
201
|
customerDescription: peer.customerDescription,
|
|
202
|
+
metadata: peer.metadata,
|
|
186
203
|
role: HMSEncoder.encodeHmsRole(peer?.role),
|
|
187
204
|
audioTrack: HMSEncoder.encodeHmsAudioTrack(peer.audioTrack, id),
|
|
188
205
|
videoTrack: HMSEncoder.encodeHmsVideoTrack(peer.videoTrack, id),
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
2
|
import { HMSAudioTrack } from './HMSAudioTrack';
|
|
3
3
|
import type { HMSAudioTrackSettings } from './HMSAudioTrackSettings';
|
|
4
4
|
import type { HMSTrackType } from './HMSTrackType';
|
|
@@ -24,6 +24,18 @@ export class HMSLocalAudioTrack extends HMSAudioTrack {
|
|
|
24
24
|
HmsManager.setLocalMute({ isMute, id: this.id });
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
getVolume = async () => {
|
|
28
|
+
if (Platform.OS === 'ios') {
|
|
29
|
+
return 'This API not available for IOS';
|
|
30
|
+
}
|
|
31
|
+
const volume = await HmsManager.getVolume({
|
|
32
|
+
trackId: this.trackId,
|
|
33
|
+
id: this.id,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return volume;
|
|
37
|
+
};
|
|
38
|
+
|
|
27
39
|
constructor(params: {
|
|
28
40
|
id: string;
|
|
29
41
|
trackId: string;
|
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
|
}
|
|
@@ -3,6 +3,7 @@ export enum HMSPeerUpdate {
|
|
|
3
3
|
PEER_LEFT = 'PEER_LEFT',
|
|
4
4
|
AUDIO_TOGGLED = 'AUDIO_TOGGLED',
|
|
5
5
|
VIDEO_TOGGLED = 'VIDEO_TOGGLED',
|
|
6
|
+
METADATA_CHANGED = 'METADATA_CHANGED',
|
|
6
7
|
BECAME_DOMINANT_SPEAKER = 'BECAME_DOMINANT_SPEAKER',
|
|
7
8
|
NO_DOMINANT_SPEAKER = 'NO_DOMINANT_SPEAKER',
|
|
8
9
|
RESIGNED_DOMINANT_SPEAKER = 'RESIGNED_DOMINANT_SPEAKER',
|
|
@@ -4,6 +4,8 @@ export class HMSPermissions {
|
|
|
4
4
|
unmute?: boolean;
|
|
5
5
|
mute?: boolean;
|
|
6
6
|
changeRole?: boolean;
|
|
7
|
+
recording?: boolean;
|
|
8
|
+
rtmp?: boolean;
|
|
7
9
|
|
|
8
10
|
constructor(params?: {
|
|
9
11
|
endRoom?: boolean;
|
|
@@ -11,6 +13,8 @@ export class HMSPermissions {
|
|
|
11
13
|
unmute?: boolean;
|
|
12
14
|
mute?: boolean;
|
|
13
15
|
changeRole?: boolean;
|
|
16
|
+
recording?: boolean;
|
|
17
|
+
rtmp?: boolean;
|
|
14
18
|
}) {
|
|
15
19
|
if (params) {
|
|
16
20
|
this.endRoom = params.endRoom;
|
|
@@ -18,6 +22,8 @@ export class HMSPermissions {
|
|
|
18
22
|
this.unmute = params.unmute;
|
|
19
23
|
this.mute = params.mute;
|
|
20
24
|
this.changeRole = params.changeRole;
|
|
25
|
+
this.recording = params.recording;
|
|
26
|
+
this.rtmp = params.rtmp;
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
29
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class HMSRTMPConfig {
|
|
2
|
+
meetingURL: string;
|
|
3
|
+
rtmpURLs?: Array<string>;
|
|
4
|
+
record: boolean;
|
|
5
|
+
|
|
6
|
+
constructor(params: {
|
|
7
|
+
meetingURL: string;
|
|
8
|
+
rtmpURLs?: Array<string>;
|
|
9
|
+
record: boolean;
|
|
10
|
+
}) {
|
|
11
|
+
this.meetingURL = params.meetingURL;
|
|
12
|
+
this.rtmpURLs = params.rtmpURLs;
|
|
13
|
+
this.record = params.record;
|
|
14
|
+
}
|
|
15
|
+
}
|
package/src/classes/HMSRoom.ts
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
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
|
|
|
3
6
|
export class HMSRoom {
|
|
4
7
|
id: string;
|
|
5
8
|
name: string;
|
|
6
9
|
metaData?: string;
|
|
7
10
|
peers: HMSPeer[];
|
|
11
|
+
browserRecordingState: HMSBrowserRecordingState;
|
|
12
|
+
rtmpHMSRtmpStreamingState: HMSRtmpStreamingState;
|
|
13
|
+
serverRecordingState: HMSServerRecordingState;
|
|
8
14
|
|
|
9
15
|
constructor(params: {
|
|
10
16
|
id: string;
|
|
11
17
|
name: string;
|
|
12
18
|
metaData?: string;
|
|
13
19
|
peers: HMSPeer[];
|
|
20
|
+
browserRecordingState: HMSBrowserRecordingState;
|
|
21
|
+
rtmpHMSRtmpStreamingState: HMSRtmpStreamingState;
|
|
22
|
+
serverRecordingState: HMSServerRecordingState;
|
|
14
23
|
}) {
|
|
15
24
|
this.id = params.id;
|
|
16
25
|
this.name = params.name;
|
|
17
26
|
this.metaData = params.metaData;
|
|
18
27
|
this.peers = params.peers;
|
|
28
|
+
this.browserRecordingState = params.browserRecordingState;
|
|
29
|
+
this.rtmpHMSRtmpStreamingState = params.rtmpHMSRtmpStreamingState;
|
|
30
|
+
this.serverRecordingState = params.serverRecordingState;
|
|
19
31
|
}
|
|
20
32
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HMSException } from './HMSException';
|
|
2
|
+
|
|
3
|
+
export class HMSRtmpStreamingState {
|
|
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
|
+
}
|
package/src/classes/HMSSDK.tsx
CHANGED
|
@@ -15,6 +15,8 @@ import type { HMSLogger } from './HMSLogger';
|
|
|
15
15
|
import type { HMSPeer } from './HMSPeer';
|
|
16
16
|
import { HmsView as HMSViewComponent } from './HmsView';
|
|
17
17
|
import { HMSVideoViewMode } from './HMSVideoViewMode';
|
|
18
|
+
import type { HMSTrackSettings } from './HMSTrackSettings';
|
|
19
|
+
import type { HMSRTMPConfig } from './HMSRTMPConfig';
|
|
18
20
|
|
|
19
21
|
interface HmsComponentProps {
|
|
20
22
|
trackId: string;
|
|
@@ -43,6 +45,7 @@ export class HMSSDK {
|
|
|
43
45
|
knownRoles?: HMSRole[];
|
|
44
46
|
logger?: HMSLogger;
|
|
45
47
|
id: string;
|
|
48
|
+
private muteStatus: boolean | undefined;
|
|
46
49
|
|
|
47
50
|
onPreviewDelegate?: any;
|
|
48
51
|
onJoinDelegate?: any;
|
|
@@ -70,8 +73,8 @@ export class HMSSDK {
|
|
|
70
73
|
* @returns
|
|
71
74
|
* @memberof HMSSDK
|
|
72
75
|
*/
|
|
73
|
-
static async build() {
|
|
74
|
-
let id = await HmsManager.build();
|
|
76
|
+
static async build(params?: { trackSettings?: HMSTrackSettings }) {
|
|
77
|
+
let id = await HmsManager.build(params?.trackSettings || {});
|
|
75
78
|
HmsSdk = new HMSSDK(id);
|
|
76
79
|
HmsSdk.attachPreviewListener();
|
|
77
80
|
HmsSdk.attachListeners();
|
|
@@ -261,6 +264,7 @@ export class HMSSDK {
|
|
|
261
264
|
};
|
|
262
265
|
|
|
263
266
|
await HmsManager.leave(data);
|
|
267
|
+
this.muteStatus = undefined;
|
|
264
268
|
this.localPeer = undefined;
|
|
265
269
|
this.remotePeers = undefined;
|
|
266
270
|
this.room = undefined;
|
|
@@ -296,6 +300,24 @@ export class HMSSDK {
|
|
|
296
300
|
});
|
|
297
301
|
};
|
|
298
302
|
|
|
303
|
+
changeMetadata = (metadata: string) => {
|
|
304
|
+
this.logger?.verbose('CHANGE_METADATA', { metadata });
|
|
305
|
+
HmsManager.changeMetadata({ metadata, id: this.id });
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
startRTMPOrRecording = async (data: HMSRTMPConfig) => {
|
|
309
|
+
this.logger?.verbose('START_RTMP_OR_RECORDING', { data });
|
|
310
|
+
|
|
311
|
+
const op = await HmsManager.startRTMPOrRecording({ ...data, id: this.id });
|
|
312
|
+
return op;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
stopRtmpAndRecording = async () => {
|
|
316
|
+
this.logger?.verbose('STOP_RTMP_OR_RECORDING', {});
|
|
317
|
+
const op = await HmsManager.stopRtmpAndRecording({ id: this.id });
|
|
318
|
+
return op;
|
|
319
|
+
};
|
|
320
|
+
|
|
299
321
|
changeRole = (peer: HMSPeer, role: HMSRole, force: boolean = false) => {
|
|
300
322
|
const data = {
|
|
301
323
|
peerId: peer?.peerID,
|
|
@@ -370,6 +392,7 @@ export class HMSSDK {
|
|
|
370
392
|
|
|
371
393
|
muteAllPeersAudio = (mute: boolean) => {
|
|
372
394
|
this.logger?.verbose('ON_MUTE_ALL_PEERS', { mute });
|
|
395
|
+
this.muteStatus = mute;
|
|
373
396
|
HmsManager.muteAllPeersAudio({ mute, id: this.id });
|
|
374
397
|
};
|
|
375
398
|
|
|
@@ -381,6 +404,16 @@ export class HMSSDK {
|
|
|
381
404
|
return encodedHmsRoom;
|
|
382
405
|
};
|
|
383
406
|
|
|
407
|
+
setVolume = (track: HMSTrack, volume: number) => {
|
|
408
|
+
this.logger?.verbose('SET_VOLUME_CALL', { track, volume });
|
|
409
|
+
HmsManager.setVolume({
|
|
410
|
+
id: this.id,
|
|
411
|
+
trackId: track.trackId,
|
|
412
|
+
volume,
|
|
413
|
+
});
|
|
414
|
+
return;
|
|
415
|
+
};
|
|
416
|
+
|
|
384
417
|
/**
|
|
385
418
|
* - This is a prototype event listener that takes action and listens for updates related to that particular action
|
|
386
419
|
* - This method will be @deprecated in future and event listener will be passed in join method
|
|
@@ -640,6 +673,9 @@ export class HMSSDK {
|
|
|
640
673
|
data.remotePeers,
|
|
641
674
|
this.id
|
|
642
675
|
);
|
|
676
|
+
if (this.muteStatus && data?.type === 'TRACK_ADDED') {
|
|
677
|
+
this.muteAllPeersAudio(this.muteStatus);
|
|
678
|
+
}
|
|
643
679
|
this.room = room;
|
|
644
680
|
this.localPeer = localPeer;
|
|
645
681
|
this.remotePeers = remotePeers;
|
|
@@ -676,7 +712,9 @@ export class HMSSDK {
|
|
|
676
712
|
return;
|
|
677
713
|
}
|
|
678
714
|
this.logger?.warn('ON_ERROR', data);
|
|
715
|
+
this.logger?.verbose('ON_ERROR', data);
|
|
679
716
|
if (this.onErrorDelegate) {
|
|
717
|
+
this.logger?.verbose('ON_ERROR_LISTENER_CALL', data);
|
|
680
718
|
this.logger?.warn('ON_ERROR_LISTENER_CALL', data);
|
|
681
719
|
this.onErrorDelegate(data);
|
|
682
720
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HMSException } from './HMSException';
|
|
2
|
+
|
|
3
|
+
export class HMSServerRecordingState {
|
|
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
|
+
}
|
package/src/classes/HMSTrack.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
2
1
|
import type { HMSTrackType } from './HMSTrackType';
|
|
3
2
|
|
|
4
|
-
const {
|
|
5
|
-
/**
|
|
6
|
-
* @ignore
|
|
7
|
-
*/
|
|
8
|
-
HmsManager,
|
|
9
|
-
} = NativeModules;
|
|
10
|
-
|
|
11
3
|
export class HMSTrack {
|
|
12
4
|
trackId: string;
|
|
13
5
|
source?: number | string;
|
|
@@ -16,13 +8,8 @@ export class HMSTrack {
|
|
|
16
8
|
id: string;
|
|
17
9
|
type?: HMSTrackType;
|
|
18
10
|
|
|
19
|
-
isMute =
|
|
20
|
-
|
|
21
|
-
let val = await HmsManager.isMute({ trackId: this.trackId, id: this.id });
|
|
22
|
-
return val;
|
|
23
|
-
} catch (err) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
11
|
+
isMute = () => {
|
|
12
|
+
return this.mute;
|
|
26
13
|
};
|
|
27
14
|
|
|
28
15
|
constructor(params: {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HMSVideoCodec } from '..';
|
|
2
2
|
|
|
3
3
|
export class HMSVideoSettings {
|
|
4
4
|
bitrate?: number;
|
|
5
5
|
frameRate: number;
|
|
6
6
|
width: number;
|
|
7
7
|
height: number;
|
|
8
|
-
codec:
|
|
8
|
+
codec: HMSVideoCodec;
|
|
9
9
|
|
|
10
10
|
constructor(params: {
|
|
11
11
|
bitrate?: number;
|
|
12
12
|
frameRate: number;
|
|
13
13
|
width: number;
|
|
14
14
|
height: number;
|
|
15
|
-
codec:
|
|
15
|
+
codec: HMSVideoCodec;
|
|
16
16
|
}) {
|
|
17
17
|
this.bitrate = params.bitrate;
|
|
18
18
|
this.frameRate = params.frameRate;
|
|
@@ -1,20 +1,23 @@
|
|
|
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
|
|
|
3
6
|
export class HMSVideoTrackSettings {
|
|
4
|
-
codec
|
|
5
|
-
resolution
|
|
6
|
-
maxBitrate
|
|
7
|
-
maxFrameRate
|
|
8
|
-
cameraFacing
|
|
7
|
+
codec: HMSVideoCodec;
|
|
8
|
+
resolution: HMSVideoResolution;
|
|
9
|
+
maxBitrate: number;
|
|
10
|
+
maxFrameRate: number;
|
|
11
|
+
cameraFacing: HMSCameraFacing;
|
|
9
12
|
trackDescription?: string;
|
|
10
13
|
simulcastSettings?: HMSSimulcastLayerSettings[];
|
|
11
14
|
|
|
12
15
|
constructor(params: {
|
|
13
|
-
codec
|
|
14
|
-
resolution
|
|
15
|
-
maxBitrate
|
|
16
|
-
maxFrameRate
|
|
17
|
-
cameraFacing
|
|
16
|
+
codec: HMSVideoCodec;
|
|
17
|
+
resolution: HMSVideoResolution;
|
|
18
|
+
maxBitrate: number;
|
|
19
|
+
maxFrameRate: number;
|
|
20
|
+
cameraFacing: HMSCameraFacing;
|
|
18
21
|
trackDescription?: string;
|
|
19
22
|
simulcastSettings?: HMSSimulcastLayerSettings[];
|
|
20
23
|
}) {
|
package/src/index.ts
CHANGED
|
@@ -40,6 +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';
|
|
43
49
|
|
|
44
50
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
45
51
|
export default HmsManager;
|