@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.
Files changed (148) hide show
  1. package/README.md +37 -39
  2. package/android/.gradle/checksums/checksums.lock +0 -0
  3. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  5. package/android/build.gradle +1 -1
  6. package/android/src/main/java/com/reactnativehmssdk/HmsDecoder.kt +91 -17
  7. package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +106 -0
  8. package/android/src/main/java/com/reactnativehmssdk/HmsModule.kt +38 -3
  9. package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +342 -183
  10. package/android/src/main/java/com/reactnativehmssdk/HmsView.kt +4 -1
  11. package/ios/HmsDecoder.swift +105 -18
  12. package/ios/HmsHelper.swift +92 -0
  13. package/ios/HmsManager.m +5 -1
  14. package/ios/HmsManager.swift +41 -6
  15. package/ios/HmsSDK.swift +199 -60
  16. package/ios/HmsView.swift +1 -1
  17. package/lib/commonjs/classes/HMSAudioTrackSettings.js +3 -0
  18. package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
  19. package/lib/commonjs/classes/HMSBrowserRecordingState.js +23 -0
  20. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -0
  21. package/lib/commonjs/classes/HMSCameraFacing.js +14 -0
  22. package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -0
  23. package/lib/commonjs/classes/HMSConfig.js +3 -1
  24. package/lib/commonjs/classes/HMSConfig.js.map +1 -1
  25. package/lib/commonjs/classes/HMSEncoder.js +20 -3
  26. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  27. package/lib/commonjs/classes/HMSException.js +30 -0
  28. package/lib/commonjs/classes/HMSException.js.map +1 -0
  29. package/lib/commonjs/classes/HMSHelper.js +2 -2
  30. package/lib/commonjs/classes/HMSHelper.js.map +1 -1
  31. package/lib/commonjs/classes/HMSLocalAudioTrack.js +12 -0
  32. package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
  33. package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
  34. package/lib/commonjs/classes/HMSPeer.js +3 -0
  35. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  36. package/lib/commonjs/classes/HMSPeerUpdate.js +1 -0
  37. package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
  38. package/lib/commonjs/classes/HMSPermissions.js +6 -0
  39. package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
  40. package/lib/commonjs/classes/HMSRTMPConfig.js +26 -0
  41. package/lib/commonjs/classes/HMSRTMPConfig.js.map +1 -0
  42. package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
  43. package/lib/commonjs/classes/HMSRoom.js +9 -0
  44. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  45. package/lib/commonjs/classes/HMSRtmpStreamingState.js +23 -0
  46. package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -0
  47. package/lib/commonjs/classes/HMSSDK.js +129 -70
  48. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  49. package/lib/commonjs/classes/HMSServerRecordingState.js +23 -0
  50. package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -0
  51. package/lib/commonjs/classes/HMSTrack.js +2 -19
  52. package/lib/commonjs/classes/HMSTrack.js.map +1 -1
  53. package/lib/commonjs/classes/HMSVideoResolution.js +23 -0
  54. package/lib/commonjs/classes/HMSVideoResolution.js.map +1 -0
  55. package/lib/commonjs/classes/HMSVideoSettings.js.map +1 -1
  56. package/lib/commonjs/classes/HMSVideoTrackSettings.js +0 -3
  57. package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
  58. package/lib/commonjs/index.js +84 -0
  59. package/lib/commonjs/index.js.map +1 -1
  60. package/lib/module/classes/HMSAudioTrackSettings.js +3 -0
  61. package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
  62. package/lib/module/classes/HMSBrowserRecordingState.js +14 -0
  63. package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -0
  64. package/lib/module/classes/HMSCameraFacing.js +7 -0
  65. package/lib/module/classes/HMSCameraFacing.js.map +1 -0
  66. package/lib/module/classes/HMSConfig.js +3 -1
  67. package/lib/module/classes/HMSConfig.js.map +1 -1
  68. package/lib/module/classes/HMSEncoder.js +19 -3
  69. package/lib/module/classes/HMSEncoder.js.map +1 -1
  70. package/lib/module/classes/HMSException.js +21 -0
  71. package/lib/module/classes/HMSException.js.map +1 -0
  72. package/lib/module/classes/HMSHelper.js +2 -2
  73. package/lib/module/classes/HMSHelper.js.map +1 -1
  74. package/lib/module/classes/HMSLocalAudioTrack.js +13 -1
  75. package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
  76. package/lib/module/classes/HMSLocalPeer.js.map +1 -1
  77. package/lib/module/classes/HMSPeer.js +3 -0
  78. package/lib/module/classes/HMSPeer.js.map +1 -1
  79. package/lib/module/classes/HMSPeerUpdate.js +1 -0
  80. package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
  81. package/lib/module/classes/HMSPermissions.js +6 -0
  82. package/lib/module/classes/HMSPermissions.js.map +1 -1
  83. package/lib/module/classes/HMSRTMPConfig.js +17 -0
  84. package/lib/module/classes/HMSRTMPConfig.js.map +1 -0
  85. package/lib/module/classes/HMSRemotePeer.js.map +1 -1
  86. package/lib/module/classes/HMSRoom.js +9 -0
  87. package/lib/module/classes/HMSRoom.js.map +1 -1
  88. package/lib/module/classes/HMSRtmpStreamingState.js +14 -0
  89. package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -0
  90. package/lib/module/classes/HMSSDK.js +130 -70
  91. package/lib/module/classes/HMSSDK.js.map +1 -1
  92. package/lib/module/classes/HMSServerRecordingState.js +14 -0
  93. package/lib/module/classes/HMSServerRecordingState.js.map +1 -0
  94. package/lib/module/classes/HMSTrack.js +2 -17
  95. package/lib/module/classes/HMSTrack.js.map +1 -1
  96. package/lib/module/classes/HMSVideoResolution.js +14 -0
  97. package/lib/module/classes/HMSVideoResolution.js.map +1 -0
  98. package/lib/module/classes/HMSVideoSettings.js.map +1 -1
  99. package/lib/module/classes/HMSVideoTrackSettings.js +0 -3
  100. package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
  101. package/lib/module/index.js +6 -0
  102. package/lib/module/index.js.map +1 -1
  103. package/lib/typescript/classes/HMSAudioTrackSettings.d.ts +3 -0
  104. package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +9 -0
  105. package/lib/typescript/classes/HMSCameraFacing.d.ts +4 -0
  106. package/lib/typescript/classes/HMSConfig.d.ts +2 -0
  107. package/lib/typescript/classes/HMSEncoder.d.ts +3 -1
  108. package/lib/typescript/classes/HMSException.d.ts +22 -0
  109. package/lib/typescript/classes/HMSLocalAudioTrack.d.ts +1 -0
  110. package/lib/typescript/classes/HMSLocalPeer.d.ts +1 -0
  111. package/lib/typescript/classes/HMSPeer.d.ts +2 -0
  112. package/lib/typescript/classes/HMSPeerUpdate.d.ts +1 -0
  113. package/lib/typescript/classes/HMSPermissions.d.ts +4 -0
  114. package/lib/typescript/classes/HMSRTMPConfig.d.ts +10 -0
  115. package/lib/typescript/classes/HMSRemotePeer.d.ts +1 -0
  116. package/lib/typescript/classes/HMSRoom.d.ts +9 -0
  117. package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +9 -0
  118. package/lib/typescript/classes/HMSSDK.d.ts +10 -1
  119. package/lib/typescript/classes/HMSServerRecordingState.d.ts +9 -0
  120. package/lib/typescript/classes/HMSTrack.d.ts +1 -1
  121. package/lib/typescript/classes/HMSVideoResolution.d.ts +8 -0
  122. package/lib/typescript/classes/HMSVideoSettings.d.ts +3 -3
  123. package/lib/typescript/classes/HMSVideoTrackSettings.d.ts +13 -10
  124. package/lib/typescript/index.d.ts +6 -0
  125. package/package.json +1 -1
  126. package/src/classes/HMSAudioTrackSettings.ts +9 -1
  127. package/src/classes/HMSBrowserRecordingState.ts +11 -0
  128. package/src/classes/HMSCameraFacing.ts +4 -0
  129. package/src/classes/HMSConfig.ts +3 -1
  130. package/src/classes/HMSEncoder.ts +19 -2
  131. package/src/classes/HMSException.ts +33 -0
  132. package/src/classes/HMSHelper.ts +2 -2
  133. package/src/classes/HMSLocalAudioTrack.ts +13 -1
  134. package/src/classes/HMSLocalPeer.ts +1 -0
  135. package/src/classes/HMSPeer.ts +3 -0
  136. package/src/classes/HMSPeerUpdate.ts +1 -0
  137. package/src/classes/HMSPermissions.ts +6 -0
  138. package/src/classes/HMSRTMPConfig.ts +15 -0
  139. package/src/classes/HMSRemotePeer.ts +1 -0
  140. package/src/classes/HMSRoom.ts +12 -0
  141. package/src/classes/HMSRtmpStreamingState.ts +11 -0
  142. package/src/classes/HMSSDK.tsx +40 -2
  143. package/src/classes/HMSServerRecordingState.ts +11 -0
  144. package/src/classes/HMSTrack.ts +2 -15
  145. package/src/classes/HMSVideoResolution.ts +9 -0
  146. package/src/classes/HMSVideoSettings.ts +3 -3
  147. package/src/classes/HMSVideoTrackSettings.ts +13 -10
  148. package/src/index.ts +6 -0
@@ -6,7 +6,7 @@ export declare class HMSTrack {
6
6
  mute?: boolean;
7
7
  id: string;
8
8
  type?: HMSTrackType;
9
- isMute: () => Promise<any>;
9
+ isMute: () => boolean | undefined;
10
10
  constructor(params: {
11
11
  trackId: string;
12
12
  source?: number | string;
@@ -0,0 +1,8 @@
1
+ export declare class HMSVideoResolution {
2
+ height?: number;
3
+ width?: number;
4
+ constructor(params: {
5
+ height: number;
6
+ width: number;
7
+ });
8
+ }
@@ -1,15 +1,15 @@
1
- import type { HMSAudioCodec } from './HMSAudioCodec';
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: HMSAudioCodec;
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: HMSAudioCodec;
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?: any;
4
- resolution?: any;
5
- maxBitrate?: number;
6
- maxFrameRate?: number;
7
- cameraFacing?: any;
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?: any;
12
- resolution?: any;
13
- maxBitrate?: number;
14
- maxFrameRate?: number;
15
- cameraFacing?: any;
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@100mslive/react-native-hms",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "The React Native package for 100ms SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -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
- constructor(params: { maxBitrate: number; trackDescription?: string }) {
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
+ }
@@ -0,0 +1,4 @@
1
+ export enum HMSCameraFacing {
2
+ FRONT = 'FRONT',
3
+ BACK = 'BACK',
4
+ }
@@ -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: any, id: string) {
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
+ }
@@ -5,8 +5,8 @@ export class HMSHelper {
5
5
  let names: string[] = [];
6
6
 
7
7
  roles?.map((item: HMSRole) => {
8
- if (item.name) {
9
- names.push(item.name);
8
+ if (item?.name) {
9
+ names.push(item?.name);
10
10
  }
11
11
  });
12
12
 
@@ -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;
@@ -25,6 +25,7 @@ export class HMSLocalPeer extends HMSPeer {
25
25
  isLocal?: boolean;
26
26
  customerUserID?: string;
27
27
  customerDescription?: string;
28
+ metadata?: string;
28
29
  audioTrack?: HMSAudioTrack;
29
30
  videoTrack?: HMSVideoTrack;
30
31
  role?: HMSRole;
@@ -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
+ }
@@ -24,6 +24,7 @@ export class HMSRemotePeer extends HMSPeer {
24
24
  isLocal?: boolean;
25
25
  customerUserID?: string;
26
26
  customerDescription?: string;
27
+ metadata?: string;
27
28
  audioTrack?: HMSAudioTrack;
28
29
  videoTrack?: HMSVideoTrack;
29
30
  role?: HMSRole;
@@ -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
+ }
@@ -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
+ }
@@ -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 = async () => {
20
- try {
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: {
@@ -0,0 +1,9 @@
1
+ export class HMSVideoResolution {
2
+ height?: number;
3
+ width?: number;
4
+
5
+ constructor(params: { height: number; width: number }) {
6
+ this.height = params.height;
7
+ this.width = params.width;
8
+ }
9
+ }
@@ -1,18 +1,18 @@
1
- import type { HMSAudioCodec } from './HMSAudioCodec';
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: HMSAudioCodec;
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: HMSAudioCodec;
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?: any; //TODO: make it HMSCodec Type
5
- resolution?: any; //TODO: make it HMSVideoResolution Type
6
- maxBitrate?: number;
7
- maxFrameRate?: number;
8
- cameraFacing?: any; //TODO: make it HMSCameraFacing type
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?: any; //TODO: make it HMSCodec Type
14
- resolution?: any; //TODO: make it HMSVideoResolution Type
15
- maxBitrate?: number;
16
- maxFrameRate?: number;
17
- cameraFacing?: any; //TODO: make it HMSCameraFacing type
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;