@100mslive/react-native-hms 0.9.0 → 0.9.3

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 (206) hide show
  1. package/README.md +242 -21
  2. package/android/.gradle/6.9/fileHashes/fileHashes.bin +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/outputFiles.bin +0 -0
  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/.idea/gradle.xml +13 -0
  10. package/android/.idea/misc.xml +9 -0
  11. package/android/.idea/modules/android.iml +18 -0
  12. package/android/.idea/modules.xml +8 -0
  13. package/android/.idea/sonarlint/issuestore/f/0/f07866736216be0ee2aba49e392191aeae700a35 +0 -0
  14. package/android/.idea/sonarlint/issuestore/index.pb +3 -0
  15. package/android/.idea/vcs.xml +6 -0
  16. package/android/build.gradle +2 -2
  17. package/android/local.properties +8 -0
  18. package/android/src/main/java/com/reactnativehmssdk/HmsDecoder.kt +53 -4
  19. package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +138 -64
  20. package/android/src/main/java/com/reactnativehmssdk/HmsModule.kt +19 -5
  21. package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +133 -109
  22. package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +11 -0
  23. package/android/src/main/java/com/reactnativehmssdk/HmsView.kt +3 -27
  24. package/android/src/main/java/com/reactnativehmssdk/HmssdkViewManager.kt +0 -2
  25. package/ios/HmsDecoder.swift +218 -137
  26. package/ios/HmsHelper.swift +51 -40
  27. package/ios/HmsManager.m +7 -1
  28. package/ios/HmsManager.swift +111 -68
  29. package/ios/HmsSDK.swift +345 -203
  30. package/ios/HmsView.swift +45 -31
  31. package/ios/VideoCollectionViewCell.swift +4 -4
  32. package/lib/commonjs/classes/HMSBrowserRecordingState.js +6 -0
  33. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
  34. package/lib/commonjs/classes/HMSConfig.js +3 -0
  35. package/lib/commonjs/classes/HMSConfig.js.map +1 -1
  36. package/lib/commonjs/classes/HMSEncoder.js +196 -5
  37. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  38. package/lib/commonjs/classes/HMSHLSConfig.js +3 -0
  39. package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -1
  40. package/lib/commonjs/classes/HMSHLSRecordingConfig.js +23 -0
  41. package/lib/commonjs/classes/HMSHLSRecordingConfig.js.map +1 -0
  42. package/lib/commonjs/classes/HMSHLSRecordingState.js +29 -0
  43. package/lib/commonjs/classes/HMSHLSRecordingState.js.map +1 -0
  44. package/lib/commonjs/classes/HMSHLSVariant.js.map +1 -1
  45. package/lib/commonjs/classes/HMSLocalAudioStats.js +26 -0
  46. package/lib/commonjs/classes/HMSLocalAudioStats.js.map +1 -0
  47. package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
  48. package/lib/commonjs/classes/HMSLocalVideoStats.js +32 -0
  49. package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -0
  50. package/lib/commonjs/classes/HMSLogger.js +21 -21
  51. package/lib/commonjs/classes/HMSLogger.js.map +1 -1
  52. package/lib/commonjs/classes/HMSMessage.js +4 -1
  53. package/lib/commonjs/classes/HMSMessage.js.map +1 -1
  54. package/lib/commonjs/classes/HMSMessageRecipient.js +26 -0
  55. package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -0
  56. package/lib/commonjs/classes/HMSMessageRecipientType.js +15 -0
  57. package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -0
  58. package/lib/commonjs/classes/HMSNetworkQuality.js +20 -0
  59. package/lib/commonjs/classes/HMSNetworkQuality.js.map +1 -0
  60. package/lib/commonjs/classes/HMSPeer.js +3 -0
  61. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  62. package/lib/commonjs/classes/HMSPeerUpdate.js +2 -7
  63. package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
  64. package/lib/commonjs/classes/HMSPermissions.js +2 -2
  65. package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
  66. package/lib/commonjs/classes/HMSRTCStats.js +38 -0
  67. package/lib/commonjs/classes/HMSRTCStats.js.map +1 -0
  68. package/lib/commonjs/classes/HMSRTCStatsReport.js +26 -0
  69. package/lib/commonjs/classes/HMSRTCStatsReport.js.map +1 -0
  70. package/lib/commonjs/classes/HMSRemoteAudioStats.js +32 -0
  71. package/lib/commonjs/classes/HMSRemoteAudioStats.js.map +1 -0
  72. package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
  73. package/lib/commonjs/classes/HMSRemoteVideoStats.js +38 -0
  74. package/lib/commonjs/classes/HMSRemoteVideoStats.js.map +1 -0
  75. package/lib/commonjs/classes/HMSRoom.js +6 -0
  76. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  77. package/lib/commonjs/classes/HMSRoomUpdate.js +1 -0
  78. package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
  79. package/lib/commonjs/classes/HMSRtmpStreamingState.js +6 -0
  80. package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
  81. package/lib/commonjs/classes/HMSSDK.js +381 -114
  82. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  83. package/lib/commonjs/classes/HMSServerRecordingState.js +3 -0
  84. package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
  85. package/lib/commonjs/classes/HMSUpdateListenerActions.js +5 -0
  86. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  87. package/lib/commonjs/index.js +154 -0
  88. package/lib/commonjs/index.js.map +1 -1
  89. package/lib/module/classes/HMSBrowserRecordingState.js +6 -0
  90. package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
  91. package/lib/module/classes/HMSConfig.js +3 -0
  92. package/lib/module/classes/HMSConfig.js.map +1 -1
  93. package/lib/module/classes/HMSEncoder.js +187 -5
  94. package/lib/module/classes/HMSEncoder.js.map +1 -1
  95. package/lib/module/classes/HMSHLSConfig.js +3 -0
  96. package/lib/module/classes/HMSHLSConfig.js.map +1 -1
  97. package/lib/module/classes/HMSHLSRecordingConfig.js +14 -0
  98. package/lib/module/classes/HMSHLSRecordingConfig.js.map +1 -0
  99. package/lib/module/classes/HMSHLSRecordingState.js +20 -0
  100. package/lib/module/classes/HMSHLSRecordingState.js.map +1 -0
  101. package/lib/module/classes/HMSHLSVariant.js.map +1 -1
  102. package/lib/module/classes/HMSLocalAudioStats.js +17 -0
  103. package/lib/module/classes/HMSLocalAudioStats.js.map +1 -0
  104. package/lib/module/classes/HMSLocalPeer.js.map +1 -1
  105. package/lib/module/classes/HMSLocalVideoStats.js +23 -0
  106. package/lib/module/classes/HMSLocalVideoStats.js.map +1 -0
  107. package/lib/module/classes/HMSLogger.js +21 -21
  108. package/lib/module/classes/HMSLogger.js.map +1 -1
  109. package/lib/module/classes/HMSMessage.js +4 -1
  110. package/lib/module/classes/HMSMessage.js.map +1 -1
  111. package/lib/module/classes/HMSMessageRecipient.js +17 -0
  112. package/lib/module/classes/HMSMessageRecipient.js.map +1 -0
  113. package/lib/module/classes/HMSMessageRecipientType.js +8 -0
  114. package/lib/module/classes/HMSMessageRecipientType.js.map +1 -0
  115. package/lib/module/classes/HMSNetworkQuality.js +11 -0
  116. package/lib/module/classes/HMSNetworkQuality.js.map +1 -0
  117. package/lib/module/classes/HMSPeer.js +3 -0
  118. package/lib/module/classes/HMSPeer.js.map +1 -1
  119. package/lib/module/classes/HMSPeerUpdate.js +2 -7
  120. package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
  121. package/lib/module/classes/HMSPermissions.js +2 -2
  122. package/lib/module/classes/HMSPermissions.js.map +1 -1
  123. package/lib/module/classes/HMSRTCStats.js +29 -0
  124. package/lib/module/classes/HMSRTCStats.js.map +1 -0
  125. package/lib/module/classes/HMSRTCStatsReport.js +17 -0
  126. package/lib/module/classes/HMSRTCStatsReport.js.map +1 -0
  127. package/lib/module/classes/HMSRemoteAudioStats.js +23 -0
  128. package/lib/module/classes/HMSRemoteAudioStats.js.map +1 -0
  129. package/lib/module/classes/HMSRemotePeer.js.map +1 -1
  130. package/lib/module/classes/HMSRemoteVideoStats.js +29 -0
  131. package/lib/module/classes/HMSRemoteVideoStats.js.map +1 -0
  132. package/lib/module/classes/HMSRoom.js +6 -0
  133. package/lib/module/classes/HMSRoom.js.map +1 -1
  134. package/lib/module/classes/HMSRoomUpdate.js +1 -0
  135. package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
  136. package/lib/module/classes/HMSRtmpStreamingState.js +6 -0
  137. package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
  138. package/lib/module/classes/HMSSDK.js +368 -114
  139. package/lib/module/classes/HMSSDK.js.map +1 -1
  140. package/lib/module/classes/HMSServerRecordingState.js +3 -0
  141. package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
  142. package/lib/module/classes/HMSUpdateListenerActions.js +5 -0
  143. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  144. package/lib/module/index.js +11 -0
  145. package/lib/module/index.js.map +1 -1
  146. package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +4 -0
  147. package/lib/typescript/classes/HMSConfig.d.ts +2 -0
  148. package/lib/typescript/classes/HMSEncoder.d.ts +25 -0
  149. package/lib/typescript/classes/HMSHLSConfig.d.ts +5 -2
  150. package/lib/typescript/classes/HMSHLSRecordingConfig.d.ts +8 -0
  151. package/lib/typescript/classes/HMSHLSRecordingState.d.ts +12 -0
  152. package/lib/typescript/classes/HMSHLSVariant.d.ts +8 -8
  153. package/lib/typescript/classes/HMSLocalAudioStats.d.ts +10 -0
  154. package/lib/typescript/classes/HMSLocalPeer.d.ts +2 -0
  155. package/lib/typescript/classes/HMSLocalVideoStats.d.ts +15 -0
  156. package/lib/typescript/classes/HMSMessage.d.ts +8 -4
  157. package/lib/typescript/classes/HMSMessageRecipient.d.ts +13 -0
  158. package/lib/typescript/classes/HMSMessageRecipientType.d.ts +5 -0
  159. package/lib/typescript/classes/HMSNetworkQuality.d.ts +6 -0
  160. package/lib/typescript/classes/HMSPeer.d.ts +3 -0
  161. package/lib/typescript/classes/HMSPeerUpdate.d.ts +3 -8
  162. package/lib/typescript/classes/HMSPermissions.d.ts +2 -2
  163. package/lib/typescript/classes/HMSRTCStats.d.ts +18 -0
  164. package/lib/typescript/classes/HMSRTCStatsReport.d.ts +11 -0
  165. package/lib/typescript/classes/HMSRemoteAudioStats.d.ts +14 -0
  166. package/lib/typescript/classes/HMSRemotePeer.d.ts +2 -0
  167. package/lib/typescript/classes/HMSRemoteVideoStats.d.ts +19 -0
  168. package/lib/typescript/classes/HMSRoom.d.ts +5 -0
  169. package/lib/typescript/classes/HMSRoomUpdate.d.ts +2 -1
  170. package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +4 -0
  171. package/lib/typescript/classes/HMSSDK.d.ts +310 -8
  172. package/lib/typescript/classes/HMSServerRecordingState.d.ts +2 -0
  173. package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +6 -1
  174. package/lib/typescript/index.d.ts +11 -0
  175. package/package.json +1 -1
  176. package/react-native-hms.podspec +1 -1
  177. package/src/classes/HMSBrowserRecordingState.ts +10 -1
  178. package/src/classes/HMSConfig.ts +3 -0
  179. package/src/classes/HMSEncoder.ts +208 -5
  180. package/src/classes/HMSHLSConfig.ts +8 -2
  181. package/src/classes/HMSHLSRecordingConfig.ts +9 -0
  182. package/src/classes/HMSHLSRecordingState.ts +18 -0
  183. package/src/classes/HMSHLSVariant.ts +8 -8
  184. package/src/classes/HMSLocalAudioStats.ts +15 -0
  185. package/src/classes/HMSLocalPeer.ts +2 -0
  186. package/src/classes/HMSLocalVideoStats.ts +23 -0
  187. package/src/classes/HMSLogger.ts +3 -3
  188. package/src/classes/HMSMessage.ts +11 -5
  189. package/src/classes/HMSMessageRecipient.ts +19 -0
  190. package/src/classes/HMSMessageRecipientType.ts +5 -0
  191. package/src/classes/HMSNetworkQuality.ts +7 -0
  192. package/src/classes/HMSPeer.ts +4 -2
  193. package/src/classes/HMSPeerUpdate.ts +2 -7
  194. package/src/classes/HMSPermissions.ts +3 -3
  195. package/src/classes/HMSRTCStats.ts +27 -0
  196. package/src/classes/HMSRTCStatsReport.ts +17 -0
  197. package/src/classes/HMSRemoteAudioStats.ts +21 -0
  198. package/src/classes/HMSRemotePeer.ts +2 -0
  199. package/src/classes/HMSRemoteVideoStats.ts +29 -0
  200. package/src/classes/HMSRoom.ts +7 -0
  201. package/src/classes/HMSRoomUpdate.ts +1 -0
  202. package/src/classes/HMSRtmpStreamingState.ts +10 -1
  203. package/src/classes/HMSSDK.tsx +530 -18
  204. package/src/classes/HMSServerRecordingState.ts +7 -1
  205. package/src/classes/HMSUpdateListenerActions.ts +5 -0
  206. package/src/index.ts +11 -0
package/README.md CHANGED
@@ -14,16 +14,25 @@
14
14
  [![Discord](https://img.shields.io/discord/843749923060711464?label=Join%20on%20Discord)](https://100ms.live/discord)
15
15
  [![Firebase](https://img.shields.io/badge/Download%20Android-Firebase-green)](https://appdistribution.firebase.dev/i/7b7ab3b30e627c35)
16
16
  [![TestFlight](https://img.shields.io/badge/Download%20iOS-TestFlight-blue)](https://testflight.apple.com/join/v4bSIPad)
17
+ [![Activity](https://img.shields.io/github/commit-activity/m/100mslive/react-native-hms.svg)](https://github.com/100mslive/react-native-hms/projects/1)
17
18
  [![Register](https://img.shields.io/badge/Contact-Know%20More-blue)](https://dashboard.100ms.live/register)
18
19
 
19
20
  React native wrapper for 100ms SDK
20
21
 
22
+ ## Run Example App
23
+
24
+ To run the example app on your system, follow these steps -
25
+
26
+ 1. In the project root, run `npm install`
27
+ 2. Go to the example folder, `cd example`
28
+ 3. In the example folder, run `npm install`
29
+ 4. To run on Android, run `npx react-native run-android`
30
+ 5. To run on iOS, first install the pods in iOS folder, `cd ios; pod install`. Then, in example folder, run `npx react-native run-ios`
31
+
21
32
  ## Installation
22
33
 
23
34
  ```bash
24
35
  npm install @100mslive/react-native-hms --save
25
-
26
- cd ios/ && pod install
27
36
  ```
28
37
 
29
38
  📲 Download the Sample iOS App here: https://testflight.apple.com/join/v4bSIPad
@@ -63,7 +72,7 @@ We suggest using [react-native-permission](https://www.npmjs.com/package/react-n
63
72
 
64
73
  The package exports all the classes and a HMSSDK class that manages everything.
65
74
 
66
- # Setting up the HMS Instance:
75
+ ## Setting up the HMS Instance
67
76
 
68
77
  first we'll have to call build method, that method returns an instance of HMSSDK class and the same is used to perform all the operations
69
78
 
@@ -77,7 +86,7 @@ const hmsInstance = await HMSSDK.build();
77
86
  ...
78
87
  ```
79
88
 
80
- # Add event listeners
89
+ ## Add event listeners
81
90
 
82
91
  add event listeners for all the events such as onPreview, onJoin, onPeerUpdate etc. the actions can be found in HMSUpdateListenerActions class
83
92
 
@@ -96,7 +105,16 @@ hmsInstance.addEventListener(
96
105
 
97
106
  The event handlers are the way of handling any update happening in hms all events can be found in HMSUpdateListenerActions class
98
107
 
99
- # Join the room
108
+ ## Error handling
109
+
110
+ ```js
111
+ import { HMSUpdateListenerActions } from '@100mslive/react-native-hms';
112
+
113
+ // add an error event listener
114
+ hmsInstance.addEventListener(HMSUpdateListenerActions.ON_ERROR, onError);
115
+ ```
116
+
117
+ ## Join the room
100
118
 
101
119
  Joining the room connects you to the remote peer and broadcasts your stream to other peers, we need instance of HMSConfig in order to pass the details of room and user to join function
102
120
 
@@ -116,7 +134,23 @@ hmsInstance.join(HmsConfig); // to join a room
116
134
 
117
135
  don't forget to add ON_JOIN listener before calling join to receive an event callback
118
136
 
119
- # Viewing the video of a peer
137
+ ## Calling various functions of HMS
138
+
139
+ ```js
140
+ // Mute Audio
141
+ hmsInstance?.localPeer?.localAudioTrack()?.setMute(true);
142
+
143
+ // Stop Video
144
+ hmsInstance?.localPeer?.localVideoTrack()?.setMute(true);
145
+
146
+ // Switch Camera
147
+ hmsInstance?.localPeer?.localVideoTrack()?.switchCamera();
148
+
149
+ // Leave the call (async function)
150
+ await hmsInstance?.leave();
151
+ ```
152
+
153
+ ## Viewing the video of a peer
120
154
 
121
155
  To display a video on screen the package provide a UI component named HmsView that takes the video track ID and displays the video in that component, this component requires on _width_ and _height_ in _style_ prop to set bounds of the tile that will show the video stream
122
156
 
@@ -142,7 +176,7 @@ remotePeers.map((remotePeer: HMSRemotePeer) => {
142
176
  ...
143
177
  ```
144
178
 
145
- # Display a video in HmsView
179
+ ## Display a video in HmsView
146
180
 
147
181
  ```js
148
182
  import { HMSVideoViewMode } from '@100mslive/react-native-hms';
@@ -166,23 +200,44 @@ const styles = StyleSheet.create({
166
200
  ...
167
201
  ```
168
202
 
169
- # Calling various functions of HMS
203
+ ## Mute/Unmute others
170
204
 
171
205
  ```js
172
- // Mute Audio
173
- hmsInstance?.localPeer?.localAudioTrack()?.setMute(true);
206
+ const mute: boolean = true;
174
207
 
175
- // Stop Video
176
- hmsInstance?.localPeer?.localVideoTrack()?.setMute(true);
208
+ // hms instance acquired by build methodhmsInstance?.changeTrackState(audioTrack as HMSTrack, mute);
209
+ hmsInstance?.changeTrackState(videoTrack as HMSTrack, mute);
177
210
 
178
- // Switch Camera
179
- hmsInstance?.localPeer?.localVideoTrack()?.switchCamera();
211
+ const unmute: boolean = false;
180
212
 
181
- // Leave the call (async function)
182
- await hmsInstance?.leave();
213
+ hmsInstance?.changeTrackState(audioTrack as HMSTrack, unmute);
214
+ hmsInstance?.changeTrackState(videoTrack as HMSTrack, unmute);
183
215
  ```
184
216
 
185
- # Sending messages
217
+ ## End Room for all
218
+
219
+ ```js
220
+ const reason = 'Host ended the room';
221
+ const lock = false; // optional parameter
222
+
223
+ // hms instance acquired by build method
224
+ hmsInstance.endRoom(reason, lock);
225
+ ```
226
+
227
+ ## Remove Peer
228
+
229
+ ```js
230
+ import { HMSPeer } from '@100mslive/react-native-hms';
231
+
232
+ const reason = 'removed from room';
233
+
234
+ // hms instance acquired by build method
235
+ const peer: HMSPeer = hmsInstance?.remotePeers[0];
236
+
237
+ hmsInstance.removePeer(peer, reason);
238
+ ```
239
+
240
+ ## Sending messages
186
241
 
187
242
  ```js
188
243
  import { HMSRole, HMSPeer } from '@100mslive/react-native-hms';
@@ -198,11 +253,177 @@ hmsInstance?.sendGroupMessage(message, [role[0]);
198
253
  hmsInstance?.sendDirectMessage(message, peer);
199
254
  ```
200
255
 
201
- # Error handling
256
+ ## Role Change
202
257
 
203
258
  ```js
204
- import { HMSUpdateListenerActions } from '@100mslive/react-native-hms';
259
+ import { HMSRole, HMSRemotePeer } from '@100mslive/react-native-hms';
260
+ // hms instance acquired by build method
261
+ const roles: HMSRole[] = hmsInstance?.knownRoles;
262
+ const newRole: HMSRole = roles[0];
205
263
 
206
- // add an error event listener
207
- hmsInstance.addEventListener(HMSUpdateListenerActions.ON_ERROR, onError);
264
+ // can any remote peer
265
+ const peer: HMSRemotePeer = hmsInstance?.remotePeers[0];
266
+
267
+ const force = false;
268
+
269
+ hmsInstance.changeRole(peer, newRole, force); // request role change
270
+ hmsInstance.changeRole(peer, newRole, !force); // force role change
271
+ ```
272
+
273
+ ## Raise Hand & BRB
274
+
275
+ ```js
276
+ const parsedMetadata = JSON.parse(hmsInstance?.localPeer?.metadata);
277
+
278
+ // Raise Hand
279
+ // hms instance acquired by build method
280
+ hmsInstance?.changeMetadata(
281
+ JSON.stringify({
282
+ ...parsedMetadata,
283
+ isHandRaised: true,
284
+ })
285
+ );
286
+
287
+ // BRB
288
+ // hms instance acquired by build method
289
+ hmsInstance?.changeMetadata(
290
+ JSON.stringify({
291
+ ...parsedMetadata,
292
+ isBRBOn: true,
293
+ })
294
+ );
295
+ ```
296
+
297
+ ## HLS Streaming
298
+
299
+ ```js
300
+ import {
301
+ HMSHLSMeetingURLVariant,
302
+ HMSHLSConfig,
303
+ } from '@100mslive/react-native-hms';
304
+
305
+ const startHLSStreaming = () => {
306
+ const hmsHLSMeetingURLVariant = new HMSHLSMeetingURLVariant({
307
+ meetingUrl:
308
+ 'https://yogi.app.100ms.live/preview/nih-bkn-vek?token=beam_recording',
309
+ metadata: '',
310
+ });
311
+
312
+ const hmsHLSConfig = new HMSHLSConfig({
313
+ meetingURLVariants: [hlsStreamingDetails],
314
+ });
315
+
316
+ // hms instance acquired by build method
317
+ hmsInstance
318
+ .startHLSStreaming(hmsHLSConfig)
319
+ .then((r) => console.log(r))
320
+ .catch((e) => console.log(e));
321
+ };
322
+ ```
323
+
324
+ ## Start Streaming / Recording
325
+
326
+ ```js
327
+ import { HMSRTMPConfig } from '@100mslive/react-native-hms';
328
+
329
+ const recordingDetails = HMSRTMPConfig({
330
+ record: true,
331
+ meetingURL: roomID + '/viewer?token=beam_recording',
332
+ rtmpURLs: [],
333
+ });
334
+
335
+ // hms instance acquired by build method
336
+ const result = await hmsInstance?.startRTMPOrRecording(recordingDetails);
337
+ ```
338
+
339
+ ## Get RTC Stats
340
+
341
+ ```js
342
+ // hms instance acquired by build method
343
+ hmsInstance?.enableRTCStats();
344
+ ```
345
+
346
+ ## Screenshare
347
+
348
+ ```js
349
+ // hms instance acquired by build method
350
+ hmsInstance?.startScreenshare();
351
+ ```
352
+
353
+ ## Getting Audio Levels for all speaking peers
354
+
355
+ ```js
356
+ import {
357
+ HMSUpdateListenerActions,
358
+ HMSSpeakerUpdate,
359
+ HMSSpeaker,
360
+ } from '@100mslive/react-native-hms';
361
+
362
+ // hms instance acquired by build method
363
+ hmsInstance?.addEventListener(HMSUpdateListenerActions.ON_SPEAKER, onSpeaker);
364
+
365
+ const onSpeaker = (data: HMSSpeakerUpdate) => {
366
+ data?.peers?.map((speaker: HMSSpeaker) =>
367
+ console.log('speaker audio level: ', speaker?.level)
368
+ );
369
+ };
370
+ ```
371
+
372
+ ## Local mute others
373
+
374
+ ```js
375
+ const remotePeer: HMSRemotePeer;
376
+ const isAudioPlaybackAllowed = remotePeer.remoteAudioTrack().setPlaybackAllowed(false);
377
+ const isVideoPlaybackAllowed = remotePeer.remoteVideoTrack().setPlaybackAllowed(true);
378
+
379
+ // hms instance acquired by build method
380
+ hmsInstance.muteAllPeersAudio(true) // mute
381
+ hmsInstance.muteAllPeersAudio(false) // unmute
382
+ ```
383
+
384
+ ## Locally Set Volume
385
+
386
+ ```js
387
+ const volume: Float = 1.0;
388
+ const track: HMSTrack = remotePeer.audioTrack as HMSTrack;
389
+
390
+ // hms instance acquired by build method
391
+ hmsInstance?.setVolume(track, volume);
392
+ ```
393
+
394
+ ## Change name
395
+
396
+ ```js
397
+ const newName: string = 'new name';
398
+
399
+ // hms instance acquired by build method
400
+ hmsInstance.changeName(newName);
401
+ ```
402
+
403
+ ## Join with specific Track Settings
404
+
405
+ ```js
406
+ const getTrackSettings = () => {
407
+ let audioSettings = new HMSAudioTrackSettings({
408
+ maxBitrate: 32,
409
+ trackDescription: 'Simple Audio Track',
410
+ });
411
+ let videoSettings = new HMSVideoTrackSettings({
412
+ codec: HMSVideoCodec.vp8,
413
+ maxBitrate: 512,
414
+ maxFrameRate: 25,
415
+ cameraFacing: HMSCameraFacing.FRONT,
416
+ trackDescription: 'Simple Video Track',
417
+ resolution: new HMSVideoResolution({ height: 180, width: 320 }),
418
+ });
419
+
420
+ return new HMSTrackSettings({ video: videoSettings, audio: audioSettings });
421
+ };
422
+
423
+ const setupBuild = async () => {
424
+ const trackSettings = getTrackSettings();
425
+ const build = await HmsManager.build({ trackSettings });
426
+ setInstance(build);
427
+ updateHms({ hmsInstance: build });
428
+ };
208
429
  ```
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="GradleSettings">
4
+ <option name="linkedExternalProjectsSettings">
5
+ <GradleProjectSettings>
6
+ <option name="testRunner" value="GRADLE" />
7
+ <option name="distributionType" value="DEFAULT_WRAPPED" />
8
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
9
+ <option name="resolveModulePerSourceSet" value="false" />
10
+ </GradleProjectSettings>
11
+ </option>
12
+ </component>
13
+ </project>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="11" project-jdk-type="JavaSDK">
4
+ <output url="file://$PROJECT_DIR$/build/classes" />
5
+ </component>
6
+ <component name="ProjectType">
7
+ <option name="id" value="Android" />
8
+ </component>
9
+ </project>
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module external.linked.project.id=":" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
3
+ <component name="FacetManager">
4
+ <facet type="android-gradle" name="Android-Gradle">
5
+ <configuration>
6
+ <option name="GRADLE_PROJECT_PATH" value=":" />
7
+ <option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
8
+ <option name="LAST_KNOWN_AGP_VERSION" />
9
+ </configuration>
10
+ </facet>
11
+ </component>
12
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
13
+ <exclude-output />
14
+ <content url="file://$MODULE_DIR$/../.." />
15
+ <orderEntry type="inheritedJdk" />
16
+ <orderEntry type="sourceFolder" forTests="false" />
17
+ </component>
18
+ </module>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/modules/android.iml" filepath="$PROJECT_DIR$/.idea/modules/android.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,3 @@
1
+
2
+ <
3
+ build.gradle,f/0/f07866736216be0ee2aba49e392191aeae700a35
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
+ </component>
6
+ </project>
@@ -26,7 +26,7 @@ def safeExtGet(prop, fallback) {
26
26
  }
27
27
 
28
28
  android {
29
- compileSdkVersion safeExtGet('Hmssdk_compileSdkVersion', 29)
29
+ compileSdkVersion safeExtGet('Hmssdk_compileSdkVersion', 30)
30
30
  defaultConfig {
31
31
  minSdkVersion safeExtGet('Hmssdk_minSdkVersion', 21)
32
32
  targetSdkVersion safeExtGet('Hmssdk_targetSdkVersion', 29)
@@ -63,7 +63,7 @@ dependencies {
63
63
  //noinspection GradleDynamicVersion
64
64
  implementation "com.facebook.react:react-native:+"
65
65
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" // From node_modules
66
- implementation 'com.github.100mslive.android-sdk:lib:2.2.8'
66
+ implementation 'com.github.100mslive.android-sdk:lib:2.3.4'
67
67
  implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
68
68
  implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
69
69
  implementation 'androidx.appcompat:appcompat:1.3.1'
@@ -0,0 +1,8 @@
1
+ ## This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ #Tue Mar 01 18:12:03 IST 2022
8
+ sdk.dir=/Users/yogesh/Library/Android/sdk
@@ -1,6 +1,7 @@
1
1
  package com.reactnativehmssdk
2
2
 
3
3
  import com.facebook.react.bridge.*
4
+ import live.hms.video.connection.stats.quality.HMSNetworkQuality
4
5
  import live.hms.video.error.HMSException
5
6
  import live.hms.video.media.settings.HMSAudioTrackSettings
6
7
  import live.hms.video.media.settings.HMSVideoResolution
@@ -34,6 +35,7 @@ object HmsDecoder {
34
35
  room.putMap("hlsStreamingState", this.getHMSHlsStreamingState(hmsRoom.hlsStreamingState))
35
36
  room.putMap("localPeer", this.getHmsLocalPeer(hmsRoom.localPeer))
36
37
  room.putArray("peers", this.getAllPeers(hmsRoom.peerList))
38
+ room.putInt("peerCount", hmsRoom.peerCount)
37
39
  }
38
40
  return room
39
41
  }
@@ -46,6 +48,7 @@ object HmsDecoder {
46
48
  peer.putBoolean("isLocal", hmsPeer.isLocal)
47
49
  peer.putString("customerUserID", hmsPeer.customerUserID)
48
50
  peer.putString("metadata", hmsPeer.metadata)
51
+ peer.putMap("networkQuality", this.getHmsNetworkQuality(hmsPeer.networkQuality))
49
52
  peer.putMap("audioTrack", this.getHmsAudioTrack(hmsPeer.audioTrack))
50
53
  peer.putMap("videoTrack", this.getHmsVideoTrack(hmsPeer.videoTrack))
51
54
  peer.putMap("role", this.getHmsRole(hmsPeer.hmsRole))
@@ -123,7 +126,7 @@ object HmsDecoder {
123
126
  permissions.putBoolean("changeRoleForce", hmsPermissions.changeRoleForce)
124
127
  permissions.putBoolean("unmute", hmsPermissions.unmute)
125
128
  permissions.putBoolean("recording", hmsPermissions.recording)
126
- permissions.putBoolean("rtmp", hmsPermissions.rtmp)
129
+ permissions.putBoolean("streaming", hmsPermissions.streaming)
127
130
  permissions.putBoolean("changeRole", hmsPermissions.changeRole)
128
131
  }
129
132
  return permissions
@@ -181,6 +184,7 @@ object HmsDecoder {
181
184
  peer.putBoolean("isLocal", hmsLocalPeer.isLocal)
182
185
  peer.putString("customerUserID", hmsLocalPeer.customerUserID)
183
186
  peer.putString("metadata", hmsLocalPeer.metadata)
187
+ peer.putMap("networkQuality", this.getHmsNetworkQuality(hmsLocalPeer.networkQuality))
184
188
  peer.putMap("audioTrack", this.getHmsAudioTrack(hmsLocalPeer.audioTrack))
185
189
  peer.putMap("videoTrack", this.getHmsVideoTrack(hmsLocalPeer.videoTrack))
186
190
  peer.putMap("role", this.getHmsRole(hmsLocalPeer.hmsRole))
@@ -275,6 +279,7 @@ object HmsDecoder {
275
279
  peer.putBoolean("isLocal", hmsRemotePeer.isLocal)
276
280
  peer.putString("customerUserID", hmsRemotePeer.customerUserID)
277
281
  peer.putString("metadata", hmsRemotePeer.metadata)
282
+ peer.putMap("networkQuality", this.getHmsNetworkQuality(hmsRemotePeer.networkQuality))
278
283
  peer.putMap("audioTrack", this.getHmsAudioTrack(hmsRemotePeer.audioTrack))
279
284
  peer.putMap("videoTrack", this.getHmsVideoTrack(hmsRemotePeer.videoTrack))
280
285
  peer.putMap("role", this.getHmsRole(hmsRemotePeer.hmsRole))
@@ -362,11 +367,34 @@ object HmsDecoder {
362
367
  return decodedError
363
368
  }
364
369
 
370
+ private fun getCustomError(message: String?, code: Int?): WritableMap {
371
+ val decodedError: WritableMap = Arguments.createMap()
372
+ var customCode = 101
373
+ var customMessage = "SOMETHING WENT WRONG"
374
+ if (code !== null) {
375
+ customCode = code.toInt()
376
+ }
377
+ if (message !== null) {
378
+ customMessage = message
379
+ }
380
+ decodedError.putInt("code", customCode)
381
+ decodedError.putString("localizedDescription", customMessage)
382
+ decodedError.putString("description", customMessage)
383
+ decodedError.putString("message", customMessage)
384
+ decodedError.putInt("name", customCode)
385
+ decodedError.putInt("action", customCode)
386
+
387
+ return decodedError
388
+ }
389
+
365
390
  private fun getHMSBrowserRecordingState(data: HMSBrowserRecordingState?): ReadableMap {
366
391
  val input = Arguments.createMap()
367
392
  if (data !== null) {
368
393
  input.putBoolean("running", data.running)
369
- input.putMap("error", data.error?.let { this.getError(it) })
394
+ input.putString("startedAt", data.startedAt.toString())
395
+ input.putString("stoppedAt", data.stoppedAt.toString())
396
+ input.putBoolean("running", data.running)
397
+ input.putMap("error", this.getCustomError(data.error?.message, data.error?.code))
370
398
  }
371
399
  return input
372
400
  }
@@ -375,7 +403,9 @@ object HmsDecoder {
375
403
  val input = Arguments.createMap()
376
404
  if (data !== null) {
377
405
  input.putBoolean("running", data.running)
378
- input.putMap("error", data.error?.let { this.getError(it) })
406
+ input.putString("startedAt", data.startedAt.toString())
407
+ input.putString("stoppedAt", data.stoppedAt.toString())
408
+ input.putMap("error", this.getCustomError(data.error?.message, data.error?.code))
379
409
  }
380
410
  return input
381
411
  }
@@ -384,6 +414,7 @@ object HmsDecoder {
384
414
  val input = Arguments.createMap()
385
415
  if (data !== null) {
386
416
  input.putBoolean("running", data.running)
417
+ input.putString("startedAt", data.startedAt.toString())
387
418
  input.putMap("error", data.error?.let { this.getError(it) })
388
419
  }
389
420
  return input
@@ -406,7 +437,7 @@ object HmsDecoder {
406
437
  input.putString("hlsStreamUrl", variant.hlsStreamUrl)
407
438
  input.putString("meetingUrl", variant.meetingUrl)
408
439
  input.putString("metadata", variant.metadata)
409
- variant.startedAt?.let { input.putInt("startedAt", it.toInt()) }
440
+ input.putString("startedAt", variant.startedAt.toString())
410
441
  variants.pushMap(input)
411
442
  }
412
443
  }
@@ -471,4 +502,22 @@ object HmsDecoder {
471
502
  }
472
503
  return decodedTracks
473
504
  }
505
+
506
+ fun getHmsMessageRecipient(recipient: HMSMessageRecipient?): WritableMap {
507
+ val hmsRecipient: WritableMap = Arguments.createMap()
508
+ if (recipient != null) {
509
+ hmsRecipient.putMap("recipientPeer", this.getHmsPeer(recipient.recipientPeer))
510
+ hmsRecipient.putArray("recipientRoles", this.getAllRoles(recipient.recipientRoles))
511
+ hmsRecipient.putString("recipientType", recipient.recipientType.name)
512
+ }
513
+ return hmsRecipient
514
+ }
515
+
516
+ private fun getHmsNetworkQuality(networkQuality: HMSNetworkQuality?): WritableMap {
517
+ val hmsNetworkQuality: WritableMap = Arguments.createMap()
518
+ if (networkQuality != null) {
519
+ hmsNetworkQuality.putInt("downlinkQuality", networkQuality.downlinkQuality)
520
+ }
521
+ return hmsNetworkQuality
522
+ }
474
523
  }