@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.
Files changed (202) hide show
  1. package/README.md +37 -39
  2. package/android/.gradle/6.9/executionHistory/executionHistory.lock +0 -0
  3. package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  5. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  6. package/android/.gradle/checksums/checksums.lock +0 -0
  7. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  8. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  9. package/android/build.gradle +1 -2
  10. package/android/src/main/java/com/reactnativehmssdk/HmsDecoder.kt +249 -230
  11. package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +145 -13
  12. package/android/src/main/java/com/reactnativehmssdk/HmsModule.kt +56 -21
  13. package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +463 -247
  14. package/android/src/main/java/com/reactnativehmssdk/HmsView.kt +15 -18
  15. package/android/src/main/java/com/reactnativehmssdk/HmssdkPackage.kt +1 -2
  16. package/android/src/main/java/com/reactnativehmssdk/HmssdkViewManager.kt +4 -10
  17. package/ios/HmsDecoder.swift +135 -35
  18. package/ios/HmsHelper.swift +103 -1
  19. package/ios/HmsManager.m +13 -9
  20. package/ios/HmsManager.swift +59 -24
  21. package/ios/HmsSDK.swift +322 -85
  22. package/ios/HmsView.swift +1 -1
  23. package/lib/commonjs/classes/HMSAudioTrackSettings.js +3 -0
  24. package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
  25. package/lib/commonjs/classes/HMSBrowserRecordingState.js +23 -0
  26. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -0
  27. package/lib/commonjs/classes/HMSCameraFacing.js +14 -0
  28. package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -0
  29. package/lib/commonjs/classes/HMSChangeTrackStateRequest.js +3 -0
  30. package/lib/commonjs/classes/HMSChangeTrackStateRequest.js.map +1 -1
  31. package/lib/commonjs/classes/HMSConfig.js +3 -1
  32. package/lib/commonjs/classes/HMSConfig.js.map +1 -1
  33. package/lib/commonjs/classes/HMSEncoder.js +27 -7
  34. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  35. package/lib/commonjs/classes/HMSException.js +30 -0
  36. package/lib/commonjs/classes/HMSException.js.map +1 -0
  37. package/lib/commonjs/classes/HMSHelper.js +2 -2
  38. package/lib/commonjs/classes/HMSHelper.js.map +1 -1
  39. package/lib/commonjs/classes/HMSLocalAudioTrack.js +32 -0
  40. package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
  41. package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
  42. package/lib/commonjs/classes/HMSLocalVideoTrack.js +18 -0
  43. package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
  44. package/lib/commonjs/classes/HMSLogger.js +28 -1
  45. package/lib/commonjs/classes/HMSLogger.js.map +1 -1
  46. package/lib/commonjs/classes/HMSPeer.js +3 -0
  47. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  48. package/lib/commonjs/classes/HMSPeerUpdate.js +1 -0
  49. package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
  50. package/lib/commonjs/classes/HMSPermissions.js +6 -0
  51. package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
  52. package/lib/commonjs/classes/HMSRTMPConfig.js +26 -0
  53. package/lib/commonjs/classes/HMSRTMPConfig.js.map +1 -0
  54. package/lib/commonjs/classes/HMSRemoteAudioTrack.js +19 -0
  55. package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
  56. package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
  57. package/lib/commonjs/classes/HMSRemoteVideoTrack.js +19 -0
  58. package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
  59. package/lib/commonjs/classes/HMSRoom.js +9 -0
  60. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  61. package/lib/commonjs/classes/HMSRtmpStreamingState.js +23 -0
  62. package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -0
  63. package/lib/commonjs/classes/HMSSDK.js +229 -125
  64. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  65. package/lib/commonjs/classes/HMSServerRecordingState.js +23 -0
  66. package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -0
  67. package/lib/commonjs/classes/HMSTrack.js +2 -19
  68. package/lib/commonjs/classes/HMSTrack.js.map +1 -1
  69. package/lib/commonjs/classes/HMSTrackSettings.js +3 -0
  70. package/lib/commonjs/classes/HMSTrackSettings.js.map +1 -1
  71. package/lib/commonjs/classes/HMSVideoCodec.js +4 -4
  72. package/lib/commonjs/classes/HMSVideoCodec.js.map +1 -1
  73. package/lib/commonjs/classes/HMSVideoResolution.js +23 -0
  74. package/lib/commonjs/classes/HMSVideoResolution.js.map +1 -0
  75. package/lib/commonjs/classes/HMSVideoSettings.js.map +1 -1
  76. package/lib/commonjs/classes/HMSVideoTrackSettings.js +0 -3
  77. package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
  78. package/lib/commonjs/index.js +98 -0
  79. package/lib/commonjs/index.js.map +1 -1
  80. package/lib/module/classes/HMSAudioTrackSettings.js +3 -0
  81. package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
  82. package/lib/module/classes/HMSBrowserRecordingState.js +14 -0
  83. package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -0
  84. package/lib/module/classes/HMSCameraFacing.js +7 -0
  85. package/lib/module/classes/HMSCameraFacing.js.map +1 -0
  86. package/lib/module/classes/HMSChangeTrackStateRequest.js +3 -0
  87. package/lib/module/classes/HMSChangeTrackStateRequest.js.map +1 -1
  88. package/lib/module/classes/HMSConfig.js +3 -1
  89. package/lib/module/classes/HMSConfig.js.map +1 -1
  90. package/lib/module/classes/HMSEncoder.js +26 -7
  91. package/lib/module/classes/HMSEncoder.js.map +1 -1
  92. package/lib/module/classes/HMSException.js +21 -0
  93. package/lib/module/classes/HMSException.js.map +1 -0
  94. package/lib/module/classes/HMSHelper.js +2 -2
  95. package/lib/module/classes/HMSHelper.js.map +1 -1
  96. package/lib/module/classes/HMSLocalAudioTrack.js +30 -1
  97. package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
  98. package/lib/module/classes/HMSLocalPeer.js.map +1 -1
  99. package/lib/module/classes/HMSLocalVideoTrack.js +15 -0
  100. package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
  101. package/lib/module/classes/HMSLogger.js +28 -1
  102. package/lib/module/classes/HMSLogger.js.map +1 -1
  103. package/lib/module/classes/HMSPeer.js +3 -0
  104. package/lib/module/classes/HMSPeer.js.map +1 -1
  105. package/lib/module/classes/HMSPeerUpdate.js +1 -0
  106. package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
  107. package/lib/module/classes/HMSPermissions.js +6 -0
  108. package/lib/module/classes/HMSPermissions.js.map +1 -1
  109. package/lib/module/classes/HMSRTMPConfig.js +17 -0
  110. package/lib/module/classes/HMSRTMPConfig.js.map +1 -0
  111. package/lib/module/classes/HMSRemoteAudioTrack.js +16 -0
  112. package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
  113. package/lib/module/classes/HMSRemotePeer.js.map +1 -1
  114. package/lib/module/classes/HMSRemoteVideoTrack.js +16 -0
  115. package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
  116. package/lib/module/classes/HMSRoom.js +9 -0
  117. package/lib/module/classes/HMSRoom.js.map +1 -1
  118. package/lib/module/classes/HMSRtmpStreamingState.js +14 -0
  119. package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -0
  120. package/lib/module/classes/HMSSDK.js +227 -125
  121. package/lib/module/classes/HMSSDK.js.map +1 -1
  122. package/lib/module/classes/HMSServerRecordingState.js +14 -0
  123. package/lib/module/classes/HMSServerRecordingState.js.map +1 -0
  124. package/lib/module/classes/HMSTrack.js +2 -17
  125. package/lib/module/classes/HMSTrack.js.map +1 -1
  126. package/lib/module/classes/HMSTrackSettings.js +3 -0
  127. package/lib/module/classes/HMSTrackSettings.js.map +1 -1
  128. package/lib/module/classes/HMSVideoCodec.js +4 -4
  129. package/lib/module/classes/HMSVideoCodec.js.map +1 -1
  130. package/lib/module/classes/HMSVideoResolution.js +14 -0
  131. package/lib/module/classes/HMSVideoResolution.js.map +1 -0
  132. package/lib/module/classes/HMSVideoSettings.js.map +1 -1
  133. package/lib/module/classes/HMSVideoTrackSettings.js +0 -3
  134. package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
  135. package/lib/module/index.js +7 -0
  136. package/lib/module/index.js.map +1 -1
  137. package/lib/typescript/classes/HMSAudioTrackSettings.d.ts +3 -0
  138. package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +9 -0
  139. package/lib/typescript/classes/HMSCameraFacing.d.ts +4 -0
  140. package/lib/typescript/classes/HMSChangeTrackStateRequest.d.ts +2 -0
  141. package/lib/typescript/classes/HMSConfig.d.ts +2 -0
  142. package/lib/typescript/classes/HMSEncoder.d.ts +3 -1
  143. package/lib/typescript/classes/HMSException.d.ts +22 -0
  144. package/lib/typescript/classes/HMSLocalAudioTrack.d.ts +1 -0
  145. package/lib/typescript/classes/HMSLocalPeer.d.ts +4 -0
  146. package/lib/typescript/classes/HMSLogger.d.ts +7 -0
  147. package/lib/typescript/classes/HMSPeer.d.ts +2 -0
  148. package/lib/typescript/classes/HMSPeerUpdate.d.ts +1 -0
  149. package/lib/typescript/classes/HMSPermissions.d.ts +4 -0
  150. package/lib/typescript/classes/HMSRTMPConfig.d.ts +10 -0
  151. package/lib/typescript/classes/HMSRemotePeer.d.ts +1 -0
  152. package/lib/typescript/classes/HMSRoom.d.ts +9 -0
  153. package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +9 -0
  154. package/lib/typescript/classes/HMSSDK.d.ts +22 -13
  155. package/lib/typescript/classes/HMSServerRecordingState.d.ts +9 -0
  156. package/lib/typescript/classes/HMSTrack.d.ts +1 -1
  157. package/lib/typescript/classes/HMSTrackSettings.d.ts +2 -0
  158. package/lib/typescript/classes/HMSVideoCodec.d.ts +4 -4
  159. package/lib/typescript/classes/HMSVideoResolution.d.ts +8 -0
  160. package/lib/typescript/classes/HMSVideoSettings.d.ts +3 -3
  161. package/lib/typescript/classes/HMSVideoTrackSettings.d.ts +13 -10
  162. package/lib/typescript/index.d.ts +7 -0
  163. package/package.json +2 -1
  164. package/src/classes/HMSAudioTrackSettings.ts +9 -1
  165. package/src/classes/HMSBrowserRecordingState.ts +11 -0
  166. package/src/classes/HMSCameraFacing.ts +4 -0
  167. package/src/classes/HMSChangeTrackStateRequest.ts +7 -1
  168. package/src/classes/HMSConfig.ts +3 -1
  169. package/src/classes/HMSEncoder.ts +22 -2
  170. package/src/classes/HMSException.ts +33 -0
  171. package/src/classes/HMSHelper.ts +2 -2
  172. package/src/classes/HMSLocalAudioTrack.ts +29 -1
  173. package/src/classes/HMSLocalPeer.ts +4 -0
  174. package/src/classes/HMSLocalVideoTrack.ts +15 -0
  175. package/src/classes/HMSLogger.ts +14 -1
  176. package/src/classes/HMSPeer.ts +3 -0
  177. package/src/classes/HMSPeerUpdate.ts +1 -0
  178. package/src/classes/HMSPermissions.ts +6 -0
  179. package/src/classes/HMSRTMPConfig.ts +15 -0
  180. package/src/classes/HMSRemoteAudioTrack.ts +16 -0
  181. package/src/classes/HMSRemotePeer.ts +1 -0
  182. package/src/classes/HMSRemoteVideoTrack.ts +16 -0
  183. package/src/classes/HMSRoom.ts +12 -0
  184. package/src/classes/HMSRtmpStreamingState.ts +11 -0
  185. package/src/classes/HMSSDK.tsx +170 -71
  186. package/src/classes/HMSServerRecordingState.ts +11 -0
  187. package/src/classes/HMSTrack.ts +2 -15
  188. package/src/classes/HMSTrackSettings.ts +3 -0
  189. package/src/classes/HMSVideoCodec.ts +4 -4
  190. package/src/classes/HMSVideoResolution.ts +9 -0
  191. package/src/classes/HMSVideoSettings.ts +3 -3
  192. package/src/classes/HMSVideoTrackSettings.ts +13 -10
  193. package/src/index.ts +7 -0
  194. package/android/.gradle/6.9/executionHistory/executionHistory.bin +0 -0
  195. package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
  196. package/android/.gradle/6.9/fileHashes/resourceHashesCache.bin +0 -0
  197. package/android/.gradle/6.9/javaCompile/classAnalysis.bin +0 -0
  198. package/android/.gradle/6.9/javaCompile/jarAnalysis.bin +0 -0
  199. package/android/.gradle/6.9/javaCompile/javaCompile.lock +0 -0
  200. package/android/.gradle/6.9/javaCompile/taskHistory.bin +0 -0
  201. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  202. package/android/.project +0 -34
@@ -0,0 +1,10 @@
1
+ export declare class HMSRTMPConfig {
2
+ meetingURL: string;
3
+ rtmpURLs?: Array<string>;
4
+ record: boolean;
5
+ constructor(params: {
6
+ meetingURL: string;
7
+ rtmpURLs?: Array<string>;
8
+ record: boolean;
9
+ });
10
+ }
@@ -16,6 +16,7 @@ export declare class HMSRemotePeer extends HMSPeer {
16
16
  isLocal?: boolean;
17
17
  customerUserID?: string;
18
18
  customerDescription?: string;
19
+ metadata?: string;
19
20
  audioTrack?: HMSAudioTrack;
20
21
  videoTrack?: HMSVideoTrack;
21
22
  role?: HMSRole;
@@ -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
  }
@@ -0,0 +1,9 @@
1
+ import type { HMSException } from './HMSException';
2
+ export declare class HMSRtmpStreamingState {
3
+ running: string;
4
+ error: HMSException;
5
+ constructor(params: {
6
+ running: string;
7
+ error: HMSException;
8
+ });
9
+ }
@@ -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(): Promise<HMSSDK>;
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<void>;
72
- sendBroadcastMessage: (message: string, type?: string | undefined) => void;
73
- sendGroupMessage: (message: string, roles: HMSRole[], type?: string | undefined) => void;
74
- sendDirectMessage: (message: string, peerId: string, type?: string | undefined) => void;
75
- changeRole: (peer: HMSPeer, role: HMSRole, force?: boolean) => void;
76
- changeTrackState: (track: HMSTrack, mute: boolean) => void;
77
- changeTrackStateRoles: (type: HMSTrackType, mute: boolean, source: string, roles: Array<HMSRole>) => void;
78
- removePeer: (peerId: string, reason: string) => void;
79
- endRoom: (lock: boolean, reason: string) => void;
80
- acceptRoleChange: () => void;
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;
@@ -0,0 +1,9 @@
1
+ import type { HMSException } from './HMSException';
2
+ export declare class HMSServerRecordingState {
3
+ running: string;
4
+ error: HMSException;
5
+ constructor(params: {
6
+ running: string;
7
+ error: HMSException;
8
+ });
9
+ }
@@ -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;
@@ -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,6 +1,6 @@
1
1
  export declare enum HMSVideoCodec {
2
- h264 = "h264",
3
- vp8 = "vp8",
4
- vp9 = "vp9",
5
- h265 = "h265"
2
+ H264 = "H264",
3
+ VP8 = "VP8",
4
+ VP9 = "VP9",
5
+ H265 = "H265"
6
6
  }
@@ -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,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.0",
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
- 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
+ }
@@ -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: { requestedBy: HMSPeer; trackType: string }) {
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
  }
@@ -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),
@@ -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
+ }
@@ -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,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
 
@@ -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 === true) {
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) {
@@ -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
  }