@100mslive/react-native-hms 1.1.1 → 1.3.0

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 (312) hide show
  1. package/README.md +145 -340
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +292 -94
  4. package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +127 -127
  5. package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +167 -115
  6. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +283 -45
  7. package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +7 -7
  8. package/ios/HMSDecoder.swift +276 -137
  9. package/ios/HMSHelper.swift +3 -3
  10. package/ios/HMSManager.m +7 -0
  11. package/ios/HMSManager.swift +37 -2
  12. package/ios/HMSRNSDK.swift +339 -97
  13. package/ios/HMSView.m +2 -0
  14. package/ios/HMSView.swift +35 -3
  15. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/yogesh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  16. package/lib/commonjs/classes/HMSAudioCodec.js +4 -4
  17. package/lib/commonjs/classes/HMSAudioCodec.js.map +1 -1
  18. package/lib/commonjs/classes/HMSAudioDevice.js +4 -4
  19. package/lib/commonjs/classes/HMSAudioDevice.js.map +1 -1
  20. package/lib/commonjs/classes/HMSAudioFilePlayerNode.js.map +1 -1
  21. package/lib/commonjs/classes/HMSAudioMixerSource.js.map +1 -1
  22. package/lib/commonjs/classes/HMSAudioMixingMode.js +4 -4
  23. package/lib/commonjs/classes/HMSAudioMixingMode.js.map +1 -1
  24. package/lib/commonjs/classes/HMSAudioMode.js +4 -4
  25. package/lib/commonjs/classes/HMSAudioMode.js.map +1 -1
  26. package/lib/commonjs/classes/HMSAudioNode.js +2 -1
  27. package/lib/commonjs/classes/HMSAudioNode.js.map +1 -1
  28. package/lib/commonjs/classes/HMSAudioSettings.js.map +1 -1
  29. package/lib/commonjs/classes/HMSAudioTrack.js.map +1 -1
  30. package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
  31. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
  32. package/lib/commonjs/classes/HMSCameraFacing.js +4 -4
  33. package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -1
  34. package/lib/commonjs/classes/HMSChangeTrackStateRequest.js.map +1 -1
  35. package/lib/commonjs/classes/HMSConfig.js.map +1 -1
  36. package/lib/commonjs/classes/HMSConstants.js +11 -0
  37. package/lib/commonjs/classes/HMSConstants.js.map +1 -0
  38. package/lib/commonjs/classes/HMSEncoder.js +129 -102
  39. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  40. package/lib/commonjs/classes/HMSException.js.map +1 -1
  41. package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -1
  42. package/lib/commonjs/classes/HMSHLSMeetingURLVariant.js.map +1 -1
  43. package/lib/commonjs/classes/HMSHLSRecordingConfig.js.map +1 -1
  44. package/lib/commonjs/classes/HMSHLSRecordingState.js.map +1 -1
  45. package/lib/commonjs/classes/HMSHLSStreamingState.js.map +1 -1
  46. package/lib/commonjs/classes/HMSHLSVariant.js.map +1 -1
  47. package/lib/commonjs/classes/HMSHelper.js.map +1 -1
  48. package/lib/commonjs/classes/HMSLocalAudioStats.js.map +1 -1
  49. package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
  50. package/lib/commonjs/classes/HMSLocalPeer.js +0 -1
  51. package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
  52. package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -1
  53. package/lib/commonjs/classes/HMSLocalVideoTrack.js +0 -2
  54. package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
  55. package/lib/commonjs/classes/HMSLogAlarmManager.js +4 -4
  56. package/lib/commonjs/classes/HMSLogAlarmManager.js.map +1 -1
  57. package/lib/commonjs/classes/HMSLogLevel.js +4 -4
  58. package/lib/commonjs/classes/HMSLogLevel.js.map +1 -1
  59. package/lib/commonjs/classes/HMSLogSettings.js.map +1 -1
  60. package/lib/commonjs/classes/HMSLogger.js +17 -25
  61. package/lib/commonjs/classes/HMSLogger.js.map +1 -1
  62. package/lib/commonjs/classes/HMSMessage.js.map +1 -1
  63. package/lib/commonjs/classes/HMSMessageRecipient.js +1 -1
  64. package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -1
  65. package/lib/commonjs/classes/HMSMessageRecipientType.js +4 -4
  66. package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -1
  67. package/lib/commonjs/classes/HMSMessageType.js +4 -4
  68. package/lib/commonjs/classes/HMSMessageType.js.map +1 -1
  69. package/lib/commonjs/classes/HMSMicNode.js.map +1 -1
  70. package/lib/commonjs/classes/HMSNativeEventEmitter.js +101 -0
  71. package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -0
  72. package/lib/commonjs/classes/HMSNetworkQuality.js.map +1 -1
  73. package/lib/commonjs/classes/HMSPIPListenerActions.js +4 -4
  74. package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -1
  75. package/lib/commonjs/classes/HMSPeer.js +69 -18
  76. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  77. package/lib/commonjs/classes/HMSPeerUpdate.js +7 -5
  78. package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
  79. package/lib/commonjs/classes/HMSPeersCache.js +229 -0
  80. package/lib/commonjs/classes/HMSPeersCache.js.map +1 -0
  81. package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
  82. package/lib/commonjs/classes/HMSPublishSettings.js +0 -6
  83. package/lib/commonjs/classes/HMSPublishSettings.js.map +1 -1
  84. package/lib/commonjs/classes/HMSRTCStats.js.map +1 -1
  85. package/lib/commonjs/classes/HMSRTCStatsReport.js.map +1 -1
  86. package/lib/commonjs/classes/HMSRTMPConfig.js.map +1 -1
  87. package/lib/commonjs/classes/HMSRemoteAudioStats.js.map +1 -1
  88. package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
  89. package/lib/commonjs/classes/HMSRemotePeer.js +0 -1
  90. package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
  91. package/lib/commonjs/classes/HMSRemoteVideoStats.js.map +1 -1
  92. package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
  93. package/lib/commonjs/classes/HMSRole.js +0 -6
  94. package/lib/commonjs/classes/HMSRole.js.map +1 -1
  95. package/lib/commonjs/classes/HMSRoleChangeRequest.js +3 -1
  96. package/lib/commonjs/classes/HMSRoleChangeRequest.js.map +1 -1
  97. package/lib/commonjs/classes/HMSRoom.js +79 -22
  98. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  99. package/lib/commonjs/classes/HMSRoomCache.js +128 -0
  100. package/lib/commonjs/classes/HMSRoomCache.js.map +1 -0
  101. package/lib/commonjs/classes/HMSRoomUpdate.js +4 -4
  102. package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
  103. package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
  104. package/lib/commonjs/classes/HMSRtmpVideoResolution.js.map +1 -1
  105. package/lib/commonjs/classes/HMSSDK.js +933 -158
  106. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  107. package/lib/commonjs/classes/HMSScreenBroadcastAudioReceiverNode.js.map +1 -1
  108. package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
  109. package/lib/commonjs/classes/HMSSimulcastLayerSettings.js.map +1 -1
  110. package/lib/commonjs/classes/HMSSimulcastSettings.js.map +1 -1
  111. package/lib/commonjs/classes/HMSSpeaker.js.map +1 -1
  112. package/lib/commonjs/classes/HMSSubscribeSettings.js +0 -2
  113. package/lib/commonjs/classes/HMSSubscribeSettings.js.map +1 -1
  114. package/lib/commonjs/classes/HMSTrack.js.map +1 -1
  115. package/lib/commonjs/classes/HMSTrackSettings.js.map +1 -1
  116. package/lib/commonjs/classes/HMSTrackSettingsInitState.js +4 -4
  117. package/lib/commonjs/classes/HMSTrackSettingsInitState.js.map +1 -1
  118. package/lib/commonjs/classes/HMSTrackSource.js +4 -4
  119. package/lib/commonjs/classes/HMSTrackSource.js.map +1 -1
  120. package/lib/commonjs/classes/HMSTrackType.js +4 -4
  121. package/lib/commonjs/classes/HMSTrackType.js.map +1 -1
  122. package/lib/commonjs/classes/HMSTrackUpdate.js +4 -4
  123. package/lib/commonjs/classes/HMSTrackUpdate.js.map +1 -1
  124. package/lib/commonjs/classes/HMSUpdateListenerActions.js +5 -5
  125. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  126. package/lib/commonjs/classes/HMSVideoCodec.js +4 -4
  127. package/lib/commonjs/classes/HMSVideoCodec.js.map +1 -1
  128. package/lib/commonjs/classes/HMSVideoResolution.js.map +1 -1
  129. package/lib/commonjs/classes/HMSVideoSettings.js.map +1 -1
  130. package/lib/commonjs/classes/HMSVideoTrack.js.map +1 -1
  131. package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
  132. package/lib/commonjs/classes/HMSVideoViewMode.js +4 -4
  133. package/lib/commonjs/classes/HMSVideoViewMode.js.map +1 -1
  134. package/lib/commonjs/classes/HmsView.js +2 -1
  135. package/lib/commonjs/classes/HmsView.js.map +1 -1
  136. package/lib/commonjs/index.js.map +1 -1
  137. package/lib/module/classes/HMSAudioCodec.js +3 -3
  138. package/lib/module/classes/HMSAudioCodec.js.map +1 -1
  139. package/lib/module/classes/HMSAudioDevice.js +3 -3
  140. package/lib/module/classes/HMSAudioDevice.js.map +1 -1
  141. package/lib/module/classes/HMSAudioFilePlayerNode.js.map +1 -1
  142. package/lib/module/classes/HMSAudioMixerSource.js.map +1 -1
  143. package/lib/module/classes/HMSAudioMixingMode.js +3 -3
  144. package/lib/module/classes/HMSAudioMixingMode.js.map +1 -1
  145. package/lib/module/classes/HMSAudioMode.js +3 -3
  146. package/lib/module/classes/HMSAudioMode.js.map +1 -1
  147. package/lib/module/classes/HMSAudioNode.js +2 -1
  148. package/lib/module/classes/HMSAudioNode.js.map +1 -1
  149. package/lib/module/classes/HMSAudioSettings.js.map +1 -1
  150. package/lib/module/classes/HMSAudioTrack.js.map +1 -1
  151. package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
  152. package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
  153. package/lib/module/classes/HMSCameraFacing.js +3 -3
  154. package/lib/module/classes/HMSCameraFacing.js.map +1 -1
  155. package/lib/module/classes/HMSChangeTrackStateRequest.js.map +1 -1
  156. package/lib/module/classes/HMSConfig.js.map +1 -1
  157. package/lib/module/classes/HMSConstants.js +4 -0
  158. package/lib/module/classes/HMSConstants.js.map +1 -0
  159. package/lib/module/classes/HMSEncoder.js +129 -102
  160. package/lib/module/classes/HMSEncoder.js.map +1 -1
  161. package/lib/module/classes/HMSException.js.map +1 -1
  162. package/lib/module/classes/HMSHLSConfig.js.map +1 -1
  163. package/lib/module/classes/HMSHLSMeetingURLVariant.js.map +1 -1
  164. package/lib/module/classes/HMSHLSRecordingConfig.js.map +1 -1
  165. package/lib/module/classes/HMSHLSRecordingState.js.map +1 -1
  166. package/lib/module/classes/HMSHLSStreamingState.js.map +1 -1
  167. package/lib/module/classes/HMSHLSVariant.js.map +1 -1
  168. package/lib/module/classes/HMSHelper.js.map +1 -1
  169. package/lib/module/classes/HMSLocalAudioStats.js.map +1 -1
  170. package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
  171. package/lib/module/classes/HMSLocalPeer.js +0 -1
  172. package/lib/module/classes/HMSLocalPeer.js.map +1 -1
  173. package/lib/module/classes/HMSLocalVideoStats.js.map +1 -1
  174. package/lib/module/classes/HMSLocalVideoTrack.js +0 -2
  175. package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
  176. package/lib/module/classes/HMSLogAlarmManager.js +3 -3
  177. package/lib/module/classes/HMSLogAlarmManager.js.map +1 -1
  178. package/lib/module/classes/HMSLogLevel.js +3 -3
  179. package/lib/module/classes/HMSLogLevel.js.map +1 -1
  180. package/lib/module/classes/HMSLogSettings.js.map +1 -1
  181. package/lib/module/classes/HMSLogger.js +17 -25
  182. package/lib/module/classes/HMSLogger.js.map +1 -1
  183. package/lib/module/classes/HMSMessage.js.map +1 -1
  184. package/lib/module/classes/HMSMessageRecipient.js +1 -1
  185. package/lib/module/classes/HMSMessageRecipient.js.map +1 -1
  186. package/lib/module/classes/HMSMessageRecipientType.js +3 -3
  187. package/lib/module/classes/HMSMessageRecipientType.js.map +1 -1
  188. package/lib/module/classes/HMSMessageType.js +3 -3
  189. package/lib/module/classes/HMSMessageType.js.map +1 -1
  190. package/lib/module/classes/HMSMicNode.js.map +1 -1
  191. package/lib/module/classes/HMSNativeEventEmitter.js +94 -0
  192. package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -0
  193. package/lib/module/classes/HMSNetworkQuality.js.map +1 -1
  194. package/lib/module/classes/HMSPIPListenerActions.js +3 -3
  195. package/lib/module/classes/HMSPIPListenerActions.js.map +1 -1
  196. package/lib/module/classes/HMSPeer.js +69 -18
  197. package/lib/module/classes/HMSPeer.js.map +1 -1
  198. package/lib/module/classes/HMSPeerUpdate.js +4 -3
  199. package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
  200. package/lib/module/classes/HMSPeersCache.js +216 -0
  201. package/lib/module/classes/HMSPeersCache.js.map +1 -0
  202. package/lib/module/classes/HMSPermissions.js.map +1 -1
  203. package/lib/module/classes/HMSPublishSettings.js +0 -6
  204. package/lib/module/classes/HMSPublishSettings.js.map +1 -1
  205. package/lib/module/classes/HMSRTCStats.js.map +1 -1
  206. package/lib/module/classes/HMSRTCStatsReport.js.map +1 -1
  207. package/lib/module/classes/HMSRTMPConfig.js.map +1 -1
  208. package/lib/module/classes/HMSRemoteAudioStats.js.map +1 -1
  209. package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
  210. package/lib/module/classes/HMSRemotePeer.js +0 -1
  211. package/lib/module/classes/HMSRemotePeer.js.map +1 -1
  212. package/lib/module/classes/HMSRemoteVideoStats.js.map +1 -1
  213. package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
  214. package/lib/module/classes/HMSRole.js +0 -6
  215. package/lib/module/classes/HMSRole.js.map +1 -1
  216. package/lib/module/classes/HMSRoleChangeRequest.js +3 -1
  217. package/lib/module/classes/HMSRoleChangeRequest.js.map +1 -1
  218. package/lib/module/classes/HMSRoom.js +79 -22
  219. package/lib/module/classes/HMSRoom.js.map +1 -1
  220. package/lib/module/classes/HMSRoomCache.js +115 -0
  221. package/lib/module/classes/HMSRoomCache.js.map +1 -0
  222. package/lib/module/classes/HMSRoomUpdate.js +3 -3
  223. package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
  224. package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
  225. package/lib/module/classes/HMSRtmpVideoResolution.js.map +1 -1
  226. package/lib/module/classes/HMSSDK.js +934 -159
  227. package/lib/module/classes/HMSSDK.js.map +1 -1
  228. package/lib/module/classes/HMSScreenBroadcastAudioReceiverNode.js.map +1 -1
  229. package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
  230. package/lib/module/classes/HMSSimulcastLayerSettings.js.map +1 -1
  231. package/lib/module/classes/HMSSimulcastSettings.js.map +1 -1
  232. package/lib/module/classes/HMSSpeaker.js.map +1 -1
  233. package/lib/module/classes/HMSSubscribeSettings.js +0 -2
  234. package/lib/module/classes/HMSSubscribeSettings.js.map +1 -1
  235. package/lib/module/classes/HMSTrack.js.map +1 -1
  236. package/lib/module/classes/HMSTrackSettings.js.map +1 -1
  237. package/lib/module/classes/HMSTrackSettingsInitState.js +3 -3
  238. package/lib/module/classes/HMSTrackSettingsInitState.js.map +1 -1
  239. package/lib/module/classes/HMSTrackSource.js +3 -3
  240. package/lib/module/classes/HMSTrackSource.js.map +1 -1
  241. package/lib/module/classes/HMSTrackType.js +3 -3
  242. package/lib/module/classes/HMSTrackType.js.map +1 -1
  243. package/lib/module/classes/HMSTrackUpdate.js +3 -3
  244. package/lib/module/classes/HMSTrackUpdate.js.map +1 -1
  245. package/lib/module/classes/HMSUpdateListenerActions.js +4 -4
  246. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  247. package/lib/module/classes/HMSVideoCodec.js +3 -3
  248. package/lib/module/classes/HMSVideoCodec.js.map +1 -1
  249. package/lib/module/classes/HMSVideoResolution.js.map +1 -1
  250. package/lib/module/classes/HMSVideoSettings.js.map +1 -1
  251. package/lib/module/classes/HMSVideoTrack.js.map +1 -1
  252. package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
  253. package/lib/module/classes/HMSVideoViewMode.js +3 -3
  254. package/lib/module/classes/HMSVideoViewMode.js.map +1 -1
  255. package/lib/module/classes/HmsView.js +2 -1
  256. package/lib/module/classes/HmsView.js.map +1 -1
  257. package/lib/module/index.js.map +1 -1
  258. package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +4 -4
  259. package/lib/typescript/classes/HMSChangeTrackStateRequest.d.ts +2 -2
  260. package/lib/typescript/classes/HMSConstants.d.ts +3 -0
  261. package/lib/typescript/classes/HMSEncoder.d.ts +10 -6
  262. package/lib/typescript/classes/HMSHLSStreamingState.d.ts +2 -2
  263. package/lib/typescript/classes/HMSLocalPeer.d.ts +0 -14
  264. package/lib/typescript/classes/HMSLocalVideoTrack.d.ts +0 -2
  265. package/lib/typescript/classes/HMSLogger.d.ts +1 -7
  266. package/lib/typescript/classes/HMSMessageRecipient.d.ts +2 -2
  267. package/lib/typescript/classes/HMSNativeEventEmitter.d.ts +13 -0
  268. package/lib/typescript/classes/HMSPeer.d.ts +12 -18
  269. package/lib/typescript/classes/HMSPeerUpdate.d.ts +1 -0
  270. package/lib/typescript/classes/HMSPeersCache.d.ts +17 -0
  271. package/lib/typescript/classes/HMSPublishSettings.d.ts +8 -15
  272. package/lib/typescript/classes/HMSRemotePeer.d.ts +0 -14
  273. package/lib/typescript/classes/HMSRole.d.ts +0 -6
  274. package/lib/typescript/classes/HMSRoleChangeRequest.d.ts +2 -2
  275. package/lib/typescript/classes/HMSRoom.d.ts +11 -22
  276. package/lib/typescript/classes/HMSRoomCache.d.ts +16 -0
  277. package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +4 -4
  278. package/lib/typescript/classes/HMSSDK.d.ts +3 -13
  279. package/lib/typescript/classes/HMSServerRecordingState.d.ts +2 -2
  280. package/lib/typescript/classes/HMSSubscribeSettings.d.ts +0 -2
  281. package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +1 -1
  282. package/lib/typescript/index.d.ts +1 -0
  283. package/package.json +5 -4
  284. package/react-native-hms.podspec +1 -1
  285. package/sdk-versions.json +3 -2
  286. package/src/classes/HMSAudioNode.ts +3 -1
  287. package/src/classes/HMSBrowserRecordingState.ts +4 -4
  288. package/src/classes/HMSChangeTrackStateRequest.ts +2 -2
  289. package/src/classes/HMSConstants.ts +3 -0
  290. package/src/classes/HMSEncoder.ts +162 -120
  291. package/src/classes/HMSHLSStreamingState.ts +2 -2
  292. package/src/classes/HMSLocalPeer.ts +0 -15
  293. package/src/classes/HMSLocalVideoTrack.ts +0 -2
  294. package/src/classes/HMSLogger.ts +20 -19
  295. package/src/classes/HMSMessageRecipient.ts +3 -3
  296. package/src/classes/HMSNativeEventEmitter.ts +109 -0
  297. package/src/classes/HMSPeer.ts +135 -32
  298. package/src/classes/HMSPeerUpdate.ts +9 -0
  299. package/src/classes/HMSPeersCache.ts +252 -0
  300. package/src/classes/HMSPublishSettings.ts +8 -18
  301. package/src/classes/HMSRemotePeer.ts +0 -16
  302. package/src/classes/HMSRole.ts +0 -9
  303. package/src/classes/HMSRoleChangeRequest.ts +5 -3
  304. package/src/classes/HMSRoom.ts +141 -37
  305. package/src/classes/HMSRoomCache.ts +157 -0
  306. package/src/classes/HMSRtmpStreamingState.ts +4 -4
  307. package/src/classes/HMSSDK.tsx +685 -292
  308. package/src/classes/HMSServerRecordingState.ts +2 -2
  309. package/src/classes/HMSSubscribeSettings.ts +1 -7
  310. package/src/classes/HMSUpdateListenerActions.ts +1 -1
  311. package/src/classes/HmsView.tsx +2 -1
  312. package/src/index.ts +1 -0
package/README.md CHANGED
@@ -3,8 +3,6 @@
3
3
  <img src="https://github.com/100mslive/100ms-react-native/blob/main/100ms.svg" title="100ms logo" float=center height=256>
4
4
  </a>
5
5
 
6
- # react-native-hms
7
-
8
6
  [![npm](https://img.shields.io/npm/v/@100mslive/react-native-hms)](https://www.npmjs.com/package/@100mslive/react-native-hms)
9
7
  [![license](https://img.shields.io/npm/l/@100mslive/react-native-hms)](https://www.100ms.live/)
10
8
  [![quality](https://img.shields.io/npms-io/quality-score/@100mslive/react-native-hms)](https://www.npmjs.com/package/@100mslive/react-native-hms)
@@ -17,9 +15,18 @@
17
15
  [![Activity](https://img.shields.io/github/commit-activity/m/100mslive/react-native-hms.svg)](https://github.com/100mslive/react-native-hms/projects/1)
18
16
  [![Register](https://img.shields.io/badge/Contact-Know%20More-blue)](https://dashboard.100ms.live/register)
19
17
 
20
- React native wrapper for 100ms SDK
18
+ # 100ms React Native SDK
19
+
20
+ 📖 Read the Complete Documentation here: https://www.100ms.live/docs/react-native/v2/foundation/basics
21
+
22
+ ## 🏃 Example App
23
+
24
+ 📲 Download the Example iOS app here: https://testflight.apple.com/join/v4bSIPad
25
+
26
+ 🤖 Download the Example Android app here: https://appdistribution.firebase.dev/i/7b7ab3b30e627c35
27
+
28
+ To get a better understanding of how the example app is structured, what to do on `onJoin`, `onTrack` and `onPeer` listeners, creating `PeerTrackNodes`, how to use Redux, and what type of layouts and sorting you can implement in your app, checkout [Example App's README](https://github.com/100mslive/react-native-hms/blob/develop/example/README.md)
21
29
 
22
- ## 🏃 Run Example App
23
30
 
24
31
  To run the Example app on your system, follow these steps -
25
32
 
@@ -27,33 +34,35 @@ To run the Example app on your system, follow these steps -
27
34
  2. Go to the example folder, `cd example`
28
35
  3. In the example folder, run `npm install`
29
36
  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, set the development team in Signing & Capabilities and exclude architectures in Build Settings as shown below. Then, in example folder, run `npx react-native run-ios`
37
+ 5. To run on iOS, first install the pods in iOS folder, `cd ios; pod install`. Then, set the Correct Development Team in Xcode Signing & Capabilities section. Then, in example folder, run `npx react-native run-ios`
31
38
 
32
- To get a better understanding of how the example app is stuctured, what to do on `onJoin`, `onTrack` and `onPeer` listeners, creating `PeerTrackNodes`, how to use Redux, and what type of layouts and sorting you can implement in your app, checkout [Example App's README](https://github.com/100mslive/react-native-hms/blob/develop/example/README.md)
39
+ Troubleshooting Guide for resolving issues in running the Example app is [available here](https://www.100ms.live/docs/react-native/v2/guides/faq#run-the-example-app).
33
40
 
34
- We have also implemented multiple views which are commonly used. Checkout the [videos & relevant code in the Example app](https://github.com/100mslive/react-native-hms/tree/main/example#additional-features).
35
41
 
36
42
  ## ☝️ Minimum Configuration
37
43
 
38
- - Support for Android API level 21 or higher
39
- - Support for Java 8
40
- - Support for iOS 10 or higher
41
- - Support for React Native 0.63.3 or higher
42
- - Xcode 12 or higher
44
+ - Support for React Native 0.64.4 or above
45
+ - Support for Java 8 or above
46
+ - Support for Android API level 24 or above
47
+ - Xcode 13 or above
48
+ - Support for iOS 12 or above
49
+
43
50
 
44
51
  ## 🤝 Recommended Configuration
45
52
 
46
- - Android API level 29 or higher
47
- - Java 11 or higher
48
- - iOS 15 or higher
49
- - React Native 0.64.2 or higher
50
- - Xcode 13 or higher
53
+ - React Native 0.68.0 or above
54
+ - Java 11 or above
55
+ - Android API level 32 or above
56
+ - Xcode 14 or above
57
+ - iOS 16 or above
51
58
 
52
59
  ## 📱 Supported Devices
53
60
 
54
61
  - The Android SDK supports Android API level 21 and higher. It is built for armeabi-v7a, arm64-v8a, x86, and x86_64 architectures.
62
+ Devices running Android OS 11 or above is recommended.
55
63
 
56
- - iPhone & iPads with iOS version 10 or higher.
64
+ - iPhone & iPads with iOS version 12 or above are supported.
65
+ Devices running iOS 16 or above is recommended.
57
66
 
58
67
  ## Installation
59
68
 
@@ -65,6 +74,8 @@ npm install @100mslive/react-native-hms --save
65
74
 
66
75
  🤖 Download the Sample Android App here: https://appdistribution.firebase.dev/i/7b7ab3b30e627c35
67
76
 
77
+ More information about Integrating the SDK is [available here](https://www.100ms.live/docs/react-native/v2/features/integration).
78
+
68
79
  ## 🔐 Permissions
69
80
 
70
81
  ### 📱 For iOS Permissions
@@ -90,419 +101,213 @@ Add following permissions in `AndroidManifest.xml`
90
101
  <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
91
102
  <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
92
103
  <uses-permission android:name="android.permission.RECORD_AUDIO"/>
93
- <uses-permission android:name="android.permission.BLUETOOTH"/>
94
104
  <uses-permission android:name="android.permission.INTERNET"/>
95
105
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
96
106
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
107
+ <uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
108
+ <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
97
109
  ```
98
110
 
99
111
  You will also need to request Camera and Record Audio permissions at runtime before you join a call or display a preview. Please follow [Android Documentation](https://developer.android.com/training/permissions/requesting#request-permission) for runtime permissions.
100
112
 
101
113
  We suggest using [react-native-permission](https://www.npmjs.com/package/react-native-permissions) to acquire permissions from both platforms.
102
114
 
115
+ More information about Audio Video Permission on iOS & Android is [available here](https://www.100ms.live/docs/react-native/v2/features/integration#permissions).
116
+
117
+
103
118
  ## [QuickStart](https://www.100ms.live/docs/react-native/v2/guides/quickstart)
104
119
 
120
+
105
121
  The package exports all the classes and a HMSSDK class that manages everything.
106
122
 
107
123
  ## Setting up the HMS Instance
108
124
 
109
- 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
125
+ First invoke the `build` method which returns an instance of `HMSSDK`. Save this instance to perform all actions related to 100ms.
110
126
 
111
- ```js
127
+ ```ts
112
128
  import { HMSSDK } from '@100mslive/react-native-hms';
113
- ...
114
129
 
130
+ // create HMSSDK instance using the build method & save it for further usage
115
131
  const hmsInstance = await HMSSDK.build();
116
- // save this instance, it will be used for all the operations that we'll perform
117
-
118
- ...
119
132
  ```
120
133
 
121
- ## [Add event listeners](https://www.100ms.live/docs/react-native/v2/features/event-listeners)
134
+ ## [Add Event Listeners](https://www.100ms.live/docs/react-native/v2/features/event-listeners)
135
+
136
+ Add Event Listeners to get notified about actions happening in the 100ms Room.
122
137
 
123
- add event listeners for all the events such as onPreview, onJoin, onPeerUpdate etc. the actions can be found in HMSUpdateListenerActions class
138
+ The most commonly used Events are `onJoin`, `onPeerUpdate` & `onTrackUpdate`. All the available actions can be found in the `HMSUpdateListenerActions` class.
124
139
 
125
- ```js
126
- import { HMSUpdateListenerActions } from '@100mslive/react-native-hms';
127
- ...
140
+ The Event Listeners are to be used for handling any update happening in 100ms Room.
141
+
142
+ ```ts
143
+ const hmsInstance = await HMSSDK.build();
128
144
 
129
145
  // instance acquired from build() method
130
146
  hmsInstance.addEventListener(
131
- HMSUpdateListenerActions.ON_PREVIEW,
132
- previewSuccess, // function that will be called on Preview success
147
+ HMSUpdateListenerActions.ON_JOIN,
148
+ joinSuccess, // function that will be called Joining a Room is successful
133
149
  );
134
-
135
- ...
136
150
  ```
137
151
 
138
- The event handlers are the way of handling any update happening in hms all events can be found in HMSUpdateListenerActions class
152
+ The detailed QuickStart Guide is [available here](https://www.100ms.live/docs/react-native/v2/guides/quickstart).
139
153
 
140
- ## [Error handling](https://www.100ms.live/docs/react-native/v2/features/error-handling)
141
154
 
142
- ```js
143
- import { HMSUpdateListenerActions } from '@100mslive/react-native-hms';
155
+ ## [Join the Room](https://www.100ms.live/docs/react-native/v2/features/join)
144
156
 
145
- // add an error event listener
146
- hmsInstance.addEventListener(HMSUpdateListenerActions.ON_ERROR, onError);
147
- ```
157
+ To interact with _peers_ in audio or video call, the user needs to **Join** a **Room**.
148
158
 
149
- ## [Join the room](https://www.100ms.live/docs/react-native/v2/features/join)
159
+ When user indicates that they want to join the room, your app should have -
150
160
 
151
- 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.
161
+ 1. User Name - The name which should be displayed to other peers in the room.
152
162
 
153
- NOTE: `ON_JOIN` listener should be added before calling `join` function to receive the event callback.
163
+ 2. Authentication Token - The Client side Authentication Token generated by the Token Service. Details about how to create Auth Tokens are [available here](https://www.100ms.live/docs/react-native/v2/guides/token).
154
164
 
155
- ```js
156
- import { HMSUpdateListenerActions, HMSConfig } from '@100mslive/react-native-hms';
157
- ...
165
+ Additionally, you can also pass these fields while Joining a Room -
158
166
 
159
- const HmsConfig = new HMSConfig({authToken, userID, roomID});
167
+ 1. Track Settings - Such as joining a Room with Muted Audio or Video using the `HMSTrackSettings` object. More information is [available here](https://www.100ms.live/docs/react-native/v2/features/join#join-with-muted-audio-video).
160
168
 
161
- // instance acquired from build() method
162
- hmsInstance.preview(HmsConfig); // to start preview
163
- // or
164
- hmsInstance.join(HmsConfig); // to join a room
169
+ 2. Peer Metadata - This can be used to pass any additional metadata associated with the user using `metadata` of `HMSConfig` object. For Eg: user-id mapping at the application side. More information is [available here](https://www.100ms.live/docs/react-native/v2/advanced-features/change-metadata).
165
170
 
166
- ...
167
- ```
168
171
 
169
- ## Calling various functions of HMS
172
+ NOTE: `ON_JOIN` Event Listener must be **attached** before calling `join` function to receive the event callback.
170
173
 
171
- ```js
172
- // Mute Audio
173
- hmsInstance?.localPeer?.localAudioTrack()?.setMute(true);
174
+ ```ts
175
+ // create HMSSDK instance using the build function
176
+ const hmsInstance = await HMSSDK.build();
174
177
 
175
- // Stop Video
176
- hmsInstance?.localPeer?.localVideoTrack()?.setMute(true);
177
178
 
178
- // Switch Camera
179
- hmsInstance?.localPeer?.localVideoTrack()?.switchCamera();
179
+ // You'll need to add Event Listeners for HMSUpdateListenerActions, which are invoked to notify about updates happening in the room like a peer joins/leaves, a track got muted/unmuted, any errors that occur, etc.
180
+ hmsInstance.addEventListener(HMSUpdateListenerActions.ON_JOIN, onJoinSuccess);
181
+ hmsInstance.addEventListener(HMSUpdateListenerActions.ON_PEER_UPDATE, onPeerUpdate);
182
+ hmsInstance.addEventListener(HMSUpdateListenerActions.ON_TRACK_UPDATE, onTrackUpdate);
183
+ hmsInstance.addEventListener(HMSUpdateListenerActions.ON_ERROR, onError);
180
184
 
181
- // Leave the call (async function)
182
- await hmsInstance?.leave();
185
+
186
+ // Next, create an object of HMSConfig class using the available joining configurations.
187
+ let config = new HMSConfig({
188
+ authToken: 'eyJH5c...', // client-side token generated from your token service
189
+ username: 'John Appleseed',
190
+ });
191
+
192
+ // Now, we are primed to join the room. All you have to do is calling join by passing the config object
193
+ hmsInstance.join(config);
183
194
  ```
184
195
 
185
- ## [Viewing the video of a peer](https://www.100ms.live/docs/react-native/v2/features/render-video)
196
+ More information about Joining a Room is [available here](https://www.100ms.live/docs/react-native/v2/features/join).
186
197
 
187
- To display a video on screen the 100ms package provides a UI component named `HmsView` that takes the video `trackId` and displays the video in that component.
188
198
 
189
- - `HmsView` component requires `width` and `height` in `style` prop to set bounds of the tile that will show the video stream.
199
+ ## Basic Mechanism of using 100ms APIs
190
200
 
191
- - One `HmsView` component can only be connected with one video `trackId`. To display multiple videos you have to create multiple instances of `HmsView` component.
201
+ For invoking any actions simply use the `HMSSDK` instance created in above steps. Few common examples of using it are as follows -
202
+
203
+ ```ts
204
+ // To Mute Audio of local peer - other peers will stop hearing audio
205
+ hmsInstance?.localPeer?.localAudioTrack()?.setMute(true);
206
+
207
+ // To Mute Video of local peer - other peers will stop seeing video
208
+ hmsInstance?.localPeer?.localVideoTrack()?.setMute(true);
192
209
 
193
- - Once the requirement of that `HmsView` is finshed it should be disposed.
210
+ // Switch Camera from Front to Back or vice-versa
211
+ hmsInstance?.localPeer?.localVideoTrack()?.switchCamera();
194
212
 
195
- - Every `HmsView` should be unique, which should be done by passing a `key` property and value as video `trackId`.
213
+ // Leave the ongoing Room (async function)
214
+ await hmsInstance?.leave();
196
215
 
197
- - Recommended practice is to show maximum of 3 to 4 `HmsView` on a single page/screen of the app. This avoids network data consumption & video decoding resources of the device.
216
+ // To send a Chat Message to all peers in Room
217
+ await hmsInstance?.sendBroadcastMessage('Hello Everyone! 👋');
218
+ ```
198
219
 
199
- ```js
200
- ...
201
- import { HMSRemotePeer } from '@100mslive/react-native-hms';
220
+ More information about using `HMSSDK` APIs is [available here](https://www.100ms.live/docs/react-native/v2/guides/quickstart).
202
221
 
203
- // getting local track ID
204
- const localTrackId: string = hmsInstance?.localPeer?.videoTrack?.trackId;
222
+ ## [Viewing the Video](https://www.100ms.live/docs/react-native/v2/features/render-video)
205
223
 
206
- // getting remote track IDs
207
- const remotePeers: HMSRemotePeer[] = hmsInstance?.remotePeers
208
- const remoteVideoIds: string[] = [];
224
+ It all comes down to this. All the setup so far has been done so that we can show Live Streaming Video in our beautiful apps.
209
225
 
210
- remotePeers.map((remotePeer: HMSRemotePeer) => {
211
- const remoteTrackId: string = remotePeer?.videoTrack?.trackId;
226
+ 100ms React Native SDK provides `HmsView` component that renders the video on the screen. You can access `HmsView` from the `HMSSDK` instance created in above steps.
212
227
 
213
- if (remoteTrackId) {
214
- remoteVideoIds.push(remoteTrackId);
215
- }
216
- });
228
+ We simply have to pass a Video Track's `trackId` to the `HmsView` to begin automatic rendering of Live Video Stream.
217
229
 
218
- ...
219
- ```
230
+ We can also optionally pass props like `key`, `scaleType`, `mirror` to customize the `HmsView` component.
220
231
 
221
- ## [Display a video in HmsView](https://www.100ms.live/docs/react-native/v2/features/render-video)
232
+ ```ts
233
+ // get HmsView from the HMSSDK instance created earlier
234
+ const HmsView = hmsInstance.HmsView;
222
235
 
223
- ```js
224
- import { HMSVideoViewMode } from '@100mslive/react-native-hms';
236
+ <HmsView
237
+ trackId={videoTrackId}
238
+ key={videoTrackId}
239
+ style={styles.hmsView}
240
+ />
225
241
 
226
- // instance acquired from build() method
227
- const HmsView = hmsInstance?.HmsView;
228
- ...
229
242
  const styles = StyleSheet.create({
230
243
  hmsView: {
231
244
  height: '100%',
232
245
  width: '100%',
233
246
  },
234
247
  });
235
-
236
- // trackId should be acquired from the method explained above
237
- // scaleType can be selected from HMSVideoViewMode as required
238
- // mirror can be passed as true to flip videos horizontally
239
- <HmsView style={styles.hmsView} trackId={trackId} mirror={true} scaleType={HMSVideoViewMode.ASPECT_FIT} />
240
-
241
- ...
242
- ```
243
-
244
- ## [Mute/Unmute others](https://www.100ms.live/docs/react-native/v2/features/change-track-state)
245
-
246
- ```js
247
- const mute: boolean = true;
248
-
249
- // hms instance acquired by build methodhmsInstance?.changeTrackState(audioTrack as HMSTrack, mute);
250
- hmsInstance?.changeTrackState(videoTrack as HMSTrack, mute);
251
-
252
- const unmute: boolean = false;
253
-
254
- await hmsInstance?.changeTrackState(audioTrack as HMSTrack, unmute);
255
- await hmsInstance?.changeTrackState(videoTrack as HMSTrack, unmute);
256
248
  ```
257
249
 
258
- ## [End Room for all](https://www.100ms.live/docs/react-native/v2/features/end-room)
259
-
260
- ```js
261
- const reason = 'Host ended the room';
262
- const lock = false; // optional parameter
263
-
264
- // hms instance acquired by build method
265
- await hmsInstance.endRoom(reason, lock);
266
- ```
267
-
268
- ## [Remove Peer](https://www.100ms.live/docs/react-native/v2/features/remove-peer)
269
-
270
- ```js
271
- import { HMSPeer } from '@100mslive/react-native-hms';
272
-
273
- const reason = 'removed from room';
274
-
275
- // hms instance acquired by build method
276
- const peer: HMSPeer = hmsInstance?.remotePeers[0];
277
-
278
- await hmsInstance.removePeer(peer, reason);
279
- ```
280
-
281
- ## [Sending messages](https://www.100ms.live/docs/react-native/v2/features/chat)
282
-
283
- ```js
284
- import { HMSRole, HMSPeer } from '@100mslive/react-native-hms';
285
-
286
- const message = 'hello'
287
- const roles: HMSRole[] = hmsInstance?.knownRoles
288
- // any remote peer
289
- const peer: HMSPeer = hmsInstance?.remotePeers[0]
290
-
291
- // send a different type of messages
292
- await hmsInstance?.sendBroadcastMessage(message);
293
- await hmsInstance?.sendGroupMessage(message, [role[0]);
294
- await hmsInstance?.sendDirectMessage(message, peer);
295
- ```
296
-
297
- ## [Role Change](https://www.100ms.live/docs/react-native/v2/features/change-role)
298
-
299
- Single Peer Role Change: Change the Role of a single peer to a specified one using the `changeRoleOfPeer` API
300
-
301
- ```js
302
- const force = false
303
-
304
- // instance acquired from build() method
305
- await hmsInstance.changeRoleOfPeer(peer, newRole, force) // request role change, not forced
306
- .then(d => console.log('Change Role Success: ', d))
307
- .catch(e => console.log('Change Role Error: ', e));
308
- ```
309
-
310
-
311
- Bulk Role Change: Change the role of all peers with a certain Role, to a specified one using the `changeRoleOfPeersWithRoles` API
312
-
313
- ```js
314
- // fetch all available Roles in the room
315
- const roles = await hmsInstance.getRoles();
316
-
317
- // get the Host Role object
318
- const hostRole = roles.find(role => role.name === 'host');
319
-
320
- // get list of Roles to be updated - in this case "Waiting" and "Guest" Roles
321
- const rolesToChange = roles.filter(role => role.name === 'waiting' || role.name === 'guest');
322
-
323
- // now perform Role Change of all peers in "Waiting" and "Guest" Roles to the "Host" Role
324
- await hmsInstance.changeRoleOfPeersWithRoles(rolesToChange, hostRole);
325
- ```
326
-
327
- ## [Raise Hand & BRB](https://www.100ms.live/docs/react-native/v2/advanced-features/change-metadata)
328
-
329
- ```js
330
- const parsedMetadata = JSON.parse(hmsInstance?.localPeer?.metadata);
250
+ - One `HmsView` component can only be connected with one video `trackId`. To display multiple videos you have to create multiple instances of `HmsView` component.
331
251
 
332
- // Raise Hand
333
- // hms instance acquired by build method
334
- await hmsInstance?.changeMetadata(
335
- JSON.stringify({
336
- ...parsedMetadata,
337
- isHandRaised: true,
338
- })
339
- );
252
+ - It's recommended to always pass the `key` property while creating `HmsView`. If a null or undefined `trackId` is passed in `HmsView` you will have to unmount and remount with the new `trackId`. Using the `key` prop and passing `trackId` to it automatically achieves this.
340
253
 
341
- // BRB
342
- // hms instance acquired by build method
343
- await hmsInstance?.changeMetadata(
344
- JSON.stringify({
345
- ...parsedMetadata,
346
- isBRBOn: true,
347
- })
348
- );
349
- ```
254
+ - `HmsView` component requires `width` and `height` in `style` prop to set bounds of the tile that will show the video stream.
350
255
 
351
- ## [HLS Streaming](https://www.100ms.live/docs/react-native/v2/features/hls-streaming)
352
-
353
- ```js
354
- import {
355
- HMSHLSMeetingURLVariant,
356
- HMSHLSConfig,
357
- } from '@100mslive/react-native-hms';
358
-
359
- const startHLSStreaming = () => {
360
- // Default Settings
361
- await hmsInstance.startHLSStreaming()
362
-
363
- // Custom Settings
364
- const hmsHLSMeetingURLVariant = new HMSHLSMeetingURLVariant({
365
- meetingUrl: 'https://yogi.app.100ms.live/preview/nih-bkn-vek?skip_preview=true',
366
- metadata: '',
367
- });
368
-
369
- const hmsHLSRecordingConfig = new HMSHLSRecordingConfig({
370
- singleFilePerLayer: false,
371
- videoOnDemand: false,
372
- });
373
-
374
- const hmsHLSConfig = new HMSHLSConfig({
375
- hlsRecordingConfig: hmsHLSRecordingConfig,
376
- meetingURLVariants: [hlsStreamingDetails],
377
- });
378
-
379
- await hmsInstance.startHLSStreaming(hmsHLSConfig)
380
- .then(d => console.log('Start Hls Success: ', d))
381
- .catch(e => console.log('Start Hls Error: ', e));
382
- };
383
- ```
256
+ - Once the requirement of that `HmsView` is finished it should **ALWAYS** be disposed.
384
257
 
385
- ## [Start Streaming / Recording](https://www.100ms.live/docs/react-native/v2/features/recording)
386
-
387
- ```js
388
- import { HMSRTMPConfig } from '@100mslive/react-native-hms';
389
-
390
- const recordingDetails = HMSRTMPConfig({
391
- record: true,
392
- meetingURL: roomID + '/viewer?token=beam_recording',
393
- rtmpURLs: [], // optional value
394
- resolution: { height: 720, width: 1280 }, // optional value
395
- // Resolution width
396
- // Range is [500, 1280].
397
- // Default value is 1280.
398
- // If resolution height > 720 then max resolution width = 720.
399
-
400
- // Resolution height
401
- // Reange is [480, 1280].
402
- // Default resolution width is 720.
403
- // If resolution width > 720 then max resolution height = 720.
404
- });
258
+ - Recommended practice is to show maximum of 3 to 4 `HmsView` on a single page/screen of the app. This avoids overloading network data consumption & video decoding resources of the device.
405
259
 
406
- // hms instance acquired by build method
407
- await hmsInstance?.startRTMPOrRecording(recordingDetails);
408
- ```
260
+ More information about Rendering Videos is [available here](https://www.100ms.live/docs/react-native/v2/features/render-video).
409
261
 
410
- ## [Get RTC Stats](https://www.100ms.live/docs/react-native/v2/features/rtc-stats)
411
262
 
412
- ```js
413
- // hms instance acquired by build method
414
- hmsInstance?.enableRTCStats();
415
- ```
263
+ ## [Using Track Updates to display Videos](https://www.100ms.live/docs/react-native/v2/features/render-video)
416
264
 
417
- ## [Screenshare](https://www.100ms.live/docs/react-native/v2/features/screenshare)
265
+ Always use ON_PEER_UPDATE and ON_TRACK_UPDATE listeners, these listeners get updated localPeer and remotePeers whenever there is any event related to these values.
266
+ The following code snippet shows a simple example of attaching Track Updates Event Listener & using it to show a Video.
418
267
 
419
- ```js
420
- // hms instance acquired by build method
421
- await hmsInstance?.startScreenshare();
422
- ```
268
+ ```ts
269
+ // In this example code snippet, We are keeping things very simple.
270
+ // You will get an overview of how to render `HMSView`s for list of `trackId`s and how to keep that list up to date.
271
+ // We don't need `ON_PEER_UPDATE` event listener for keeping track of only `trackId`s.
272
+ // So, we have registered only `ON_TRACK_UPDATE` event listener here
423
273
 
424
- ## [Getting Audio Levels for all speaking peers](https://www.100ms.live/docs/react-native/v2/advanced-features/show-audio-level)
274
+ const [trackIds, setTrackIds] = useState<string[]>([]);
425
275
 
426
- ```js
427
- import {
428
- HMSUpdateListenerActions,
429
- HMSSpeaker,
430
- } from '@100mslive/react-native-hms';
276
+ const onTrackListener = (data: { peer: HMSPeer; track: HMSTrack; type: HMSTrackUpdate }) => {
277
+ // We will only consider Video tracks for this example
278
+ if (data.track.type !== HMSTrackType.VIDEO) return;
431
279
 
432
- // hms instance acquired by build method
433
- hmsInstance?.addEventListener(HMSUpdateListenerActions.ON_SPEAKER, onSpeaker);
280
+ // If Video track is added, add trackId to our list
281
+ if (data.type === HMSTrackUpdate.TRACK_ADDED) setTrackIds(prevTrackIds => [...prevTrackIds, data.track.trackId]);
434
282
 
435
- const onSpeaker = (data: HMSSpeaker[]) => {
436
- data?.map((speaker: HMSSpeaker) =>
437
- console.log('speaker audio level: ', speaker?.level)
438
- );
283
+ // If Video track is removed, remove trackId from our list
284
+ if (data.type === HMSTrackUpdate.TRACK_REMOVED) setTrackIds(prevTrackIds => prevTrackIds.filter(prevTrackId => prevTrackId !== data.track.trackId));
439
285
  };
440
- ```
441
-
442
- ## [Local mute others](https://www.100ms.live/docs/react-native/v2/features/playback-allowed)
443
-
444
- ```js
445
- const remotePeer: HMSRemotePeer;
446
- const isAudioPlaybackAllowed = remotePeer.remoteAudioTrack().setPlaybackAllowed(false);
447
- const isVideoPlaybackAllowed = remotePeer.remoteVideoTrack().setPlaybackAllowed(true);
448
-
449
- // hms instance acquired by build method
450
- hmsInstance.setPlaybackForAllAudio(true) // mute
451
- hmsInstance.setPlaybackForAllAudio(false) // unmute
452
- ```
453
-
454
- ## [Locally Set Volume](https://www.100ms.live/docs/react-native/v2/advanced-features/set-volume)
455
-
456
- ```js
457
- const volume: Float = 1.0;
458
- const track: HMSTrack = remotePeer.audioTrack as HMSTrack;
459
286
 
460
- // hms instance acquired by build method
461
- hmsInstance?.setVolume(track, volume);
462
- ```
463
-
464
- ## [Change Name](https://www.100ms.live/docs/react-native/v2/features/change-name)
465
-
466
- ```js
467
- const newName: string = 'new name';
287
+ hmsInstance.addEventListener(
288
+ HMSUpdateListenerActions.ON_TRACK_UPDATE,
289
+ onTrackListener
290
+ );
468
291
 
469
- // hms instance acquired by build method
470
- await hmsInstance.changeName(newName);
292
+ // Render multiple HMSView for trackIds inside FlatList
293
+ // Note: HMSView will render blank if video track of peer is muted, Make sure video of peers is not muted.
294
+ <FlatList
295
+ data={trackIds} // trackIds is an array of trackIds of video tracks
296
+ keyExtractor={(trackId) => trackId}
297
+ renderItem={({ item }) => <HMSView key={item} trackId={item} style={{ width: '100%', height: 300 }} {...} />}
298
+ {...}
299
+ />
471
300
  ```
472
301
 
473
- ## [Join with specific Track Settings](https://www.100ms.live/docs/react-native/v2/features/join#joining-room-with-muted-audio-video)
474
-
475
- Following is an example to join a Room with Muted Audio & Video:
476
- ```js
477
- // First, create the Track Settings object
478
- const trackSettings = getTrackSettings();
302
+ More information about Rendering Videos is [available here](https://www.100ms.live/docs/react-native/v2/features/render-video).
479
303
 
480
- // Customize Audio & Video initial states as per user discretion
481
- const getTrackSettings = () => {
482
304
 
483
- let audioSettings = new HMSAudioTrackSettings({
484
- initialState: HMSTrackSettingsInitState.MUTED,
485
- });
486
305
 
487
- let videoSettings = new HMSVideoTrackSettings({
488
- initialState: HMSTrackSettingsInitState.MUTED,
489
- });
306
+ ### 🚂 [Example Implementations](https://github.com/100mslive/react-native-hms/tree/main/example)
490
307
 
491
- return new HMSTrackSettings({
492
- video: videoSettings,
493
- audio: audioSettings,
494
- });
495
- };
308
+ In the [100ms Example App](https://github.com/100mslive/react-native-hms/tree/main/example) we have shown how to set up the various listeners, what data to store in Redux and what all features you can implement.
496
309
 
497
- // Pass the Track Settings object to the build function
498
- const hmsInstance = await HMSSDK.build({
499
- trackSettings
500
- });
501
- ```
502
-
503
-
504
- ### [Example Implementations](https://github.com/100mslive/react-native-hms/tree/main/example)
310
+ We have also implemented multiple views which are commonly used. Checkout the [videos & relevant code in the Example app](https://github.com/100mslive/react-native-hms/tree/main/example#additional-features).
505
311
 
506
- In the [100ms Example App](https://github.com/100mslive/react-native-hms/tree/main/example) we have shown how to setup the various listeners, what data to store in Redux and what all features you can implement.
507
312
 
508
- We have also implemented multiple views which are commonly used. Checkout the [videos & relevant code in the Example app](https://github.com/100mslive/react-native-hms/tree/main/example#additional-features).
313
+ 📖 Read the Complete Documentation here: https://www.100ms.live/docs/react-native/v2/foundation/basics
@@ -34,7 +34,7 @@ android {
34
34
  compileSdkVersion safeExtGet('Hmssdk_compileSdkVersion', 30)
35
35
  defaultConfig {
36
36
  minSdkVersion safeExtGet('Hmssdk_minSdkVersion', 21)
37
- targetSdkVersion safeExtGet('Hmssdk_targetSdkVersion', 29)
37
+ targetSdkVersion safeExtGet('Hmssdk_targetSdkVersion', 30)
38
38
  versionCode 1
39
39
  versionName "1.0"
40
40
  }