@100mslive/react-native-hms 2.0.0-alpha.0 → 2.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (960) hide show
  1. package/README.md +21 -15
  2. package/android/build.gradle +95 -48
  3. package/android/src/main/java/com/reactnativehmssdk/HMSAudioshareActivity.kt +8 -10
  4. package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +177 -3
  5. package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayer.kt +149 -29
  6. package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayerManagerImpl.kt +185 -0
  7. package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +80 -20
  8. package/android/src/main/java/com/reactnativehmssdk/{HMSManager.kt → HMSManagerImpl.kt} +517 -145
  9. package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +503 -312
  10. package/android/src/main/java/com/reactnativehmssdk/HMSReactNativeEvent.kt +29 -0
  11. package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManagerImpl.kt +119 -0
  12. package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +64 -12
  13. package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +9 -9
  14. package/android/src/main/java/com/reactnativehmssdk/HmssdkPackage.kt +44 -8
  15. package/android/src/main/java/com/reactnativehmssdk/Interactivity/HMSInteractivityDecoder.kt +435 -0
  16. package/android/src/main/java/com/reactnativehmssdk/Interactivity/HMSInteractivityHelper.kt +353 -0
  17. package/android/src/main/java/com/reactnativehmssdk/Interactivity/HMSRNInteractivityCenter.kt +245 -0
  18. package/android/src/main/java/com/reactnativehmssdk/PipActionReceiver.kt +13 -3
  19. package/android/src/newarch/java/com/reactnativehmssdk/HMSHLSPlayerManager.kt +128 -0
  20. package/android/src/newarch/java/com/reactnativehmssdk/HMSManager.kt +332 -0
  21. package/android/src/newarch/java/com/reactnativehmssdk/HMSSDKViewManager.kt +102 -0
  22. package/android/src/oldarch/java/com/reactnativehmssdk/HMSHLSPlayerManager.kt +61 -0
  23. package/android/src/oldarch/java/com/reactnativehmssdk/HMSManager.kt +351 -0
  24. package/android/src/oldarch/java/com/reactnativehmssdk/HMSSDKViewManager.kt +87 -0
  25. package/ios/HMSConstants.swift +4 -0
  26. package/ios/HMSDecoder.swift +154 -18
  27. package/ios/HMSHLSPlayerComponentView.mm +325 -0
  28. package/ios/HMSHLSPlayerManager.m +16 -0
  29. package/ios/HMSHLSPlayerManager.swift +236 -70
  30. package/ios/HMSHelper.swift +126 -14
  31. package/ios/HMSInteractivityDecoder.swift +314 -0
  32. package/ios/HMSInteractivityHelper.swift +169 -0
  33. package/ios/HMSManager.m +203 -10
  34. package/ios/HMSManager.mm +365 -0
  35. package/ios/HMSManager.swift +431 -87
  36. package/ios/HMSRNInteractivityCenter.swift +161 -0
  37. package/ios/HMSRNSDK.swift +961 -134
  38. package/ios/HMSView.m +9 -0
  39. package/ios/HMSView.swift +45 -16
  40. package/ios/HMSViewComponentView.mm +229 -0
  41. package/ios/PIPMode/HMSPipModel.swift +18 -0
  42. package/ios/PIPMode/HMSPipView.swift +36 -0
  43. package/ios/PIPMode/HMSSampleBufferSwiftUIView.swift +45 -0
  44. package/lib/commonjs/classes/HMSAudioCodec.js +1 -2
  45. package/lib/commonjs/classes/HMSAudioCodec.js.map +1 -1
  46. package/lib/commonjs/classes/HMSAudioDevice.js +10 -2
  47. package/lib/commonjs/classes/HMSAudioDevice.js.map +1 -1
  48. package/lib/commonjs/classes/HMSAudioFilePlayerNode.js.map +1 -1
  49. package/lib/commonjs/classes/HMSAudioMixerSource.js +3 -3
  50. package/lib/commonjs/classes/HMSAudioMixerSource.js.map +1 -1
  51. package/lib/commonjs/classes/HMSAudioMixingMode.js +12 -2
  52. package/lib/commonjs/classes/HMSAudioMixingMode.js.map +1 -1
  53. package/lib/commonjs/classes/HMSAudioMode.js +1 -2
  54. package/lib/commonjs/classes/HMSAudioMode.js.map +1 -1
  55. package/lib/commonjs/classes/HMSAudioNode.js +3 -3
  56. package/lib/commonjs/classes/HMSAudioNode.js.map +1 -1
  57. package/lib/commonjs/classes/HMSAudioSettings.js +3 -3
  58. package/lib/commonjs/classes/HMSAudioSettings.js.map +1 -1
  59. package/lib/commonjs/classes/HMSAudioTrack.js +9 -0
  60. package/lib/commonjs/classes/HMSAudioTrack.js.map +1 -1
  61. package/lib/commonjs/classes/HMSAudioTrackSettings.js +12 -5
  62. package/lib/commonjs/classes/HMSAudioTrackSettings.js.map +1 -1
  63. package/lib/commonjs/classes/HMSBrowserRecordingState.js +5 -3
  64. package/lib/commonjs/classes/HMSBrowserRecordingState.js.map +1 -1
  65. package/lib/commonjs/classes/HMSCameraControl.js +3 -4
  66. package/lib/commonjs/classes/HMSCameraControl.js.map +1 -1
  67. package/lib/commonjs/classes/HMSCameraFacing.js +10 -2
  68. package/lib/commonjs/classes/HMSCameraFacing.js.map +1 -1
  69. package/lib/commonjs/classes/HMSChangeTrackStateRequest.js +3 -3
  70. package/lib/commonjs/classes/HMSChangeTrackStateRequest.js.map +1 -1
  71. package/lib/commonjs/classes/HMSConfig.js +30 -3
  72. package/lib/commonjs/classes/HMSConfig.js.map +1 -1
  73. package/lib/commonjs/classes/HMSConstants.js +1 -2
  74. package/lib/commonjs/classes/HMSConstants.js.map +1 -1
  75. package/lib/commonjs/classes/HMSEncoder.js +57 -14
  76. package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
  77. package/lib/commonjs/classes/HMSEventEmitter.js +1 -2
  78. package/lib/commonjs/classes/HMSEventEmitter.js.map +1 -1
  79. package/lib/commonjs/classes/HMSException.js +21 -3
  80. package/lib/commonjs/classes/HMSException.js.map +1 -1
  81. package/lib/commonjs/classes/HMSHLSConfig.js +3 -3
  82. package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -1
  83. package/lib/commonjs/classes/HMSHLSMeetingURLVariant.js +3 -3
  84. package/lib/commonjs/classes/HMSHLSMeetingURLVariant.js.map +1 -1
  85. package/lib/commonjs/classes/HMSHLSPlaylistType.js +12 -0
  86. package/lib/commonjs/classes/HMSHLSPlaylistType.js.map +1 -0
  87. package/lib/commonjs/classes/HMSHLSRecordingConfig.js +3 -3
  88. package/lib/commonjs/classes/HMSHLSRecordingConfig.js.map +1 -1
  89. package/lib/commonjs/classes/HMSHLSRecordingState.js +7 -7
  90. package/lib/commonjs/classes/HMSHLSRecordingState.js.map +1 -1
  91. package/lib/commonjs/classes/HMSHLSStreamingState.js +9 -3
  92. package/lib/commonjs/classes/HMSHLSStreamingState.js.map +1 -1
  93. package/lib/commonjs/classes/HMSHLSTimedMetadata.js +2 -0
  94. package/lib/commonjs/classes/HMSHLSTimedMetadata.js.map +1 -0
  95. package/lib/commonjs/classes/HMSHLSVariant.js +5 -3
  96. package/lib/commonjs/classes/HMSHLSVariant.js.map +1 -1
  97. package/lib/commonjs/classes/HMSHelper.js.map +1 -1
  98. package/lib/commonjs/classes/HMSIOSAudioMode.js +16 -2
  99. package/lib/commonjs/classes/HMSIOSAudioMode.js.map +1 -1
  100. package/lib/commonjs/classes/HMSInteractivityCenter.js +174 -0
  101. package/lib/commonjs/classes/HMSInteractivityCenter.js.map +1 -0
  102. package/lib/commonjs/classes/HMSInteractivityEncoder.js +83 -0
  103. package/lib/commonjs/classes/HMSInteractivityEncoder.js.map +1 -0
  104. package/lib/commonjs/classes/HMSLayer.js +1 -2
  105. package/lib/commonjs/classes/HMSLayer.js.map +1 -1
  106. package/lib/commonjs/classes/HMSLocalAudioStats.js +3 -3
  107. package/lib/commonjs/classes/HMSLocalAudioStats.js.map +1 -1
  108. package/lib/commonjs/classes/HMSLocalAudioTrack.js +3 -3
  109. package/lib/commonjs/classes/HMSLocalAudioTrack.js.map +1 -1
  110. package/lib/commonjs/classes/HMSLocalPeer.js +3 -3
  111. package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
  112. package/lib/commonjs/classes/HMSLocalVideoStats.js +3 -3
  113. package/lib/commonjs/classes/HMSLocalVideoStats.js.map +1 -1
  114. package/lib/commonjs/classes/HMSLocalVideoTrack.js +3 -3
  115. package/lib/commonjs/classes/HMSLocalVideoTrack.js.map +1 -1
  116. package/lib/commonjs/classes/HMSLogAlarmManager.js +13 -2
  117. package/lib/commonjs/classes/HMSLogAlarmManager.js.map +1 -1
  118. package/lib/commonjs/classes/HMSLogLevel.js +13 -2
  119. package/lib/commonjs/classes/HMSLogLevel.js.map +1 -1
  120. package/lib/commonjs/classes/HMSLogSettings.js +17 -3
  121. package/lib/commonjs/classes/HMSLogSettings.js.map +1 -1
  122. package/lib/commonjs/classes/HMSLogger.js +4 -5
  123. package/lib/commonjs/classes/HMSLogger.js.map +1 -1
  124. package/lib/commonjs/classes/HMSMessage.js +3 -3
  125. package/lib/commonjs/classes/HMSMessage.js.map +1 -1
  126. package/lib/commonjs/classes/HMSMessageRecipient.js +3 -3
  127. package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -1
  128. package/lib/commonjs/classes/HMSMessageRecipientType.js +1 -2
  129. package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -1
  130. package/lib/commonjs/classes/HMSMicNode.js.map +1 -1
  131. package/lib/commonjs/classes/HMSNativeEventEmitter.js +4 -6
  132. package/lib/commonjs/classes/HMSNativeEventEmitter.js.map +1 -1
  133. package/lib/commonjs/classes/HMSNativeEventListener.js +3 -4
  134. package/lib/commonjs/classes/HMSNativeEventListener.js.map +1 -1
  135. package/lib/commonjs/classes/HMSNetworkQuality.js +14 -3
  136. package/lib/commonjs/classes/HMSNetworkQuality.js.map +1 -1
  137. package/lib/commonjs/classes/HMSNoiseCancellationPlugin.js +158 -0
  138. package/lib/commonjs/classes/HMSNoiseCancellationPlugin.js.map +1 -0
  139. package/lib/commonjs/classes/HMSPIPConfig.js +6 -0
  140. package/lib/commonjs/classes/HMSPIPConfig.js.map +1 -0
  141. package/lib/commonjs/classes/HMSPIPListenerActions.js +10 -2
  142. package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -1
  143. package/lib/commonjs/classes/HMSPeer.js +186 -5
  144. package/lib/commonjs/classes/HMSPeer.js.map +1 -1
  145. package/lib/commonjs/classes/HMSPeerListIterator.js +25 -7
  146. package/lib/commonjs/classes/HMSPeerListIterator.js.map +1 -1
  147. package/lib/commonjs/classes/HMSPeerListIteratorOptions.js.map +1 -1
  148. package/lib/commonjs/classes/HMSPeerType.js +24 -0
  149. package/lib/commonjs/classes/HMSPeerType.js.map +1 -0
  150. package/lib/commonjs/classes/HMSPeerUpdate.js +2 -4
  151. package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
  152. package/lib/commonjs/classes/HMSPeersCache.js +6 -7
  153. package/lib/commonjs/classes/HMSPeersCache.js.map +1 -1
  154. package/lib/commonjs/classes/HMSPermissions.js +11 -3
  155. package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
  156. package/lib/commonjs/classes/HMSPollsListenerActions.js +11 -0
  157. package/lib/commonjs/classes/HMSPollsListenerActions.js.map +1 -0
  158. package/lib/commonjs/classes/HMSPublishSettings.js +3 -3
  159. package/lib/commonjs/classes/HMSPublishSettings.js.map +1 -1
  160. package/lib/commonjs/classes/HMSQualityLimitationReason.js +1 -2
  161. package/lib/commonjs/classes/HMSQualityLimitationReason.js.map +1 -1
  162. package/lib/commonjs/classes/HMSQualityLimitationReasons.js +3 -3
  163. package/lib/commonjs/classes/HMSQualityLimitationReasons.js.map +1 -1
  164. package/lib/commonjs/classes/HMSRTCStats.js +3 -3
  165. package/lib/commonjs/classes/HMSRTCStats.js.map +1 -1
  166. package/lib/commonjs/classes/HMSRTCStatsReport.js +3 -3
  167. package/lib/commonjs/classes/HMSRTCStatsReport.js.map +1 -1
  168. package/lib/commonjs/classes/HMSRTMPConfig.js +17 -3
  169. package/lib/commonjs/classes/HMSRTMPConfig.js.map +1 -1
  170. package/lib/commonjs/classes/HMSRecordingState.js +17 -0
  171. package/lib/commonjs/classes/HMSRecordingState.js.map +1 -0
  172. package/lib/commonjs/classes/HMSRemoteAudioStats.js +3 -3
  173. package/lib/commonjs/classes/HMSRemoteAudioStats.js.map +1 -1
  174. package/lib/commonjs/classes/HMSRemoteAudioTrack.js +3 -3
  175. package/lib/commonjs/classes/HMSRemoteAudioTrack.js.map +1 -1
  176. package/lib/commonjs/classes/HMSRemotePeer.js +3 -3
  177. package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
  178. package/lib/commonjs/classes/HMSRemoteVideoStats.js +3 -3
  179. package/lib/commonjs/classes/HMSRemoteVideoStats.js.map +1 -1
  180. package/lib/commonjs/classes/HMSRemoteVideoTrack.js +3 -3
  181. package/lib/commonjs/classes/HMSRemoteVideoTrack.js.map +1 -1
  182. package/lib/commonjs/classes/HMSRole.js +20 -3
  183. package/lib/commonjs/classes/HMSRole.js.map +1 -1
  184. package/lib/commonjs/classes/HMSRoleChangeRequest.js +3 -3
  185. package/lib/commonjs/classes/HMSRoleChangeRequest.js.map +1 -1
  186. package/lib/commonjs/classes/HMSRoom.js +17 -4
  187. package/lib/commonjs/classes/HMSRoom.js.map +1 -1
  188. package/lib/commonjs/classes/HMSRoomCache.js +13 -7
  189. package/lib/commonjs/classes/HMSRoomCache.js.map +1 -1
  190. package/lib/commonjs/classes/HMSRoomUpdate.js +2 -2
  191. package/lib/commonjs/classes/HMSRoomUpdate.js.map +1 -1
  192. package/lib/commonjs/classes/HMSRtmpStreamingState.js +5 -5
  193. package/lib/commonjs/classes/HMSRtmpStreamingState.js.map +1 -1
  194. package/lib/commonjs/classes/HMSRtmpVideoResolution.js +16 -3
  195. package/lib/commonjs/classes/HMSRtmpVideoResolution.js.map +1 -1
  196. package/lib/commonjs/classes/HMSSDK.js +1313 -327
  197. package/lib/commonjs/classes/HMSSDK.js.map +1 -1
  198. package/lib/commonjs/classes/HMSScreenBroadcastAudioReceiverNode.js.map +1 -1
  199. package/lib/commonjs/classes/HMSServerRecordingState.js +5 -3
  200. package/lib/commonjs/classes/HMSServerRecordingState.js.map +1 -1
  201. package/lib/commonjs/classes/HMSSessionStore.js +20 -23
  202. package/lib/commonjs/classes/HMSSessionStore.js.map +1 -1
  203. package/lib/commonjs/classes/HMSSimulcastLayerDefinition.js +3 -3
  204. package/lib/commonjs/classes/HMSSimulcastLayerDefinition.js.map +1 -1
  205. package/lib/commonjs/classes/HMSSimulcastLayerSettings.js +3 -3
  206. package/lib/commonjs/classes/HMSSimulcastLayerSettings.js.map +1 -1
  207. package/lib/commonjs/classes/HMSSimulcastLayerSettingsPolicy.js +3 -3
  208. package/lib/commonjs/classes/HMSSimulcastLayerSettingsPolicy.js.map +1 -1
  209. package/lib/commonjs/classes/HMSSimulcastSettings.js +3 -3
  210. package/lib/commonjs/classes/HMSSimulcastSettings.js.map +1 -1
  211. package/lib/commonjs/classes/HMSSimulcastSettingsPolicy.js +3 -3
  212. package/lib/commonjs/classes/HMSSimulcastSettingsPolicy.js.map +1 -1
  213. package/lib/commonjs/classes/HMSSpeaker.js +3 -3
  214. package/lib/commonjs/classes/HMSSpeaker.js.map +1 -1
  215. package/lib/commonjs/classes/HMSStreamingState.js +15 -0
  216. package/lib/commonjs/classes/HMSStreamingState.js.map +1 -0
  217. package/lib/commonjs/classes/HMSSubscribeDegradationPolicy.js +3 -3
  218. package/lib/commonjs/classes/HMSSubscribeDegradationPolicy.js.map +1 -1
  219. package/lib/commonjs/classes/HMSSubscribeSettings.js +3 -3
  220. package/lib/commonjs/classes/HMSSubscribeSettings.js.map +1 -1
  221. package/lib/commonjs/classes/HMSTrack.js +16 -3
  222. package/lib/commonjs/classes/HMSTrack.js.map +1 -1
  223. package/lib/commonjs/classes/HMSTrackSettings.js +13 -3
  224. package/lib/commonjs/classes/HMSTrackSettings.js.map +1 -1
  225. package/lib/commonjs/classes/HMSTrackSettingsInitState.js +10 -2
  226. package/lib/commonjs/classes/HMSTrackSettingsInitState.js.map +1 -1
  227. package/lib/commonjs/classes/HMSTrackSource.js +11 -2
  228. package/lib/commonjs/classes/HMSTrackSource.js.map +1 -1
  229. package/lib/commonjs/classes/HMSTrackType.js +8 -2
  230. package/lib/commonjs/classes/HMSTrackType.js.map +1 -1
  231. package/lib/commonjs/classes/HMSTrackUpdate.js +1 -2
  232. package/lib/commonjs/classes/HMSTrackUpdate.js.map +1 -1
  233. package/lib/commonjs/classes/HMSUpdateListenerActions.js +44 -5
  234. package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
  235. package/lib/commonjs/classes/HMSVideoCodec.js +1 -2
  236. package/lib/commonjs/classes/HMSVideoCodec.js.map +1 -1
  237. package/lib/commonjs/classes/HMSVideoResolution.js +3 -3
  238. package/lib/commonjs/classes/HMSVideoResolution.js.map +1 -1
  239. package/lib/commonjs/classes/HMSVideoSettings.js +3 -3
  240. package/lib/commonjs/classes/HMSVideoSettings.js.map +1 -1
  241. package/lib/commonjs/classes/HMSVideoTrack.js +20 -3
  242. package/lib/commonjs/classes/HMSVideoTrack.js.map +1 -1
  243. package/lib/commonjs/classes/HMSVideoTrackSettings.js +18 -7
  244. package/lib/commonjs/classes/HMSVideoTrackSettings.js.map +1 -1
  245. package/lib/commonjs/classes/HMSVideoViewMode.js +1 -2
  246. package/lib/commonjs/classes/HMSVideoViewMode.js.map +1 -1
  247. package/lib/commonjs/classes/HmsView.js +77 -28
  248. package/lib/commonjs/classes/HmsView.js.map +1 -1
  249. package/lib/commonjs/classes/polls/DecodedPollLeaderboardResponse.js +6 -0
  250. package/lib/commonjs/classes/polls/DecodedPollLeaderboardResponse.js.map +1 -0
  251. package/lib/commonjs/classes/polls/HMSPoll.js +6 -0
  252. package/lib/commonjs/classes/polls/HMSPoll.js.map +1 -0
  253. package/lib/commonjs/classes/polls/HMSPollCategory.js +12 -0
  254. package/lib/commonjs/classes/polls/HMSPollCategory.js.map +1 -0
  255. package/lib/commonjs/classes/polls/HMSPollCreateParams.js +6 -0
  256. package/lib/commonjs/classes/polls/HMSPollCreateParams.js.map +1 -0
  257. package/lib/commonjs/classes/polls/HMSPollLeaderboardEntry.js +6 -0
  258. package/lib/commonjs/classes/polls/HMSPollLeaderboardEntry.js.map +1 -0
  259. package/lib/commonjs/classes/polls/HMSPollLeaderboardSummary.js +2 -0
  260. package/lib/commonjs/classes/polls/HMSPollLeaderboardSummary.js.map +1 -0
  261. package/lib/commonjs/classes/polls/HMSPollQuestion.js +6 -0
  262. package/lib/commonjs/classes/polls/HMSPollQuestion.js.map +1 -0
  263. package/lib/commonjs/classes/polls/HMSPollQuestionAnswer.js +2 -0
  264. package/lib/commonjs/classes/polls/HMSPollQuestionAnswer.js.map +1 -0
  265. package/lib/commonjs/classes/polls/HMSPollQuestionCreateParams.js +6 -0
  266. package/lib/commonjs/classes/polls/HMSPollQuestionCreateParams.js.map +1 -0
  267. package/lib/commonjs/classes/polls/HMSPollQuestionOption.js +2 -0
  268. package/lib/commonjs/classes/polls/HMSPollQuestionOption.js.map +1 -0
  269. package/lib/commonjs/classes/polls/HMSPollQuestionOptionCreateParams.js +6 -0
  270. package/lib/commonjs/classes/polls/HMSPollQuestionOptionCreateParams.js.map +1 -0
  271. package/lib/commonjs/classes/polls/HMSPollQuestionQuizOptionCreateParams.js +6 -0
  272. package/lib/commonjs/classes/polls/HMSPollQuestionQuizOptionCreateParams.js.map +1 -0
  273. package/lib/commonjs/classes/polls/HMSPollQuestionResponse.js +6 -0
  274. package/lib/commonjs/classes/polls/HMSPollQuestionResponse.js.map +1 -0
  275. package/lib/commonjs/classes/polls/HMSPollQuestionResponseCreateParams.js +6 -0
  276. package/lib/commonjs/classes/polls/HMSPollQuestionResponseCreateParams.js.map +1 -0
  277. package/lib/commonjs/classes/polls/HMSPollQuestionResponseResult.js +2 -0
  278. package/lib/commonjs/classes/polls/HMSPollQuestionResponseResult.js.map +1 -0
  279. package/lib/commonjs/classes/polls/HMSPollQuestionResult.js +2 -0
  280. package/lib/commonjs/classes/polls/HMSPollQuestionResult.js.map +1 -0
  281. package/lib/commonjs/classes/polls/HMSPollQuestionType.js +14 -0
  282. package/lib/commonjs/classes/polls/HMSPollQuestionType.js.map +1 -0
  283. package/lib/commonjs/classes/polls/HMSPollResponsePeerInfo.js +2 -0
  284. package/lib/commonjs/classes/polls/HMSPollResponsePeerInfo.js.map +1 -0
  285. package/lib/commonjs/classes/polls/HMSPollResult.js +6 -0
  286. package/lib/commonjs/classes/polls/HMSPollResult.js.map +1 -0
  287. package/lib/commonjs/classes/polls/HMSPollState.js +13 -0
  288. package/lib/commonjs/classes/polls/HMSPollState.js.map +1 -0
  289. package/lib/commonjs/classes/polls/HMSPollType.js +12 -0
  290. package/lib/commonjs/classes/polls/HMSPollType.js.map +1 -0
  291. package/lib/commonjs/classes/polls/HMSPollUpdateType.js +13 -0
  292. package/lib/commonjs/classes/polls/HMSPollUpdateType.js.map +1 -0
  293. package/lib/commonjs/classes/polls/HMSPollUserTrackingMode.js +13 -0
  294. package/lib/commonjs/classes/polls/HMSPollUserTrackingMode.js.map +1 -0
  295. package/lib/commonjs/classes/polls/PollLeaderboardResponse.js +6 -0
  296. package/lib/commonjs/classes/polls/PollLeaderboardResponse.js.map +1 -0
  297. package/lib/commonjs/classes/transcriptions/HMSTranscript.js +6 -0
  298. package/lib/commonjs/classes/transcriptions/HMSTranscript.js.map +1 -0
  299. package/lib/commonjs/classes/transcriptions/OnTranscriptionError.js +2 -0
  300. package/lib/commonjs/classes/transcriptions/OnTranscriptionError.js.map +1 -0
  301. package/lib/commonjs/classes/transcriptions/TranscriptionState.js +14 -0
  302. package/lib/commonjs/classes/transcriptions/TranscriptionState.js.map +1 -0
  303. package/lib/commonjs/classes/transcriptions/Transcriptions.js +6 -0
  304. package/lib/commonjs/classes/transcriptions/Transcriptions.js.map +1 -0
  305. package/lib/commonjs/classes/transcriptions/TranscriptionsMode.js +12 -0
  306. package/lib/commonjs/classes/transcriptions/TranscriptionsMode.js.map +1 -0
  307. package/lib/commonjs/classes/transcriptions/index.js +61 -0
  308. package/lib/commonjs/classes/transcriptions/index.js.map +1 -0
  309. package/lib/commonjs/classes/whiteboard/HMSWhiteboard.js +6 -0
  310. package/lib/commonjs/classes/whiteboard/HMSWhiteboard.js.map +1 -0
  311. package/lib/commonjs/classes/whiteboard/HMSWhiteboardListenerActions.js +11 -0
  312. package/lib/commonjs/classes/whiteboard/HMSWhiteboardListenerActions.js.map +1 -0
  313. package/lib/commonjs/classes/whiteboard/HMSWhiteboardState.js +12 -0
  314. package/lib/commonjs/classes/whiteboard/HMSWhiteboardState.js.map +1 -0
  315. package/lib/commonjs/classes/whiteboard/HMSWhiteboardUpdateType.js +12 -0
  316. package/lib/commonjs/classes/whiteboard/HMSWhiteboardUpdateType.js.map +1 -0
  317. package/lib/commonjs/classes/whiteboard/index.js +39 -0
  318. package/lib/commonjs/classes/whiteboard/index.js.map +1 -0
  319. package/lib/commonjs/classes/whiteboard/registerCallbacks.js +26 -0
  320. package/lib/commonjs/classes/whiteboard/registerCallbacks.js.map +1 -0
  321. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +155 -49
  322. package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  323. package/lib/commonjs/components/HMSHLSPlayer/RCTHMSHLSPlayer.js +5 -6
  324. package/lib/commonjs/components/HMSHLSPlayer/RCTHMSHLSPlayer.js.map +1 -1
  325. package/lib/commonjs/components/HMSHLSPlayer/hooks.js +26 -16
  326. package/lib/commonjs/components/HMSHLSPlayer/hooks.js.map +1 -1
  327. package/lib/commonjs/components/HMSHLSPlayer/index.js +22 -1
  328. package/lib/commonjs/components/HMSHLSPlayer/index.js.map +1 -1
  329. package/lib/commonjs/hooks/hmsviews.js +17 -0
  330. package/lib/commonjs/hooks/hmsviews.js.map +1 -0
  331. package/lib/commonjs/hooks/polls.js +17 -0
  332. package/lib/commonjs/hooks/polls.js.map +1 -0
  333. package/lib/commonjs/hooks/useHMSPeerUpdates.js +3 -5
  334. package/lib/commonjs/hooks/useHMSPeerUpdates.js.map +1 -1
  335. package/lib/commonjs/index.js +233 -6
  336. package/lib/commonjs/index.js.map +1 -1
  337. package/lib/commonjs/modules/HMSManagerModule.js +10 -0
  338. package/lib/commonjs/modules/HMSManagerModule.js.map +1 -0
  339. package/lib/commonjs/specs/HMSHLSPlayerNativeComponent.js +75 -0
  340. package/lib/commonjs/specs/HMSHLSPlayerNativeComponent.js.map +1 -0
  341. package/lib/commonjs/specs/HMSViewNativeComponent.js +55 -0
  342. package/lib/commonjs/specs/HMSViewNativeComponent.js.map +1 -0
  343. package/lib/commonjs/specs/NativeHMSManager.js +38 -0
  344. package/lib/commonjs/specs/NativeHMSManager.js.map +1 -0
  345. package/lib/commonjs/stores/hls-player-playback-slice.js +10 -0
  346. package/lib/commonjs/stores/hls-player-playback-slice.js.map +1 -1
  347. package/lib/commonjs/stores/hls-player-stats-store.js +28 -17
  348. package/lib/commonjs/stores/hls-player-stats-store.js.map +1 -1
  349. package/lib/commonjs/stores/hms-interactivity-store.js +21 -0
  350. package/lib/commonjs/stores/hms-interactivity-store.js.map +1 -0
  351. package/lib/commonjs/stores/hms-polls-slice.js +19 -0
  352. package/lib/commonjs/stores/hms-polls-slice.js.map +1 -0
  353. package/lib/commonjs/stores/hms-store.js +5 -6
  354. package/lib/commonjs/stores/hms-store.js.map +1 -1
  355. package/lib/commonjs/stores/hmsviews-slice.js +19 -0
  356. package/lib/commonjs/stores/hmsviews-slice.js.map +1 -0
  357. package/lib/commonjs/stores/types.js.map +1 -1
  358. package/lib/commonjs/types.js +4 -7
  359. package/lib/commonjs/types.js.map +1 -1
  360. package/lib/commonjs/utils/emitter/EventEmitter.js +23 -7
  361. package/lib/commonjs/utils/emitter/EventEmitter.js.map +1 -1
  362. package/lib/commonjs/utils/emitter/_EmitterSubscription.js +3 -3
  363. package/lib/commonjs/utils/emitter/_EmitterSubscription.js.map +1 -1
  364. package/lib/commonjs/utils/emitter/_EventSubscription.js +3 -3
  365. package/lib/commonjs/utils/emitter/_EventSubscription.js.map +1 -1
  366. package/lib/commonjs/utils/emitter/_EventSubscriptionVendor.js +3 -4
  367. package/lib/commonjs/utils/emitter/_EventSubscriptionVendor.js.map +1 -1
  368. package/lib/commonjs/utils/index.js.map +1 -1
  369. package/lib/commonjs/utils/keyboard.js +46 -0
  370. package/lib/commonjs/utils/keyboard.js.map +1 -0
  371. package/lib/commonjs/utils/notification.js +13 -0
  372. package/lib/commonjs/utils/notification.js.map +1 -0
  373. package/lib/commonjs/utils/windowController.js +30 -0
  374. package/lib/commonjs/utils/windowController.js.map +1 -0
  375. package/lib/module/classes/HMSAudioCodec.js.map +1 -1
  376. package/lib/module/classes/HMSAudioDevice.js +9 -0
  377. package/lib/module/classes/HMSAudioDevice.js.map +1 -1
  378. package/lib/module/classes/HMSAudioFilePlayerNode.js.map +1 -1
  379. package/lib/module/classes/HMSAudioMixerSource.js +3 -3
  380. package/lib/module/classes/HMSAudioMixerSource.js.map +1 -1
  381. package/lib/module/classes/HMSAudioMixingMode.js +11 -0
  382. package/lib/module/classes/HMSAudioMixingMode.js.map +1 -1
  383. package/lib/module/classes/HMSAudioMode.js.map +1 -1
  384. package/lib/module/classes/HMSAudioNode.js +3 -3
  385. package/lib/module/classes/HMSAudioNode.js.map +1 -1
  386. package/lib/module/classes/HMSAudioSettings.js +3 -3
  387. package/lib/module/classes/HMSAudioSettings.js.map +1 -1
  388. package/lib/module/classes/HMSAudioTrack.js +9 -0
  389. package/lib/module/classes/HMSAudioTrack.js.map +1 -1
  390. package/lib/module/classes/HMSAudioTrackSettings.js +12 -5
  391. package/lib/module/classes/HMSAudioTrackSettings.js.map +1 -1
  392. package/lib/module/classes/HMSBrowserRecordingState.js +5 -3
  393. package/lib/module/classes/HMSBrowserRecordingState.js.map +1 -1
  394. package/lib/module/classes/HMSCameraControl.js +2 -3
  395. package/lib/module/classes/HMSCameraControl.js.map +1 -1
  396. package/lib/module/classes/HMSCameraFacing.js +9 -0
  397. package/lib/module/classes/HMSCameraFacing.js.map +1 -1
  398. package/lib/module/classes/HMSChangeTrackStateRequest.js +3 -3
  399. package/lib/module/classes/HMSChangeTrackStateRequest.js.map +1 -1
  400. package/lib/module/classes/HMSConfig.js +30 -3
  401. package/lib/module/classes/HMSConfig.js.map +1 -1
  402. package/lib/module/classes/HMSConstants.js.map +1 -1
  403. package/lib/module/classes/HMSEncoder.js +56 -13
  404. package/lib/module/classes/HMSEncoder.js.map +1 -1
  405. package/lib/module/classes/HMSEventEmitter.js.map +1 -1
  406. package/lib/module/classes/HMSException.js +21 -3
  407. package/lib/module/classes/HMSException.js.map +1 -1
  408. package/lib/module/classes/HMSHLSConfig.js +3 -3
  409. package/lib/module/classes/HMSHLSConfig.js.map +1 -1
  410. package/lib/module/classes/HMSHLSMeetingURLVariant.js +3 -3
  411. package/lib/module/classes/HMSHLSMeetingURLVariant.js.map +1 -1
  412. package/lib/module/classes/HMSHLSPlaylistType.js +6 -0
  413. package/lib/module/classes/HMSHLSPlaylistType.js.map +1 -0
  414. package/lib/module/classes/HMSHLSRecordingConfig.js +3 -3
  415. package/lib/module/classes/HMSHLSRecordingConfig.js.map +1 -1
  416. package/lib/module/classes/HMSHLSRecordingState.js +7 -7
  417. package/lib/module/classes/HMSHLSRecordingState.js.map +1 -1
  418. package/lib/module/classes/HMSHLSStreamingState.js +9 -3
  419. package/lib/module/classes/HMSHLSStreamingState.js.map +1 -1
  420. package/lib/module/classes/HMSHLSTimedMetadata.js +2 -0
  421. package/lib/module/classes/HMSHLSTimedMetadata.js.map +1 -0
  422. package/lib/module/classes/HMSHLSVariant.js +5 -3
  423. package/lib/module/classes/HMSHLSVariant.js.map +1 -1
  424. package/lib/module/classes/HMSHelper.js.map +1 -1
  425. package/lib/module/classes/HMSIOSAudioMode.js +15 -0
  426. package/lib/module/classes/HMSIOSAudioMode.js.map +1 -1
  427. package/lib/module/classes/HMSInteractivityCenter.js +166 -0
  428. package/lib/module/classes/HMSInteractivityCenter.js.map +1 -0
  429. package/lib/module/classes/HMSInteractivityEncoder.js +76 -0
  430. package/lib/module/classes/HMSInteractivityEncoder.js.map +1 -0
  431. package/lib/module/classes/HMSLayer.js.map +1 -1
  432. package/lib/module/classes/HMSLocalAudioStats.js +3 -3
  433. package/lib/module/classes/HMSLocalAudioStats.js.map +1 -1
  434. package/lib/module/classes/HMSLocalAudioTrack.js +3 -3
  435. package/lib/module/classes/HMSLocalAudioTrack.js.map +1 -1
  436. package/lib/module/classes/HMSLocalPeer.js +3 -3
  437. package/lib/module/classes/HMSLocalPeer.js.map +1 -1
  438. package/lib/module/classes/HMSLocalVideoStats.js +3 -3
  439. package/lib/module/classes/HMSLocalVideoStats.js.map +1 -1
  440. package/lib/module/classes/HMSLocalVideoTrack.js +3 -3
  441. package/lib/module/classes/HMSLocalVideoTrack.js.map +1 -1
  442. package/lib/module/classes/HMSLogAlarmManager.js +12 -0
  443. package/lib/module/classes/HMSLogAlarmManager.js.map +1 -1
  444. package/lib/module/classes/HMSLogLevel.js +12 -0
  445. package/lib/module/classes/HMSLogLevel.js.map +1 -1
  446. package/lib/module/classes/HMSLogSettings.js +17 -3
  447. package/lib/module/classes/HMSLogSettings.js.map +1 -1
  448. package/lib/module/classes/HMSLogger.js +3 -3
  449. package/lib/module/classes/HMSLogger.js.map +1 -1
  450. package/lib/module/classes/HMSMessage.js +3 -3
  451. package/lib/module/classes/HMSMessage.js.map +1 -1
  452. package/lib/module/classes/HMSMessageRecipient.js +3 -3
  453. package/lib/module/classes/HMSMessageRecipient.js.map +1 -1
  454. package/lib/module/classes/HMSMessageRecipientType.js.map +1 -1
  455. package/lib/module/classes/HMSMicNode.js.map +1 -1
  456. package/lib/module/classes/HMSNativeEventEmitter.js +4 -6
  457. package/lib/module/classes/HMSNativeEventEmitter.js.map +1 -1
  458. package/lib/module/classes/HMSNativeEventListener.js +1 -1
  459. package/lib/module/classes/HMSNativeEventListener.js.map +1 -1
  460. package/lib/module/classes/HMSNetworkQuality.js +14 -3
  461. package/lib/module/classes/HMSNetworkQuality.js.map +1 -1
  462. package/lib/module/classes/HMSNoiseCancellationPlugin.js +152 -0
  463. package/lib/module/classes/HMSNoiseCancellationPlugin.js.map +1 -0
  464. package/lib/module/classes/HMSPIPConfig.js +2 -0
  465. package/lib/module/classes/HMSPIPConfig.js.map +1 -0
  466. package/lib/module/classes/HMSPIPListenerActions.js +9 -0
  467. package/lib/module/classes/HMSPIPListenerActions.js.map +1 -1
  468. package/lib/module/classes/HMSPeer.js +187 -5
  469. package/lib/module/classes/HMSPeer.js.map +1 -1
  470. package/lib/module/classes/HMSPeerListIterator.js +24 -6
  471. package/lib/module/classes/HMSPeerListIterator.js.map +1 -1
  472. package/lib/module/classes/HMSPeerListIteratorOptions.js.map +1 -1
  473. package/lib/module/classes/HMSPeerType.js +18 -0
  474. package/lib/module/classes/HMSPeerType.js.map +1 -0
  475. package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
  476. package/lib/module/classes/HMSPeersCache.js +4 -4
  477. package/lib/module/classes/HMSPeersCache.js.map +1 -1
  478. package/lib/module/classes/HMSPermissions.js +11 -3
  479. package/lib/module/classes/HMSPermissions.js.map +1 -1
  480. package/lib/module/classes/HMSPollsListenerActions.js +5 -0
  481. package/lib/module/classes/HMSPollsListenerActions.js.map +1 -0
  482. package/lib/module/classes/HMSPublishSettings.js +3 -3
  483. package/lib/module/classes/HMSPublishSettings.js.map +1 -1
  484. package/lib/module/classes/HMSQualityLimitationReason.js.map +1 -1
  485. package/lib/module/classes/HMSQualityLimitationReasons.js +3 -3
  486. package/lib/module/classes/HMSQualityLimitationReasons.js.map +1 -1
  487. package/lib/module/classes/HMSRTCStats.js +3 -3
  488. package/lib/module/classes/HMSRTCStats.js.map +1 -1
  489. package/lib/module/classes/HMSRTCStatsReport.js +3 -3
  490. package/lib/module/classes/HMSRTCStatsReport.js.map +1 -1
  491. package/lib/module/classes/HMSRTMPConfig.js +17 -3
  492. package/lib/module/classes/HMSRTMPConfig.js.map +1 -1
  493. package/lib/module/classes/HMSRecordingState.js +11 -0
  494. package/lib/module/classes/HMSRecordingState.js.map +1 -0
  495. package/lib/module/classes/HMSRemoteAudioStats.js +3 -3
  496. package/lib/module/classes/HMSRemoteAudioStats.js.map +1 -1
  497. package/lib/module/classes/HMSRemoteAudioTrack.js +3 -3
  498. package/lib/module/classes/HMSRemoteAudioTrack.js.map +1 -1
  499. package/lib/module/classes/HMSRemotePeer.js +3 -3
  500. package/lib/module/classes/HMSRemotePeer.js.map +1 -1
  501. package/lib/module/classes/HMSRemoteVideoStats.js +3 -3
  502. package/lib/module/classes/HMSRemoteVideoStats.js.map +1 -1
  503. package/lib/module/classes/HMSRemoteVideoTrack.js +3 -3
  504. package/lib/module/classes/HMSRemoteVideoTrack.js.map +1 -1
  505. package/lib/module/classes/HMSRole.js +20 -3
  506. package/lib/module/classes/HMSRole.js.map +1 -1
  507. package/lib/module/classes/HMSRoleChangeRequest.js +3 -3
  508. package/lib/module/classes/HMSRoleChangeRequest.js.map +1 -1
  509. package/lib/module/classes/HMSRoom.js +17 -4
  510. package/lib/module/classes/HMSRoom.js.map +1 -1
  511. package/lib/module/classes/HMSRoomCache.js +11 -4
  512. package/lib/module/classes/HMSRoomCache.js.map +1 -1
  513. package/lib/module/classes/HMSRoomUpdate.js +1 -0
  514. package/lib/module/classes/HMSRoomUpdate.js.map +1 -1
  515. package/lib/module/classes/HMSRtmpStreamingState.js +5 -5
  516. package/lib/module/classes/HMSRtmpStreamingState.js.map +1 -1
  517. package/lib/module/classes/HMSRtmpVideoResolution.js +16 -3
  518. package/lib/module/classes/HMSRtmpVideoResolution.js.map +1 -1
  519. package/lib/module/classes/HMSSDK.js +1314 -328
  520. package/lib/module/classes/HMSSDK.js.map +1 -1
  521. package/lib/module/classes/HMSScreenBroadcastAudioReceiverNode.js.map +1 -1
  522. package/lib/module/classes/HMSServerRecordingState.js +5 -3
  523. package/lib/module/classes/HMSServerRecordingState.js.map +1 -1
  524. package/lib/module/classes/HMSSessionStore.js +19 -22
  525. package/lib/module/classes/HMSSessionStore.js.map +1 -1
  526. package/lib/module/classes/HMSSimulcastLayerDefinition.js +3 -3
  527. package/lib/module/classes/HMSSimulcastLayerDefinition.js.map +1 -1
  528. package/lib/module/classes/HMSSimulcastLayerSettings.js +3 -3
  529. package/lib/module/classes/HMSSimulcastLayerSettings.js.map +1 -1
  530. package/lib/module/classes/HMSSimulcastLayerSettingsPolicy.js +3 -3
  531. package/lib/module/classes/HMSSimulcastLayerSettingsPolicy.js.map +1 -1
  532. package/lib/module/classes/HMSSimulcastSettings.js +3 -3
  533. package/lib/module/classes/HMSSimulcastSettings.js.map +1 -1
  534. package/lib/module/classes/HMSSimulcastSettingsPolicy.js +3 -3
  535. package/lib/module/classes/HMSSimulcastSettingsPolicy.js.map +1 -1
  536. package/lib/module/classes/HMSSpeaker.js +3 -3
  537. package/lib/module/classes/HMSSpeaker.js.map +1 -1
  538. package/lib/module/classes/HMSStreamingState.js +9 -0
  539. package/lib/module/classes/HMSStreamingState.js.map +1 -0
  540. package/lib/module/classes/HMSSubscribeDegradationPolicy.js +3 -3
  541. package/lib/module/classes/HMSSubscribeDegradationPolicy.js.map +1 -1
  542. package/lib/module/classes/HMSSubscribeSettings.js +3 -3
  543. package/lib/module/classes/HMSSubscribeSettings.js.map +1 -1
  544. package/lib/module/classes/HMSTrack.js +16 -3
  545. package/lib/module/classes/HMSTrack.js.map +1 -1
  546. package/lib/module/classes/HMSTrackSettings.js +13 -3
  547. package/lib/module/classes/HMSTrackSettings.js.map +1 -1
  548. package/lib/module/classes/HMSTrackSettingsInitState.js +9 -0
  549. package/lib/module/classes/HMSTrackSettingsInitState.js.map +1 -1
  550. package/lib/module/classes/HMSTrackSource.js +10 -0
  551. package/lib/module/classes/HMSTrackSource.js.map +1 -1
  552. package/lib/module/classes/HMSTrackType.js +7 -0
  553. package/lib/module/classes/HMSTrackType.js.map +1 -1
  554. package/lib/module/classes/HMSTrackUpdate.js.map +1 -1
  555. package/lib/module/classes/HMSUpdateListenerActions.js +43 -3
  556. package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
  557. package/lib/module/classes/HMSVideoCodec.js.map +1 -1
  558. package/lib/module/classes/HMSVideoResolution.js +3 -3
  559. package/lib/module/classes/HMSVideoResolution.js.map +1 -1
  560. package/lib/module/classes/HMSVideoSettings.js +3 -3
  561. package/lib/module/classes/HMSVideoSettings.js.map +1 -1
  562. package/lib/module/classes/HMSVideoTrack.js +20 -3
  563. package/lib/module/classes/HMSVideoTrack.js.map +1 -1
  564. package/lib/module/classes/HMSVideoTrackSettings.js +18 -7
  565. package/lib/module/classes/HMSVideoTrackSettings.js.map +1 -1
  566. package/lib/module/classes/HMSVideoViewMode.js.map +1 -1
  567. package/lib/module/classes/HmsView.js +77 -25
  568. package/lib/module/classes/HmsView.js.map +1 -1
  569. package/lib/module/classes/polls/DecodedPollLeaderboardResponse.js +2 -0
  570. package/lib/module/classes/polls/DecodedPollLeaderboardResponse.js.map +1 -0
  571. package/lib/module/classes/polls/HMSPoll.js +2 -0
  572. package/lib/module/classes/polls/HMSPoll.js.map +1 -0
  573. package/lib/module/classes/polls/HMSPollCategory.js +6 -0
  574. package/lib/module/classes/polls/HMSPollCategory.js.map +1 -0
  575. package/lib/module/classes/polls/HMSPollCreateParams.js +2 -0
  576. package/lib/module/classes/polls/HMSPollCreateParams.js.map +1 -0
  577. package/lib/module/classes/polls/HMSPollLeaderboardEntry.js +2 -0
  578. package/lib/module/classes/polls/HMSPollLeaderboardEntry.js.map +1 -0
  579. package/lib/module/classes/polls/HMSPollLeaderboardSummary.js +2 -0
  580. package/lib/module/classes/polls/HMSPollLeaderboardSummary.js.map +1 -0
  581. package/lib/module/classes/polls/HMSPollQuestion.js +2 -0
  582. package/lib/module/classes/polls/HMSPollQuestion.js.map +1 -0
  583. package/lib/module/classes/polls/HMSPollQuestionAnswer.js +2 -0
  584. package/lib/module/classes/polls/HMSPollQuestionAnswer.js.map +1 -0
  585. package/lib/module/classes/polls/HMSPollQuestionCreateParams.js +2 -0
  586. package/lib/module/classes/polls/HMSPollQuestionCreateParams.js.map +1 -0
  587. package/lib/module/classes/polls/HMSPollQuestionOption.js +2 -0
  588. package/lib/module/classes/polls/HMSPollQuestionOption.js.map +1 -0
  589. package/lib/module/classes/polls/HMSPollQuestionOptionCreateParams.js +2 -0
  590. package/lib/module/classes/polls/HMSPollQuestionOptionCreateParams.js.map +1 -0
  591. package/lib/module/classes/polls/HMSPollQuestionQuizOptionCreateParams.js +2 -0
  592. package/lib/module/classes/polls/HMSPollQuestionQuizOptionCreateParams.js.map +1 -0
  593. package/lib/module/classes/polls/HMSPollQuestionResponse.js +2 -0
  594. package/lib/module/classes/polls/HMSPollQuestionResponse.js.map +1 -0
  595. package/lib/module/classes/polls/HMSPollQuestionResponseCreateParams.js +2 -0
  596. package/lib/module/classes/polls/HMSPollQuestionResponseCreateParams.js.map +1 -0
  597. package/lib/module/classes/polls/HMSPollQuestionResponseResult.js +2 -0
  598. package/lib/module/classes/polls/HMSPollQuestionResponseResult.js.map +1 -0
  599. package/lib/module/classes/polls/HMSPollQuestionResult.js +2 -0
  600. package/lib/module/classes/polls/HMSPollQuestionResult.js.map +1 -0
  601. package/lib/module/classes/polls/HMSPollQuestionType.js +8 -0
  602. package/lib/module/classes/polls/HMSPollQuestionType.js.map +1 -0
  603. package/lib/module/classes/polls/HMSPollResponsePeerInfo.js +2 -0
  604. package/lib/module/classes/polls/HMSPollResponsePeerInfo.js.map +1 -0
  605. package/lib/module/classes/polls/HMSPollResult.js +2 -0
  606. package/lib/module/classes/polls/HMSPollResult.js.map +1 -0
  607. package/lib/module/classes/polls/HMSPollState.js +7 -0
  608. package/lib/module/classes/polls/HMSPollState.js.map +1 -0
  609. package/lib/module/classes/polls/HMSPollType.js +6 -0
  610. package/lib/module/classes/polls/HMSPollType.js.map +1 -0
  611. package/lib/module/classes/polls/HMSPollUpdateType.js +7 -0
  612. package/lib/module/classes/polls/HMSPollUpdateType.js.map +1 -0
  613. package/lib/module/classes/polls/HMSPollUserTrackingMode.js +7 -0
  614. package/lib/module/classes/polls/HMSPollUserTrackingMode.js.map +1 -0
  615. package/lib/module/classes/polls/PollLeaderboardResponse.js +2 -0
  616. package/lib/module/classes/polls/PollLeaderboardResponse.js.map +1 -0
  617. package/lib/module/classes/transcriptions/HMSTranscript.js +2 -0
  618. package/lib/module/classes/transcriptions/HMSTranscript.js.map +1 -0
  619. package/lib/module/classes/transcriptions/OnTranscriptionError.js +2 -0
  620. package/lib/module/classes/transcriptions/OnTranscriptionError.js.map +1 -0
  621. package/lib/module/classes/transcriptions/TranscriptionState.js +8 -0
  622. package/lib/module/classes/transcriptions/TranscriptionState.js.map +1 -0
  623. package/lib/module/classes/transcriptions/Transcriptions.js +2 -0
  624. package/lib/module/classes/transcriptions/Transcriptions.js.map +1 -0
  625. package/lib/module/classes/transcriptions/TranscriptionsMode.js +6 -0
  626. package/lib/module/classes/transcriptions/TranscriptionsMode.js.map +1 -0
  627. package/lib/module/classes/transcriptions/index.js +6 -0
  628. package/lib/module/classes/transcriptions/index.js.map +1 -0
  629. package/lib/module/classes/whiteboard/HMSWhiteboard.js +2 -0
  630. package/lib/module/classes/whiteboard/HMSWhiteboard.js.map +1 -0
  631. package/lib/module/classes/whiteboard/HMSWhiteboardListenerActions.js +5 -0
  632. package/lib/module/classes/whiteboard/HMSWhiteboardListenerActions.js.map +1 -0
  633. package/lib/module/classes/whiteboard/HMSWhiteboardState.js +6 -0
  634. package/lib/module/classes/whiteboard/HMSWhiteboardState.js.map +1 -0
  635. package/lib/module/classes/whiteboard/HMSWhiteboardUpdateType.js +6 -0
  636. package/lib/module/classes/whiteboard/HMSWhiteboardUpdateType.js.map +1 -0
  637. package/lib/module/classes/whiteboard/index.js +4 -0
  638. package/lib/module/classes/whiteboard/index.js.map +1 -0
  639. package/lib/module/classes/whiteboard/registerCallbacks.js +18 -0
  640. package/lib/module/classes/whiteboard/registerCallbacks.js.map +1 -0
  641. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js +157 -49
  642. package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
  643. package/lib/module/components/HMSHLSPlayer/RCTHMSHLSPlayer.js +3 -3
  644. package/lib/module/components/HMSHLSPlayer/RCTHMSHLSPlayer.js.map +1 -1
  645. package/lib/module/components/HMSHLSPlayer/hooks.js +16 -4
  646. package/lib/module/components/HMSHLSPlayer/hooks.js.map +1 -1
  647. package/lib/module/components/HMSHLSPlayer/index.js +1 -1
  648. package/lib/module/components/HMSHLSPlayer/index.js.map +1 -1
  649. package/lib/module/hooks/hmsviews.js +12 -0
  650. package/lib/module/hooks/hmsviews.js.map +1 -0
  651. package/lib/module/hooks/polls.js +12 -0
  652. package/lib/module/hooks/polls.js.map +1 -0
  653. package/lib/module/hooks/useHMSPeerUpdates.js +1 -2
  654. package/lib/module/hooks/useHMSPeerUpdates.js.map +1 -1
  655. package/lib/module/index.js +29 -2
  656. package/lib/module/index.js.map +1 -1
  657. package/lib/module/modules/HMSManagerModule.js +3 -0
  658. package/lib/module/modules/HMSManagerModule.js.map +1 -0
  659. package/lib/module/specs/HMSHLSPlayerNativeComponent.js +69 -0
  660. package/lib/module/specs/HMSHLSPlayerNativeComponent.js.map +1 -0
  661. package/lib/module/specs/HMSViewNativeComponent.js +49 -0
  662. package/lib/module/specs/HMSViewNativeComponent.js.map +1 -0
  663. package/lib/module/specs/NativeHMSManager.js +33 -0
  664. package/lib/module/specs/NativeHMSManager.js.map +1 -0
  665. package/lib/module/stores/hls-player-playback-slice.js +10 -0
  666. package/lib/module/stores/hls-player-playback-slice.js.map +1 -1
  667. package/lib/module/stores/hls-player-stats-store.js +27 -15
  668. package/lib/module/stores/hls-player-stats-store.js.map +1 -1
  669. package/lib/module/stores/hms-interactivity-store.js +15 -0
  670. package/lib/module/stores/hms-interactivity-store.js.map +1 -0
  671. package/lib/module/stores/hms-polls-slice.js +12 -0
  672. package/lib/module/stores/hms-polls-slice.js.map +1 -0
  673. package/lib/module/stores/hms-store.js +5 -5
  674. package/lib/module/stores/hms-store.js.map +1 -1
  675. package/lib/module/stores/hmsviews-slice.js +12 -0
  676. package/lib/module/stores/hmsviews-slice.js.map +1 -0
  677. package/lib/module/stores/types.js.map +1 -1
  678. package/lib/module/types.js +3 -1
  679. package/lib/module/types.js.map +1 -1
  680. package/lib/module/utils/emitter/EventEmitter.js +23 -7
  681. package/lib/module/utils/emitter/EventEmitter.js.map +1 -1
  682. package/lib/module/utils/emitter/_EmitterSubscription.js +3 -3
  683. package/lib/module/utils/emitter/_EmitterSubscription.js.map +1 -1
  684. package/lib/module/utils/emitter/_EventSubscription.js +3 -3
  685. package/lib/module/utils/emitter/_EventSubscription.js.map +1 -1
  686. package/lib/module/utils/emitter/_EventSubscriptionVendor.js +3 -4
  687. package/lib/module/utils/emitter/_EventSubscriptionVendor.js.map +1 -1
  688. package/lib/module/utils/index.js.map +1 -1
  689. package/lib/module/utils/keyboard.js +38 -0
  690. package/lib/module/utils/keyboard.js.map +1 -0
  691. package/lib/module/utils/notification.js +5 -0
  692. package/lib/module/utils/notification.js.map +1 -0
  693. package/lib/module/utils/windowController.js +22 -0
  694. package/lib/module/utils/windowController.js.map +1 -0
  695. package/lib/typescript/classes/HMSAudioDevice.d.ts +14 -0
  696. package/lib/typescript/classes/HMSAudioMixingMode.d.ts +11 -0
  697. package/lib/typescript/classes/HMSAudioTrack.d.ts +9 -0
  698. package/lib/typescript/classes/HMSAudioTrackSettings.d.ts +9 -0
  699. package/lib/typescript/classes/HMSBrowserRecordingState.d.ts +3 -0
  700. package/lib/typescript/classes/HMSCameraFacing.d.ts +11 -0
  701. package/lib/typescript/classes/HMSConfig.d.ts +27 -0
  702. package/lib/typescript/classes/HMSEncoder.d.ts +5 -0
  703. package/lib/typescript/classes/HMSException.d.ts +18 -0
  704. package/lib/typescript/classes/HMSHLSPlaylistType.d.ts +4 -0
  705. package/lib/typescript/classes/HMSHLSRecordingState.d.ts +6 -4
  706. package/lib/typescript/classes/HMSHLSStreamingState.d.ts +8 -0
  707. package/lib/typescript/classes/HMSHLSTimedMetadata.d.ts +16 -0
  708. package/lib/typescript/classes/HMSHLSVariant.d.ts +3 -0
  709. package/lib/typescript/classes/HMSIOSAudioMode.d.ts +15 -0
  710. package/lib/typescript/classes/HMSInteractivityCenter.d.ts +62 -0
  711. package/lib/typescript/classes/HMSInteractivityEncoder.d.ts +9 -0
  712. package/lib/typescript/classes/HMSLogAlarmManager.d.ts +12 -0
  713. package/lib/typescript/classes/HMSLogLevel.d.ts +12 -0
  714. package/lib/typescript/classes/HMSLogSettings.d.ts +14 -0
  715. package/lib/typescript/classes/HMSNetworkQuality.d.ts +11 -0
  716. package/lib/typescript/classes/HMSNoiseCancellationPlugin.d.ts +87 -0
  717. package/lib/typescript/classes/HMSPIPConfig.d.ts +47 -0
  718. package/lib/typescript/classes/HMSPIPListenerActions.d.ts +17 -0
  719. package/lib/typescript/classes/HMSPeer.d.ts +144 -1
  720. package/lib/typescript/classes/HMSPeerListIterator.d.ts +3 -1
  721. package/lib/typescript/classes/HMSPeerListIteratorOptions.d.ts +19 -0
  722. package/lib/typescript/classes/HMSPeerType.d.ts +16 -0
  723. package/lib/typescript/classes/HMSPeersCache.d.ts +2 -0
  724. package/lib/typescript/classes/HMSPermissions.d.ts +18 -0
  725. package/lib/typescript/classes/HMSPollsListenerActions.d.ts +3 -0
  726. package/lib/typescript/classes/HMSRTMPConfig.d.ts +14 -0
  727. package/lib/typescript/classes/HMSRecordingState.d.ts +9 -0
  728. package/lib/typescript/classes/HMSRole.d.ts +17 -0
  729. package/lib/typescript/classes/HMSRoom.d.ts +3 -0
  730. package/lib/typescript/classes/HMSRoomUpdate.d.ts +2 -1
  731. package/lib/typescript/classes/HMSRtmpStreamingState.d.ts +3 -2
  732. package/lib/typescript/classes/HMSRtmpVideoResolution.d.ts +13 -0
  733. package/lib/typescript/classes/HMSSDK.d.ts +1123 -249
  734. package/lib/typescript/classes/HMSServerRecordingState.d.ts +3 -0
  735. package/lib/typescript/classes/HMSSessionStore.d.ts +23 -22
  736. package/lib/typescript/classes/HMSStreamingState.d.ts +7 -0
  737. package/lib/typescript/classes/HMSTrack.d.ts +13 -0
  738. package/lib/typescript/classes/HMSTrackSettings.d.ts +10 -0
  739. package/lib/typescript/classes/HMSTrackSettingsInitState.d.ts +11 -0
  740. package/lib/typescript/classes/HMSTrackSource.d.ts +10 -0
  741. package/lib/typescript/classes/HMSTrackType.d.ts +7 -0
  742. package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +290 -3
  743. package/lib/typescript/classes/HMSVideoTrack.d.ts +17 -0
  744. package/lib/typescript/classes/HMSVideoTrackSettings.d.ts +23 -2
  745. package/lib/typescript/classes/HmsView.d.ts +16 -0
  746. package/lib/typescript/classes/polls/DecodedPollLeaderboardResponse.d.ts +37 -0
  747. package/lib/typescript/classes/polls/HMSPoll.d.ts +73 -0
  748. package/lib/typescript/classes/polls/HMSPollCategory.d.ts +10 -0
  749. package/lib/typescript/classes/polls/HMSPollCreateParams.d.ts +6 -0
  750. package/lib/typescript/classes/polls/HMSPollLeaderboardEntry.d.ts +9 -0
  751. package/lib/typescript/classes/polls/HMSPollLeaderboardSummary.d.ts +7 -0
  752. package/lib/typescript/classes/polls/HMSPollQuestion.d.ts +61 -0
  753. package/lib/typescript/classes/polls/HMSPollQuestionAnswer.d.ts +17 -0
  754. package/lib/typescript/classes/polls/HMSPollQuestionCreateParams.d.ts +25 -0
  755. package/lib/typescript/classes/polls/HMSPollQuestionOption.d.ts +21 -0
  756. package/lib/typescript/classes/polls/HMSPollQuestionOptionCreateParams.d.ts +3 -0
  757. package/lib/typescript/classes/polls/HMSPollQuestionQuizOptionCreateParams.d.ts +4 -0
  758. package/lib/typescript/classes/polls/HMSPollQuestionResponse.d.ts +47 -0
  759. package/lib/typescript/classes/polls/HMSPollQuestionResponseCreateParams.d.ts +2 -0
  760. package/lib/typescript/classes/polls/HMSPollQuestionResponseResult.d.ts +17 -0
  761. package/lib/typescript/classes/polls/HMSPollQuestionResult.d.ts +29 -0
  762. package/lib/typescript/classes/polls/HMSPollQuestionType.d.ts +18 -0
  763. package/lib/typescript/classes/polls/HMSPollResponsePeerInfo.d.ts +21 -0
  764. package/lib/typescript/classes/polls/HMSPollResult.d.ts +22 -0
  765. package/lib/typescript/classes/polls/HMSPollState.d.ts +14 -0
  766. package/lib/typescript/classes/polls/HMSPollType.d.ts +4 -0
  767. package/lib/typescript/classes/polls/HMSPollUpdateType.d.ts +5 -0
  768. package/lib/typescript/classes/polls/HMSPollUserTrackingMode.d.ts +14 -0
  769. package/lib/typescript/classes/polls/PollLeaderboardResponse.d.ts +7 -0
  770. package/lib/typescript/classes/transcriptions/HMSTranscript.d.ts +8 -0
  771. package/lib/typescript/classes/transcriptions/OnTranscriptionError.d.ts +4 -0
  772. package/lib/typescript/classes/transcriptions/TranscriptionState.d.ts +6 -0
  773. package/lib/typescript/classes/transcriptions/Transcriptions.d.ts +12 -0
  774. package/lib/typescript/classes/transcriptions/TranscriptionsMode.d.ts +4 -0
  775. package/lib/typescript/classes/transcriptions/index.d.ts +5 -0
  776. package/lib/typescript/classes/whiteboard/HMSWhiteboard.d.ts +10 -0
  777. package/lib/typescript/classes/whiteboard/HMSWhiteboardListenerActions.d.ts +3 -0
  778. package/lib/typescript/classes/whiteboard/HMSWhiteboardState.d.ts +4 -0
  779. package/lib/typescript/classes/whiteboard/HMSWhiteboardUpdateType.d.ts +4 -0
  780. package/lib/typescript/classes/whiteboard/index.d.ts +3 -0
  781. package/lib/typescript/classes/whiteboard/registerCallbacks.d.ts +8 -0
  782. package/lib/typescript/components/HMSHLSPlayer/HMSHLSPlayer.d.ts +6 -0
  783. package/lib/typescript/components/HMSHLSPlayer/RCTHMSHLSPlayer.d.ts +11 -9
  784. package/lib/typescript/components/HMSHLSPlayer/hooks.d.ts +5 -0
  785. package/lib/typescript/components/HMSHLSPlayer/index.d.ts +1 -1
  786. package/lib/typescript/hooks/hmsviews.d.ts +3 -0
  787. package/lib/typescript/hooks/polls.d.ts +3 -0
  788. package/lib/typescript/index.d.ts +29 -2
  789. package/lib/typescript/specs/HMSHLSPlayerNativeComponent.d.ts +115 -0
  790. package/lib/typescript/specs/HMSViewNativeComponent.d.ts +97 -0
  791. package/lib/typescript/specs/NativeHMSManager.d.ts +147 -0
  792. package/lib/typescript/stores/hls-player-stats-store.d.ts +4 -3
  793. package/lib/typescript/stores/hms-interactivity-store.d.ts +9 -0
  794. package/lib/typescript/stores/hms-polls-slice.d.ts +5 -0
  795. package/lib/typescript/stores/hms-store.d.ts +4 -3
  796. package/lib/typescript/stores/hmsviews-slice.d.ts +5 -0
  797. package/lib/typescript/stores/types.d.ts +27 -3
  798. package/lib/typescript/types.d.ts +18 -5
  799. package/lib/typescript/utils/emitter/EventEmitter.d.ts +7 -0
  800. package/lib/typescript/utils/keyboard.d.ts +16 -0
  801. package/lib/typescript/utils/notification.d.ts +5 -0
  802. package/lib/typescript/utils/windowController.d.ts +10 -0
  803. package/package.json +49 -7
  804. package/react-native-hms.podspec +56 -2
  805. package/sdk-versions.json +4 -3
  806. package/src/classes/HMSAudioDevice.ts +18 -0
  807. package/src/classes/HMSAudioMixingMode.ts +11 -0
  808. package/src/classes/HMSAudioTrack.ts +9 -0
  809. package/src/classes/HMSAudioTrackSettings.ts +11 -0
  810. package/src/classes/HMSBrowserRecordingState.ts +4 -0
  811. package/src/classes/HMSCameraControl.ts +1 -1
  812. package/src/classes/HMSCameraFacing.ts +11 -0
  813. package/src/classes/HMSConfig.ts +27 -0
  814. package/src/classes/HMSEncoder.ts +57 -4
  815. package/src/classes/HMSException.ts +18 -0
  816. package/src/classes/HMSHLSPlaylistType.ts +4 -0
  817. package/src/classes/HMSHLSRecordingState.ts +9 -7
  818. package/src/classes/HMSHLSStreamingState.ts +15 -1
  819. package/src/classes/HMSHLSTimedMetadata.ts +16 -0
  820. package/src/classes/HMSHLSVariant.ts +5 -0
  821. package/src/classes/HMSIOSAudioMode.ts +15 -0
  822. package/src/classes/HMSInteractivityCenter.ts +246 -0
  823. package/src/classes/HMSInteractivityEncoder.ts +92 -0
  824. package/src/classes/HMSLogAlarmManager.ts +12 -0
  825. package/src/classes/HMSLogLevel.ts +12 -0
  826. package/src/classes/HMSLogSettings.ts +14 -0
  827. package/src/classes/HMSNativeEventEmitter.ts +1 -7
  828. package/src/classes/HMSNativeEventListener.ts +1 -1
  829. package/src/classes/HMSNetworkQuality.ts +11 -0
  830. package/src/classes/HMSNoiseCancellationPlugin.ts +162 -0
  831. package/src/classes/HMSPIPConfig.ts +54 -0
  832. package/src/classes/HMSPIPListenerActions.ts +18 -0
  833. package/src/classes/HMSPeer.ts +193 -3
  834. package/src/classes/HMSPeerListIterator.ts +29 -7
  835. package/src/classes/HMSPeerListIteratorOptions.ts +21 -0
  836. package/src/classes/HMSPeerType.ts +20 -0
  837. package/src/classes/HMSPeersCache.ts +3 -1
  838. package/src/classes/HMSPermissions.ts +25 -0
  839. package/src/classes/HMSPollsListenerActions.ts +3 -0
  840. package/src/classes/HMSRTMPConfig.ts +14 -0
  841. package/src/classes/HMSRecordingState.ts +9 -0
  842. package/src/classes/HMSRole.ts +17 -0
  843. package/src/classes/HMSRoom.ts +27 -0
  844. package/src/classes/HMSRoomCache.ts +10 -1
  845. package/src/classes/HMSRoomUpdate.ts +1 -0
  846. package/src/classes/HMSRtmpStreamingState.ts +4 -3
  847. package/src/classes/HMSRtmpVideoResolution.ts +13 -0
  848. package/src/classes/HMSSDK.tsx +1379 -345
  849. package/src/classes/HMSServerRecordingState.ts +4 -0
  850. package/src/classes/HMSSessionStore.ts +34 -45
  851. package/src/classes/HMSStreamingState.ts +7 -0
  852. package/src/classes/HMSTrack.ts +13 -0
  853. package/src/classes/HMSTrackSettings.ts +10 -0
  854. package/src/classes/HMSTrackSettingsInitState.ts +11 -0
  855. package/src/classes/HMSTrackSource.ts +10 -0
  856. package/src/classes/HMSTrackType.ts +7 -0
  857. package/src/classes/HMSUpdateListenerActions.ts +313 -3
  858. package/src/classes/HMSVideoTrack.ts +17 -0
  859. package/src/classes/HMSVideoTrackSettings.ts +27 -2
  860. package/src/classes/HmsView.tsx +92 -57
  861. package/src/classes/polls/DecodedPollLeaderboardResponse.ts +43 -0
  862. package/src/classes/polls/HMSPoll.ts +99 -0
  863. package/src/classes/polls/HMSPollCategory.ts +11 -0
  864. package/src/classes/polls/HMSPollCreateParams.ts +19 -0
  865. package/src/classes/polls/HMSPollLeaderboardEntry.ts +10 -0
  866. package/src/classes/polls/HMSPollLeaderboardSummary.ts +7 -0
  867. package/src/classes/polls/HMSPollQuestion.ts +92 -0
  868. package/src/classes/polls/HMSPollQuestionAnswer.ts +29 -0
  869. package/src/classes/polls/HMSPollQuestionCreateParams.ts +36 -0
  870. package/src/classes/polls/HMSPollQuestionOption.ts +24 -0
  871. package/src/classes/polls/HMSPollQuestionOptionCreateParams.ts +8 -0
  872. package/src/classes/polls/HMSPollQuestionQuizOptionCreateParams.ts +6 -0
  873. package/src/classes/polls/HMSPollQuestionResponse.ts +72 -0
  874. package/src/classes/polls/HMSPollQuestionResponseCreateParams.ts +6 -0
  875. package/src/classes/polls/HMSPollQuestionResponseResult.ts +19 -0
  876. package/src/classes/polls/HMSPollQuestionResult.ts +41 -0
  877. package/src/classes/polls/HMSPollQuestionType.ts +21 -0
  878. package/src/classes/polls/HMSPollResponsePeerInfo.ts +24 -0
  879. package/src/classes/polls/HMSPollResult.ts +26 -0
  880. package/src/classes/polls/HMSPollState.ts +16 -0
  881. package/src/classes/polls/HMSPollType.ts +4 -0
  882. package/src/classes/polls/HMSPollUpdateType.ts +5 -0
  883. package/src/classes/polls/HMSPollUserTrackingMode.ts +16 -0
  884. package/src/classes/polls/PollLeaderboardResponse.ts +8 -0
  885. package/src/classes/transcriptions/HMSTranscript.ts +13 -0
  886. package/src/classes/transcriptions/OnTranscriptionError.ts +5 -0
  887. package/src/classes/transcriptions/TranscriptionState.ts +6 -0
  888. package/src/classes/transcriptions/Transcriptions.ts +19 -0
  889. package/src/classes/transcriptions/TranscriptionsMode.ts +4 -0
  890. package/src/classes/transcriptions/index.ts +5 -0
  891. package/src/classes/whiteboard/HMSWhiteboard.tsx +16 -0
  892. package/src/classes/whiteboard/HMSWhiteboardListenerActions.ts +3 -0
  893. package/src/classes/whiteboard/HMSWhiteboardState.tsx +4 -0
  894. package/src/classes/whiteboard/HMSWhiteboardUpdateType.tsx +4 -0
  895. package/src/classes/whiteboard/index.ts +3 -0
  896. package/src/classes/whiteboard/registerCallbacks.ts +34 -0
  897. package/src/components/HMSHLSPlayer/HMSHLSPlayer.tsx +176 -92
  898. package/src/components/HMSHLSPlayer/RCTHMSHLSPlayer.ts +20 -13
  899. package/src/components/HMSHLSPlayer/hooks.ts +22 -4
  900. package/src/components/HMSHLSPlayer/index.ts +3 -0
  901. package/src/hooks/hmsviews.ts +15 -0
  902. package/src/hooks/polls.ts +14 -0
  903. package/src/index.ts +38 -3
  904. package/src/modules/HMSManagerModule.ts +5 -0
  905. package/src/specs/HMSHLSPlayerNativeComponent.ts +203 -0
  906. package/src/specs/HMSViewNativeComponent.ts +119 -0
  907. package/src/specs/NativeHMSManager.ts +307 -0
  908. package/src/stores/hls-player-playback-slice.ts +11 -0
  909. package/src/stores/hls-player-stats-store.ts +28 -18
  910. package/src/stores/hms-interactivity-store.ts +18 -0
  911. package/src/stores/hms-polls-slice.ts +20 -0
  912. package/src/stores/hms-store.ts +2 -0
  913. package/src/stores/hmsviews-slice.ts +20 -0
  914. package/src/stores/types.ts +50 -4
  915. package/src/types.ts +28 -3
  916. package/src/utils/emitter/EventEmitter.ts +26 -0
  917. package/src/utils/keyboard.ts +37 -0
  918. package/src/utils/notification.ts +10 -0
  919. package/src/utils/windowController.ts +23 -0
  920. package/android/.gradle/6.7.1/executionHistory/executionHistory.lock +0 -0
  921. package/android/.gradle/6.7.1/fileChanges/last-build.bin +0 -0
  922. package/android/.gradle/6.7.1/fileHashes/fileHashes.lock +0 -0
  923. package/android/.gradle/6.7.1/gc.properties +0 -0
  924. package/android/.gradle/6.9/executionHistory/executionHistory.bin +0 -0
  925. package/android/.gradle/6.9/executionHistory/executionHistory.lock +0 -0
  926. package/android/.gradle/6.9/fileChanges/last-build.bin +0 -0
  927. package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
  928. package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
  929. package/android/.gradle/6.9/fileHashes/resourceHashesCache.bin +0 -0
  930. package/android/.gradle/6.9/gc.properties +0 -0
  931. package/android/.gradle/6.9/javaCompile/classAnalysis.bin +0 -0
  932. package/android/.gradle/6.9/javaCompile/jarAnalysis.bin +0 -0
  933. package/android/.gradle/6.9/javaCompile/javaCompile.lock +0 -0
  934. package/android/.gradle/6.9/javaCompile/taskHistory.bin +0 -0
  935. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  936. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  937. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  938. package/android/.gradle/checksums/checksums.lock +0 -0
  939. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  940. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  941. package/android/.gradle/configuration-cache/gc.properties +0 -0
  942. package/android/.gradle/vcs-1/gc.properties +0 -0
  943. package/android/.idea/compiler.xml +0 -6
  944. package/android/.idea/gradle.xml +0 -18
  945. package/android/.idea/jarRepositories.xml +0 -45
  946. package/android/.idea/misc.xml +0 -10
  947. package/android/.idea/vcs.xml +0 -6
  948. package/android/local.properties +0 -8
  949. package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayerManager.kt +0 -114
  950. package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +0 -115
  951. package/ios/Hmssdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  952. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  953. package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/jatinnagar.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  954. package/ios/Hmssdk.xcodeproj/xcuserdata/jatinnagar.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  955. package/lib/commonjs/classes/HMSManagerModule.js +0 -18
  956. package/lib/commonjs/classes/HMSManagerModule.js.map +0 -1
  957. package/lib/module/classes/HMSManagerModule.js +0 -11
  958. package/lib/module/classes/HMSManagerModule.js.map +0 -1
  959. package/src/classes/HMSManagerModule.ts +0 -18
  960. /package/lib/typescript/{classes → modules}/HMSManagerModule.d.ts +0 -0
@@ -8,10 +8,13 @@
8
8
  import Foundation
9
9
  import HMSSDK
10
10
  import ReplayKit
11
+ import AVKit
12
+ import SwiftUI
11
13
 
12
- class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
14
+ class HMSRNSDK: NSObject, HMSUpdateListener, HMSPreviewListener {
13
15
 
14
16
  var hms: HMSSDK?
17
+ var interactivity: HMSRNInteractivityCenter?
15
18
 
16
19
  var delegate: HMSManager?
17
20
  var id: String = "12345"
@@ -26,26 +29,78 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
26
29
  private var isScreenShared: Bool? = false
27
30
  private var previewInProgress = false
28
31
  private var networkQualityUpdatesAttached = false
29
- private var eventsEnableStatus: [String: Bool] = [:]
32
+ internal var eventsEnableStatus: [String: Bool] = [:]
30
33
  private var sessionStore: HMSSessionStore?
31
34
  private var sessionStoreChangeObservers = [String: NSObjectProtocol]()
35
+ private var peerListIterators = [String: HMSPeerListIterator]()
36
+ private var roomMutedLocally = false
37
+ private var noiseCancellationPlugin: HMSNoiseCancellationPlugin?
38
+ private var videoFilterPlugin: HMSVideoFilterPlugin?
39
+ private var virtualBackgroundPlugin: HMSVideoPlugin?
32
40
 
33
41
  // MARK: - Setup
34
42
  init(data: NSDictionary?, delegate manager: HMSManager?, uid id: String) {
43
+ super.init()
35
44
  preferredExtension = data?.value(forKey: "preferredExtension") as? String
36
-
45
+ self.delegate = manager
46
+ self.id = id
37
47
  DispatchQueue.main.async { [weak self] in
48
+ var noiseCancellationPlugin: HMSNoiseCancellationPlugin?
49
+ var videoFilterPlugin: HMSVideoFilterPlugin?
50
+ var virtualBackgroundPlugin: HMSVideoPlugin?
51
+
38
52
  self?.hms = HMSSDK.build { sdk in
39
53
  sdk.appGroup = data?.value(forKey: "appGroup") as? String
40
54
  sdk.frameworkInfo = HMSHelper.getFrameworkInfo(data?.value(forKey: "frameworkInfo") as? NSDictionary)
41
- let trackSettings = data?.value(forKey: "trackSettings") as? NSDictionary
42
- let videoSettings = HMSHelper.getLocalVideoSettings(trackSettings?.value(forKey: "video") as? NSDictionary)
43
- let audioSettings = HMSHelper.getLocalAudioSettings(trackSettings?.value(forKey: "audio") as? NSDictionary, sdk, self?.delegate, id)
55
+ let trackSettingsDict = data?.value(forKey: "trackSettings") as? NSDictionary
56
+
57
+ // Video track settings
58
+ let videoSettingsDict = trackSettingsDict?.value(forKey: "video") as? NSDictionary
59
+ let videoPluginDict = videoSettingsDict?.value(forKey: "videoPlugin") as? NSDictionary
60
+ let videoPlugin = HMSHelper.getHMSVideoPlugin(videoPluginDict)
61
+
62
+ if let asVideoFilterPlugin = videoPlugin as? HMSVideoFilterPlugin {
63
+ videoFilterPlugin = asVideoFilterPlugin
64
+ } else if #available(iOS 15.0, *) {
65
+ let asVirtualBGPlugin = videoPlugin as? HMSVirtualBackgroundPlugin
66
+ virtualBackgroundPlugin = asVirtualBGPlugin
67
+ }
68
+
69
+ let videoSettings = HMSHelper.getLocalVideoSettings(videoSettingsDict, videoPlugin)
70
+
71
+ // Audio track settings
72
+ let audioSettingsDict = trackSettingsDict?.value(forKey: "audio") as? NSDictionary
73
+
74
+ let value = audioSettingsDict?.value(forKey: "noiseCancellationPlugin") as? NSDictionary
75
+ noiseCancellationPlugin = HMSHelper.getHMSNoiseCancellationPlugin(value)
76
+
77
+ let audioSettings = HMSHelper.getLocalAudioSettings(audioSettingsDict, noiseCancellationPlugin, sdk, self?.delegate, id)
78
+
79
+ // Track Settings
44
80
  sdk.trackSettings = HMSTrackSettings(videoSettings: videoSettings, audioSettings: audioSettings)
45
81
  }
82
+ self?.noiseCancellationPlugin = noiseCancellationPlugin
83
+ self?.virtualBackgroundPlugin = virtualBackgroundPlugin
84
+ self?.videoFilterPlugin = videoFilterPlugin
85
+ if let hms = self?.hms {
86
+ self?.interactivity = HMSRNInteractivityCenter(
87
+ hmssdk: hms,
88
+ hmsrnsdk: self
89
+ )
90
+ }
91
+
92
+ NotificationCenter.default.addObserver(forName: UIApplication.willTerminateNotification,
93
+ object: nil,
94
+ queue: .main) { [weak self] _ in
95
+ if self?.hms?.room != nil {
96
+ self?.hms?.leave()
97
+ }
98
+ }
46
99
  }
47
- self.delegate = manager
48
- self.id = id
100
+ }
101
+
102
+ deinit {
103
+ NotificationCenter.default.removeObserver(self)
49
104
  }
50
105
 
51
106
  // MARK: - Prebuilt
@@ -60,7 +115,7 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
60
115
  DispatchQueue.main.async { [weak self] in
61
116
  guard let strongSelf = self else { return }
62
117
 
63
- if let endPoint = data["endpoint"] as? String, (endPoint.contains("mockable") || endPoint.contains("nonprod")) {
118
+ if let endPoint = data["endpoint"] as? String, endPoint.contains("mockable") || endPoint.contains("nonprod") {
64
119
  UserDefaults.standard.set(endPoint, forKey: "HMSRoomLayoutEndpointOverride")
65
120
  } else {
66
121
  UserDefaults.standard.removeObject(forKey: "HMSRoomLayoutEndpointOverride")
@@ -124,7 +179,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
124
179
  guard let role = data.value(forKey: "role") as? String
125
180
  else {
126
181
  let errorMessage = "previewForRole: " + HMSHelper.getUnavailableRequiredKey(data, ["role"])
127
- emitRequiredKeysError(errorMessage)
128
182
  reject?(errorMessage, errorMessage, nil)
129
183
  return
130
184
  }
@@ -210,8 +264,8 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
210
264
  DispatchQueue.main.async { [weak self] in
211
265
  self?.hms?.getAuthTokenByRoomCode(roomCode, userID: userId) { token, error in
212
266
  // error occurred
213
- if error != nil {
214
- reject?(error?.localizedDescription, error?.localizedDescription, nil)
267
+ if let error = error as? NSError {
268
+ reject?(String(error.code), error.localizedDescription, nil)
215
269
  return
216
270
  }
217
271
  // no error and token is valid
@@ -228,44 +282,48 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
228
282
  }
229
283
  }
230
284
 
231
- func setLocalMute(_ data: NSDictionary) {
285
+ func setLocalMute(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
232
286
  guard let isMute = data.value(forKey: "isMute") as? Bool
233
287
  else {
234
288
  let errorMessage = "setLocalMute: " + HMSHelper.getUnavailableRequiredKey(data, ["isMute"])
235
- emitRequiredKeysError(errorMessage)
289
+ reject?(errorMessage, errorMessage, nil)
236
290
  return
237
291
  }
238
292
 
239
293
  DispatchQueue.main.async { [weak self] in
240
294
  if let audioTrack = self?.hms?.localPeer?.localAudioTrack() {
241
295
  audioTrack.setMute(isMute)
242
- } else if let tracks = self?.previewForRoleTracks {
243
- if let audioTrack = tracks.first(where: { $0.kind == HMSTrackKind.audio }) as? HMSLocalAudioTrack {
244
- audioTrack.setMute(isMute)
245
- }
296
+ resolve?(true)
297
+ } else if let tracks = self?.previewForRoleTracks, let audioTrack = tracks.first(where: { $0.kind == HMSTrackKind.audio }) as? HMSLocalAudioTrack {
298
+ audioTrack.setMute(isMute)
299
+ resolve?(true)
246
300
  } else {
247
- print(#function, "No local audio track available for setting mute state.")
301
+ let errorMessage = "setLocalMute: No local audio track available for setting mute state."
302
+ print(#function, errorMessage)
303
+ reject?(errorMessage, errorMessage, nil)
248
304
  }
249
305
  }
250
306
  }
251
307
 
252
- func setLocalVideoMute(_ data: NSDictionary) {
308
+ func setLocalVideoMute(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
253
309
  guard let isMute = data.value(forKey: "isMute") as? Bool
254
310
  else {
255
311
  let errorMessage = "setLocalVideoMute: " + HMSHelper.getUnavailableRequiredKey(data, ["isMute"])
256
- emitRequiredKeysError(errorMessage)
312
+ reject?(errorMessage, errorMessage, nil)
257
313
  return
258
314
  }
259
315
 
260
316
  DispatchQueue.main.async { [weak self] in
261
317
  if let videoTrack = self?.hms?.localPeer?.localVideoTrack() {
262
318
  videoTrack.setMute(isMute)
263
- } else if let tracks = self?.previewForRoleTracks {
264
- if let videoTrack = tracks.first(where: { $0.kind == HMSTrackKind.video }) as? HMSLocalVideoTrack {
265
- videoTrack.setMute(isMute)
266
- }
319
+ resolve?(true)
320
+ } else if let tracks = self?.previewForRoleTracks, let videoTrack = tracks.first(where: { $0.kind == HMSTrackKind.video }) as? HMSLocalVideoTrack {
321
+ videoTrack.setMute(isMute)
322
+ resolve?(true)
267
323
  } else {
268
- print(#function, "No local video track available for setting mute state.")
324
+ let errorMessage = "setLocalVideoMute: No local video track available for setting mute state."
325
+ print(#function, errorMessage)
326
+ reject?(errorMessage, errorMessage, nil)
269
327
  }
270
328
  }
271
329
  }
@@ -287,24 +345,27 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
287
345
  func leave(_ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
288
346
  DispatchQueue.main.async { [weak self] in
289
347
  guard let strongSelf = self else {
290
- print(#function, "Could not find reference to self while executing Room leave")
348
+ let errorMessage = "\(#function): Could not find reference to self while executing Room leave"
349
+ print(#function, errorMessage)
350
+ reject?(errorMessage, errorMessage, nil)
291
351
  return
292
352
  }
293
353
 
294
354
  strongSelf.hms?.leave { [weak self] success, error in
295
355
 
296
356
  guard let strongSelf = self else {
297
- print(#function, "Could not find reference to self when callback is received while executing Room leave")
357
+ let errorMessage = "\(#function): Could not find reference to self when callback is received while executing Room leave"
358
+ print(#function, errorMessage)
359
+ reject?(errorMessage, errorMessage, nil)
298
360
  return
299
361
  }
300
362
 
301
- if success {
363
+ if let nonnilError = error {
364
+ reject?(nonnilError.localizedDescription, nonnilError.localizedDescription, nil)
365
+ } else if success {
302
366
  resolve?(["success": success])
303
367
  strongSelf.cleanup() // resetting states and doing data cleanup
304
368
  } else {
305
- if strongSelf.eventsEnableStatus[HMSConstants.ON_ERROR] == true {
306
- strongSelf.delegate?.emitEvent(HMSConstants.ON_ERROR, ["error": HMSDecoder.getError(error), "id": strongSelf.id])
307
- }
308
369
  reject?("error in leave", "error in leave", nil)
309
370
  }
310
371
  }
@@ -315,7 +376,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
315
376
  guard let message = data.value(forKey: "message") as? String
316
377
  else {
317
378
  let errorMessage = "sendBroadcastMessage: " + HMSHelper.getUnavailableRequiredKey(data, ["message"])
318
- emitRequiredKeysError(errorMessage)
319
379
  reject?(errorMessage, errorMessage, nil)
320
380
  return
321
381
  }
@@ -340,7 +400,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
340
400
  let targetedRoles = data.value(forKey: "roles") as? [String]
341
401
  else {
342
402
  let errorMessage = "sendGroupMessage: " + HMSHelper.getUnavailableRequiredKey(data, ["message", "roles"])
343
- emitRequiredKeysError(errorMessage)
344
403
  reject?(errorMessage, errorMessage, nil)
345
404
  return
346
405
  }
@@ -365,14 +424,14 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
365
424
  let peerId = data.value(forKey: "peerId") as? String
366
425
  else {
367
426
  let errorMessage = "sendDirectMessage: " + HMSHelper.getUnavailableRequiredKey(data, ["message", "peerId"])
368
- emitRequiredKeysError(errorMessage)
369
427
  reject?(errorMessage, errorMessage, nil)
370
428
  return
371
429
  }
372
430
 
373
431
  let type = data.value(forKey: "type") as? String ?? "chat"
374
432
  DispatchQueue.main.async { [weak self] in
375
- guard let peer = HMSHelper.getRemotePeerFromPeerId(peerId, remotePeers: self?.hms?.remotePeers) else { return }
433
+ guard let peer = HMSHelper.getPeerFromPeerId(peerId, remotePeers: self?.hms?.remotePeers) else { return }
434
+
376
435
  self?.hms?.sendDirectMessage(type: type, message: message, peer: peer, completion: { message, error in
377
436
  if error == nil {
378
437
  resolve?(["messageId": message?.messageID ?? "", "data": ["sender": message?.sender?.name ?? "", "message": message?.message ?? "", "type": message?.type]] as [String: Any])
@@ -392,7 +451,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
392
451
  guard let request = self?.recentRoleChangeRequest
393
452
  else {
394
453
  let errorMessage = "acceptRoleChange: recentRoleChangeRequest not found"
395
- self?.emitRequiredKeysError(errorMessage)
396
454
  reject?(errorMessage, errorMessage, nil)
397
455
  return
398
456
  }
@@ -415,7 +473,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
415
473
  let role = data.value(forKey: "role") as? String
416
474
  else {
417
475
  let errorMessage = "changeRole: " + HMSHelper.getUnavailableRequiredKey(data, ["peerId", "role"])
418
- emitRequiredKeysError(errorMessage)
419
476
  reject?(errorMessage, errorMessage, nil)
420
477
  return
421
478
  }
@@ -450,7 +507,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
450
507
  guard let toRoleString = data.object(forKey: "toRole") as? String
451
508
  else {
452
509
  let errorMessage = "changeRolesOfAllPeers: " + HMSHelper.getUnavailableRequiredKey(data, ["toRole"])
453
- emitRequiredKeysError(errorMessage)
454
510
  reject?(errorMessage, errorMessage, nil)
455
511
  return
456
512
  }
@@ -459,7 +515,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
459
515
 
460
516
  guard let toRole = HMSHelper.getRoleFromRoleName(toRoleString, roles: self?.hms?.roles) else {
461
517
  let errorMessage = "changeRolesOfAllPeers: " + HMSHelper.getUnavailableRequiredKey(data, ["toRole"])
462
- self?.emitRequiredKeysError(errorMessage)
463
518
  reject?(errorMessage, errorMessage, nil)
464
519
  return
465
520
  }
@@ -485,7 +540,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
485
540
  guard let trackId = data.value(forKey: "trackId") as? String
486
541
  else {
487
542
  let errorMessage = "changeTrackState: " + HMSHelper.getUnavailableRequiredKey(data, ["trackId"])
488
- emitRequiredKeysError(errorMessage)
489
543
  reject?(errorMessage, errorMessage, nil)
490
544
  return
491
545
  }
@@ -515,7 +569,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
515
569
  guard let mute = data.value(forKey: "mute") as? Bool
516
570
  else {
517
571
  let errorMessage = "changeTrackStateForRoles: " + HMSHelper.getUnavailableRequiredKey(data, ["mute"])
518
- emitRequiredKeysError(errorMessage)
519
572
  reject?(errorMessage, errorMessage, nil)
520
573
  return
521
574
  }
@@ -548,17 +601,16 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
548
601
  guard let trackId = data.value(forKey: "trackId") as? String
549
602
  else {
550
603
  let errorMessage = "isMute: " + HMSHelper.getUnavailableRequiredKey(data, ["trackId"])
551
- emitRequiredKeysError(errorMessage)
552
604
  reject?(errorMessage, errorMessage, nil)
553
605
  return
554
606
  }
555
607
 
556
608
  DispatchQueue.main.async { [weak self] in
557
609
  guard let strongSelf = self else { return }
558
- guard let localPeer = self?.hms?.localPeer,
610
+ guard let localPeer = strongSelf.hms?.localPeer,
559
611
  let localTrack = HMSHelper.getLocalTrackFromTrackId(trackId, localPeer: localPeer)
560
612
  else {
561
- guard let remotePeers = self?.hms?.remotePeers,
613
+ guard let remotePeers = strongSelf.hms?.remotePeers,
562
614
  let track = HMSHelper.getTrackFromTrackId(trackId, remotePeers)
563
615
  else {
564
616
  reject?("Track not found", "Track not found", nil)
@@ -578,29 +630,28 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
578
630
  guard let peerId = data.value(forKey: "peerId") as? String
579
631
  else {
580
632
  let errorMessage = "removePeer: " + HMSHelper.getUnavailableRequiredKey(data, ["peerId"])
581
- emitRequiredKeysError(errorMessage)
582
633
  reject?(errorMessage, errorMessage, nil)
583
634
  return
584
635
  }
585
636
 
586
637
  let reason = data.value(forKey: "reason") as? String
587
638
 
588
- DispatchQueue.main.async { [weak self] in
639
+ HMSHelper.getRemotePeerFromPeerId(peerId, hmsSDK: self.hms) { peer in
589
640
 
590
- guard let remotePeers = self?.hms?.remotePeers,
591
- let peer = HMSHelper.getRemotePeerFromPeerId(peerId, remotePeers: remotePeers)
592
- else {
593
- reject?("PEER_NOT_FOUND", "PEER_NOT_FOUND", nil)
594
- return
595
- }
596
-
597
- self?.hms?.removePeer(peer, reason: reason ?? "Removed from room", completion: { success, error in
598
- if success {
599
- resolve?(["success": success])
600
- } else {
601
- reject?(error?.localizedDescription, error?.localizedDescription, nil)
641
+ DispatchQueue.main.async { [weak self] in
642
+ guard let nonnilPeer = peer else {
643
+ reject?("PEER_NOT_FOUND", "PEER_NOT_FOUND", nil)
644
+ return
602
645
  }
603
- })
646
+
647
+ self?.hms?.removePeer(nonnilPeer, reason: reason ?? "Removed from room", completion: { success, error in
648
+ if success {
649
+ resolve?(["success": success])
650
+ } else {
651
+ reject?(error?.localizedDescription, error?.localizedDescription, nil)
652
+ }
653
+ })
654
+ }
604
655
  }
605
656
  }
606
657
 
@@ -610,7 +661,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
610
661
  let reason = data.value(forKey: "reason") as? String
611
662
  else {
612
663
  let errorMessage = "endRoom: " + HMSHelper.getUnavailableRequiredKey(data, ["lock", "reason"])
613
- emitRequiredKeysError(errorMessage)
614
664
  reject?(errorMessage, errorMessage, nil)
615
665
  return
616
666
  }
@@ -631,7 +681,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
631
681
  guard let trackId = data.value(forKey: "trackId") as? String
632
682
  else {
633
683
  let errorMessage = "isPlaybackAllowed: " + HMSHelper.getUnavailableRequiredKey(data, ["trackId"])
634
- emitRequiredKeysError(errorMessage)
635
684
  reject?(errorMessage, errorMessage, nil)
636
685
  return
637
686
  }
@@ -658,29 +707,35 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
658
707
  }
659
708
  }
660
709
 
661
- func setPlaybackAllowed(_ data: NSDictionary) {
710
+ func setPlaybackAllowed(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
662
711
  guard let trackId = data.value(forKey: "trackId") as? String,
663
712
  let playbackAllowed = data.value(forKey: "playbackAllowed") as? Bool
664
713
  else {
665
714
  let errorMessage = "setPlaybackAllowed: " + HMSHelper.getUnavailableRequiredKey(data, ["trackId", "playbackAllowed"])
666
- emitRequiredKeysError(errorMessage)
715
+ reject?(errorMessage, errorMessage, nil)
667
716
  return
668
717
  }
718
+
669
719
  DispatchQueue.main.async { [weak self] in
670
720
  guard let remotePeers = self?.hms?.remotePeers
671
721
  else {
722
+ let errorMessage = "setPlaybackAllowed: No remote peers found"
723
+ reject?(errorMessage, errorMessage, nil)
672
724
  return
673
725
  }
726
+
674
727
  let remoteAudioTrack = HMSHelper.getRemoteAudioTrackFromTrackId(trackId, remotePeers)
675
728
  let remoteVideoTrack = HMSHelper.getRemoteVideoTrackFromTrackId(trackId, remotePeers)
729
+
676
730
  if remoteAudioTrack != nil {
677
- if playbackAllowed {
678
- remoteAudioTrack?.setPlaybackAllowed(playbackAllowed)
679
- } else {
680
- remoteAudioTrack?.setPlaybackAllowed(playbackAllowed)
681
- }
731
+ remoteAudioTrack?.setPlaybackAllowed(playbackAllowed)
732
+ resolve?(true)
682
733
  } else if remoteVideoTrack != nil {
683
734
  remoteVideoTrack?.setPlaybackAllowed(playbackAllowed)
735
+ resolve?(true)
736
+ } else {
737
+ let errorMessage = "setPlaybackAllowed: No remote audio or video track to set playback"
738
+ reject?(errorMessage, errorMessage, nil)
684
739
  }
685
740
  }
686
741
  }
@@ -689,7 +744,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
689
744
  guard let metadata = data.value(forKey: "metadata") as? String
690
745
  else {
691
746
  let errorMessage = "changeMetadata: " + HMSHelper.getUnavailableRequiredKey(data, ["metadata"])
692
- emitRequiredKeysError(errorMessage)
693
747
  reject?(errorMessage, errorMessage, nil)
694
748
  return
695
749
  }
@@ -705,23 +759,52 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
705
759
  })
706
760
  }
707
761
 
708
- func setVolume(_ data: NSDictionary) {
762
+ func setVolume(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
709
763
  guard let trackId = data.value(forKey: "trackId") as? String,
710
764
  let volume = data.value(forKey: "volume") as? Double
711
765
  else {
712
766
  let errorMessage = "setVolume: " + HMSHelper.getUnavailableRequiredKey(data, ["trackId", "volume"])
713
- emitRequiredKeysError(errorMessage)
767
+ reject?(errorMessage, errorMessage, nil)
714
768
  return
715
769
  }
716
770
 
717
771
  DispatchQueue.main.async { [weak self] in
718
772
  guard let strongSelf = self else { return }
719
- let remotePeers = self?.hms?.remotePeers
773
+ let remotePeers = strongSelf.hms?.remotePeers
720
774
 
721
775
  let remoteAudioTrack = HMSHelper.getRemoteAudioAuxiliaryTrackFromTrackId(trackId, remotePeers)
722
776
 
723
777
  if remoteAudioTrack != nil {
724
778
  remoteAudioTrack?.setVolume(volume)
779
+ resolve?(nil)
780
+ } else {
781
+ let errorMessage = "setVolume: No remote audio track not available"
782
+ reject?(errorMessage, errorMessage, nil)
783
+ }
784
+ }
785
+ }
786
+
787
+ func switchAudioOutput(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
788
+
789
+ guard let audioDevice = data["audioDevice"] as? String else {
790
+ let errorMessage = "\(#function)" + HMSHelper.getUnavailableRequiredKey(data, ["audioDevice"])
791
+ reject?("6004", errorMessage, nil)
792
+ return
793
+ }
794
+
795
+ DispatchQueue.main.async { [weak self] in
796
+ let outputDevice: HMSAudioOutputDevice
797
+ switch audioDevice {
798
+ case "EARPIECE":
799
+ outputDevice = HMSAudioOutputDevice.earpiece
800
+ default:
801
+ outputDevice = HMSAudioOutputDevice.speaker
802
+ }
803
+ do {
804
+ try self?.hms?.switchAudioOutput(to: outputDevice)
805
+ resolve?(nil)
806
+ } catch let error {
807
+ reject?("6004", error.localizedDescription, nil)
725
808
  }
726
809
  }
727
810
  }
@@ -730,7 +813,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
730
813
  guard let record = data.value(forKey: "record") as? Bool
731
814
  else {
732
815
  let errorMessage = "startRTMPOrRecording: " + HMSHelper.getUnavailableRequiredKey(data, ["record"])
733
- emitRequiredKeysError(errorMessage)
734
816
  reject?(errorMessage, errorMessage, nil)
735
817
  return
736
818
  }
@@ -745,6 +827,7 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
745
827
  meetingUrl = meetLink
746
828
  } else {
747
829
  reject?("Invalid meeting url passed", "Invalid meeting url passed", nil)
830
+ return
748
831
  }
749
832
  }
750
833
 
@@ -774,6 +857,8 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
774
857
  })
775
858
  }
776
859
 
860
+ // MARK: - HLS Streaming
861
+
777
862
  func startHLSStreaming(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
778
863
  let recordConfig = HMSHelper.getHlsRecordingConfig(data.value(forKey: "hlsRecordingConfig") as? NSDictionary)
779
864
  let hlsMeetingUrlVariant = HMSHelper.getHMSHLSMeetingURLVariants(data.value(forKey: "meetingURLVariants") as? [[String: Any]])
@@ -805,11 +890,42 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
805
890
  })
806
891
  }
807
892
 
893
+ func sendHLSTimedMetadata(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
894
+ guard let metadataArrayList = data["metadata"] as? [NSDictionary] else {
895
+ let errorMessage = "\(#function) metadata for sendHLSTimedMetadata was not found"
896
+ reject?("6004", errorMessage, nil)
897
+ return
898
+ }
899
+
900
+ let metadata = metadataArrayList.compactMap { (dict: NSDictionary) -> HMSHLSTimedMetadata? in
901
+ guard let payload = dict["payload"] as? String else {
902
+ return nil
903
+ }
904
+ if let duration = dict["duration"] as? Int {
905
+ return HMSHLSTimedMetadata(payload: payload, duration: duration)
906
+ } else {
907
+ return HMSHLSTimedMetadata(payload: payload)
908
+ }
909
+ }
910
+
911
+ DispatchQueue.main.async { [weak self] in
912
+ self?.hms?.sendHLSTimedMetadata(metadata) { success, error in
913
+ if let error = error as? HMSError {
914
+ print(#function, "Unable to send metadata: \(error)")
915
+ reject?("6004", error.localizedDescription, nil)
916
+ }
917
+
918
+ resolve?(success)
919
+ }
920
+ }
921
+ }
922
+
923
+ // MARK: -
924
+
808
925
  func changeName(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
809
926
  guard let name = data.value(forKey: "name") as? String
810
927
  else {
811
928
  let errorMessage = "changeName: " + HMSHelper.getUnavailableRequiredKey(data, ["name"])
812
- emitRequiredKeysError(errorMessage)
813
929
  reject?(errorMessage, errorMessage, nil)
814
930
  return
815
931
  }
@@ -841,18 +957,29 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
841
957
  }
842
958
  }
843
959
 
844
- func setPlaybackForAllAudio(_ data: NSDictionary) {
960
+ func setPlaybackForAllAudio(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
845
961
  guard let mute = data.value(forKey: "mute") as? Bool
846
962
  else {
847
- let errorMessage = "setPlaybackForAllAudio: " + HMSHelper.getUnavailableRequiredKey(data, ["setPlaybackForAllAudio"])
848
- emitRequiredKeysError(errorMessage)
963
+ let errorMessage = "setPlaybackForAllAudio: " + HMSHelper.getUnavailableRequiredKey(data, ["mute"])
964
+ reject?(errorMessage, errorMessage, nil)
849
965
  return
850
966
  }
851
967
 
852
968
  DispatchQueue.main.async { [weak self] in
853
- let remotePeers = self?.hms?.remotePeers
854
- for peer in remotePeers ?? [] {
855
- peer.remoteAudioTrack()?.setPlaybackAllowed(!mute)
969
+ if let self = self, let room = self.hms?.room {
970
+ self.roomMutedLocally = mute
971
+
972
+ let audioTracks = HMSUtilities.getAllAudioTracks(in: room)
973
+
974
+ audioTracks.forEach { audioTrack in
975
+ if audioTrack is HMSRemoteAudioTrack {
976
+ (audioTrack as! HMSRemoteAudioTrack).setPlaybackAllowed(!mute)
977
+ }
978
+ }
979
+ resolve?(true)
980
+ } else {
981
+ let errorMessage = "setPlaybackForAllAudio: HMSSDK instance not available"
982
+ reject?(errorMessage, errorMessage, nil)
856
983
  }
857
984
  }
858
985
  }
@@ -930,7 +1057,7 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
930
1057
  return
931
1058
  }
932
1059
 
933
- guard let remotePeer = HMSHelper.getRemotePeerFromPeerId(peerId, remotePeers: self.hms?.remotePeers) else {
1060
+ guard let remotePeer = HMSHelper.getPeerFromPeerId(peerId, remotePeers: self.hms?.remotePeers) else {
934
1061
  let errorMessage = "lowerRemotePeerHand: Could not find remote peer with peerID - " + peerId
935
1062
  reject?(errorMessage, errorMessage, nil)
936
1063
  return
@@ -952,7 +1079,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
952
1079
  let playerNode = audioMixerSourceMap[audioNodeName]
953
1080
  else {
954
1081
  let errorMessage = "playAudioShare: " + HMSHelper.getUnavailableRequiredKey(data, ["audioNode", "fileUrl"])
955
- emitRequiredKeysError(errorMessage)
956
1082
  reject?(errorMessage, errorMessage, nil)
957
1083
  return
958
1084
  }
@@ -974,14 +1100,14 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
974
1100
  }
975
1101
  }
976
1102
 
977
- func setAudioShareVolume(_ data: NSDictionary) {
1103
+ func setAudioShareVolume(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
978
1104
  guard let volume = data.value(forKey: "volume") as? NSNumber,
979
1105
  let audioNodeName = data.value(forKey: "audioNode") as? String,
980
1106
  let audioMixerSourceMap = HMSHelper.getAudioMixerSourceMap(),
981
1107
  let playerNode = audioMixerSourceMap[audioNodeName]
982
1108
  else {
983
1109
  let errorMessage = "setAudioShareVolume: " + HMSHelper.getUnavailableRequiredKey(data, ["audioNode", "volume"])
984
- emitRequiredKeysError(errorMessage)
1110
+ reject?(errorMessage, errorMessage, nil)
985
1111
  return
986
1112
  }
987
1113
  if let audioMicNode = playerNode as? HMSMicNode {
@@ -990,53 +1116,64 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
990
1116
  if let audioFilePlayerNode = playerNode as? HMSAudioFilePlayerNode {
991
1117
  audioFilePlayerNode.volume = volume.floatValue
992
1118
  }
1119
+ resolve?(true)
993
1120
  }
994
1121
 
995
- func stopAudioShare(_ data: NSDictionary) {
1122
+ func stopAudioShare(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
996
1123
  guard let audioNodeName = data.value(forKey: "audioNode") as? String,
997
1124
  let audioMixerSourceMap = HMSHelper.getAudioMixerSourceMap(),
998
1125
  let playerNode = audioMixerSourceMap[audioNodeName]
999
1126
  else {
1000
1127
  let errorMessage = "stopAudioShare: " + HMSHelper.getUnavailableRequiredKey(data, ["audioNode"])
1001
- emitRequiredKeysError(errorMessage)
1128
+ reject?(errorMessage, errorMessage, nil)
1002
1129
  return
1003
1130
  }
1004
1131
  if let audioFilePlayerNode = playerNode as? HMSAudioFilePlayerNode {
1005
1132
  audioFilePlayerNode.stop()
1133
+ resolve?(true)
1134
+ } else {
1135
+ let errorMessage = "stopAudioShare: HMSAudioFilePlayerNode not available!"
1136
+ reject?(errorMessage, errorMessage, nil)
1006
1137
  }
1007
1138
  }
1008
1139
 
1009
- func resumeAudioShare(_ data: NSDictionary) {
1140
+ func resumeAudioShare(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
1010
1141
  guard let audioNodeName = data.value(forKey: "audioNode") as? String,
1011
1142
  let audioMixerSourceMap = HMSHelper.getAudioMixerSourceMap(),
1012
1143
  let playerNode = audioMixerSourceMap[audioNodeName]
1013
1144
  else {
1014
1145
  let errorMessage = "resumeAudioShare: " + HMSHelper.getUnavailableRequiredKey(data, ["audioNode"])
1015
- emitRequiredKeysError(errorMessage)
1146
+ reject?(errorMessage, errorMessage, nil)
1016
1147
  return
1017
1148
  }
1018
1149
  if let audioFilePlayerNode = playerNode as? HMSAudioFilePlayerNode {
1019
1150
  do {
1020
1151
  try audioFilePlayerNode.resume()
1152
+ resolve?(true)
1021
1153
  } catch {
1022
- if eventsEnableStatus[HMSConstants.ON_ERROR] == true {
1023
- delegate?.emitEvent(HMSConstants.ON_ERROR, ["error": ["code": 6002, "description": error.localizedDescription, "isTerminal": false, "canRetry": true, "params": ["function": #function]] as [String: Any], "id": id])
1024
- }
1154
+ reject?(error.localizedDescription, error.localizedDescription, nil)
1025
1155
  }
1156
+ } else {
1157
+ let errorMessage = "resumeAudioShare: HMSAudioFilePlayerNode not available!"
1158
+ reject?(errorMessage, errorMessage, nil)
1026
1159
  }
1027
1160
  }
1028
1161
 
1029
- func pauseAudioShare(_ data: NSDictionary) {
1162
+ func pauseAudioShare(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
1030
1163
  guard let audioNodeName = data.value(forKey: "audioNode") as? String,
1031
1164
  let audioMixerSourceMap = HMSHelper.getAudioMixerSourceMap(),
1032
1165
  let playerNode = audioMixerSourceMap[audioNodeName]
1033
1166
  else {
1034
1167
  let errorMessage = "pauseAudioShare: " + HMSHelper.getUnavailableRequiredKey(data, ["audioNode"])
1035
- emitRequiredKeysError(errorMessage)
1168
+ reject?(errorMessage, errorMessage, nil)
1036
1169
  return
1037
1170
  }
1038
1171
  if let audioFilePlayerNode = playerNode as? HMSAudioFilePlayerNode {
1039
1172
  audioFilePlayerNode.pause()
1173
+ resolve?(true)
1174
+ } else {
1175
+ let errorMessage = "pauseAudioShare: HMSAudioFilePlayerNode not available!"
1176
+ reject?(errorMessage, errorMessage, nil)
1040
1177
  }
1041
1178
  }
1042
1179
 
@@ -1046,7 +1183,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1046
1183
  let playerNode = audioMixerSourceMap[audioNodeName]
1047
1184
  else {
1048
1185
  let errorMessage = "pauseAudioShare: " + HMSHelper.getUnavailableRequiredKey(data, ["audioNode"])
1049
- emitRequiredKeysError(errorMessage)
1050
1186
  reject?(errorMessage, errorMessage, nil)
1051
1187
  return
1052
1188
  }
@@ -1063,7 +1199,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1063
1199
  let playerNode = audioMixerSourceMap[audioNodeName]
1064
1200
  else {
1065
1201
  let errorMessage = "pauseAudioShare: " + HMSHelper.getUnavailableRequiredKey(data, ["audioNode"])
1066
- emitRequiredKeysError(errorMessage)
1067
1202
  reject?(errorMessage, errorMessage, nil)
1068
1203
  return
1069
1204
  }
@@ -1080,7 +1215,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1080
1215
  let playerNode = audioMixerSourceMap[audioNodeName]
1081
1216
  else {
1082
1217
  let errorMessage = "pauseAudioShare: " + HMSHelper.getUnavailableRequiredKey(data, ["audioNode"])
1083
- emitRequiredKeysError(errorMessage)
1084
1218
  reject?(errorMessage, errorMessage, nil)
1085
1219
  return
1086
1220
  }
@@ -1102,7 +1236,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1102
1236
  func enableEvent(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
1103
1237
  guard let eventType = data.value(forKey: "eventType") as? String else {
1104
1238
  let errorMessage = "enableEvent: " + HMSHelper.getUnavailableRequiredKey(data, ["eventType"])
1105
- emitRequiredKeysError(errorMessage)
1106
1239
  reject?(errorMessage, errorMessage, nil)
1107
1240
  return
1108
1241
  }
@@ -1114,7 +1247,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1114
1247
  func disableEvent(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
1115
1248
  guard let eventType = data.value(forKey: "eventType") as? String else {
1116
1249
  let errorMessage = "disableEvent: " + HMSHelper.getUnavailableRequiredKey(data, ["eventType"])
1117
- emitRequiredKeysError(errorMessage)
1118
1250
  reject?(errorMessage, errorMessage, nil)
1119
1251
  return
1120
1252
  }
@@ -1123,14 +1255,15 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1123
1255
  resolve?(["success": true, "message": "function call executed successfully"] as [String: Any])
1124
1256
  }
1125
1257
 
1126
- func restrictData(_ data: NSDictionary) {
1258
+ func restrictData(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
1127
1259
  guard let roleName = data.value(forKey: "roleName") as? String else {
1128
1260
  let errorMessage = "restrictData: " + HMSHelper.getUnavailableRequiredKey(data, ["roleName"])
1129
- emitRequiredKeysError(errorMessage)
1261
+ reject?(errorMessage, errorMessage, nil)
1130
1262
  return
1131
1263
  }
1132
1264
 
1133
1265
  HMSDecoder.setRestrictRoleData(roleName, true)
1266
+ resolve?(true)
1134
1267
  }
1135
1268
 
1136
1269
  // MARK: - HMS SDK Get APIs
@@ -1176,6 +1309,8 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1176
1309
  return ["name": peer.name]
1177
1310
  case "isLocal":
1178
1311
  return ["isLocal": peer.isLocal]
1312
+ case "type":
1313
+ return ["type": HMSDecoder.getPeerType(type: peer.type)]
1179
1314
  case "networkQuality":
1180
1315
  if peer.networkQuality != nil {
1181
1316
  return ["networkQuality": HMSDecoder.getHmsNetworkQuality(peer.networkQuality)]
@@ -1246,13 +1381,13 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1246
1381
  return ["localPeer": HMSDecoder.getHmsLocalPeer(hms?.localPeer)]
1247
1382
 
1248
1383
  case "browserRecordingState":
1249
- return ["browserRecordingState": HMSDecoder.getHMSBrowserRecordingState(hmsRoom.browserRecordingState)]
1384
+ return ["browserRecordingState": HMSDecoder.getBrowserRecordingState(hmsRoom.browserRecordingState)]
1250
1385
 
1251
1386
  case "rtmpHMSRtmpStreamingState":
1252
- return ["rtmpHMSRtmpStreamingState": HMSDecoder.getHMSRtmpStreamingState(hmsRoom.rtmpStreamingState)]
1387
+ return ["rtmpHMSRtmpStreamingState": HMSDecoder.getRtmpStreamingState(hmsRoom.rtmpStreamingState)]
1253
1388
 
1254
1389
  case "serverRecordingState":
1255
- return ["serverRecordingState": HMSDecoder.getHMSServerRecordingState(hmsRoom.serverRecordingState)]
1390
+ return ["serverRecordingState": HMSDecoder.getServerRecordingState(hmsRoom.serverRecordingState)]
1256
1391
 
1257
1392
  case "hlsStreamingState":
1258
1393
  return ["hlsStreamingState": HMSDecoder.getHlsStreamingState(hmsRoom.hlsStreamingState)]
@@ -1260,6 +1395,12 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1260
1395
  case "hlsRecordingState":
1261
1396
  return ["hlsRecordingState": HMSDecoder.getHlsRecordingState(hmsRoom.hlsRecordingState)]
1262
1397
 
1398
+ case "isLargeRoom":
1399
+ return ["isLargeRoom": hmsRoom.isLarge]
1400
+
1401
+ case "transcriptions":
1402
+ return ["transcriptions": HMSDecoder.getTranscriptionStates(hmsRoom.transcriptionStates)]
1403
+
1263
1404
  default:
1264
1405
  return nil
1265
1406
  }
@@ -1270,7 +1411,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1270
1411
  guard let trackId = data.value(forKey: "trackId") as? String
1271
1412
  else {
1272
1413
  let errorMessage = "\(#function) " + HMSHelper.getUnavailableRequiredKey(data, ["trackId"])
1273
- emitRequiredKeysError(errorMessage)
1274
1414
  reject?(errorMessage, errorMessage, nil)
1275
1415
  return
1276
1416
  }
@@ -1282,7 +1422,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1282
1422
  let remoteVideoTrack = HMSHelper.getRemoteVideoTrackFromTrackId(trackId, remotePeers)
1283
1423
  else {
1284
1424
  let errorMessage = "\(#function) " + "TRACK_NOT_FOUND"
1285
- self?.emitRequiredKeysError(errorMessage)
1286
1425
  reject?(errorMessage, errorMessage, nil)
1287
1426
  return
1288
1427
  }
@@ -1295,7 +1434,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1295
1434
  guard let trackId = data.value(forKey: "trackId") as? String
1296
1435
  else {
1297
1436
  let errorMessage = "\(#function) " + HMSHelper.getUnavailableRequiredKey(data, ["trackId"])
1298
- emitRequiredKeysError(errorMessage)
1299
1437
  reject?(errorMessage, errorMessage, nil)
1300
1438
  return
1301
1439
  }
@@ -1307,7 +1445,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1307
1445
  let remoteAudioTrack = HMSHelper.getRemoteAudioTrackFromTrackId(trackId, remotePeers)
1308
1446
  else {
1309
1447
  let errorMessage = "\(#function) " + "TRACK_NOT_FOUND"
1310
- self?.emitRequiredKeysError(errorMessage)
1311
1448
  reject?(errorMessage, errorMessage, nil)
1312
1449
  return
1313
1450
  }
@@ -1393,6 +1530,26 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1393
1530
  }
1394
1531
  }
1395
1532
 
1533
+ if roomMutedLocally && update == .trackAdded && track.kind == .audio && !peer.isLocal, let room = self.hms?.room {
1534
+ if let audioTrack = HMSUtilities.getAudioTrack(for: track.trackId, in: room) {
1535
+ if audioTrack is HMSRemoteAudioTrack {
1536
+ (audioTrack as! HMSRemoteAudioTrack).setPlaybackAllowed(!roomMutedLocally)
1537
+ }
1538
+ }
1539
+ }
1540
+
1541
+ if #available(iOS 15.0, *),
1542
+ useActiveSpeakerInPIP,
1543
+ let controller = pipController,
1544
+ controller.isPictureInPictureActive,
1545
+ track.kind == .video,
1546
+ update == .trackRemoved,
1547
+ pipModel?.track == track {
1548
+
1549
+ pipModel?.text = hms?.localPeer?.name
1550
+ pipModel?.track = nil
1551
+ }
1552
+
1396
1553
  if eventsEnableStatus[HMSConstants.ON_TRACK_UPDATE] != true {
1397
1554
  return
1398
1555
  }
@@ -1420,6 +1577,35 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1420
1577
  }
1421
1578
 
1422
1579
  func on(updated speakers: [HMSSpeaker]) {
1580
+
1581
+ if #available(iOS 15.0, *),
1582
+ useActiveSpeakerInPIP,
1583
+ let controller = pipController,
1584
+ controller.isPictureInPictureActive,
1585
+ let peer = speakers.first?.peer,
1586
+ let track = peer.videoTrack {
1587
+
1588
+ if track.isMute() {
1589
+ pipModel?.text = peer.name
1590
+ pipModel?.track = nil
1591
+ } else {
1592
+ if peer.isLocal {
1593
+ if #available(iOS 16.0, *) {
1594
+ if AVCaptureSession().isMultitaskingCameraAccessSupported {
1595
+ pipModel?.text = nil
1596
+ pipModel?.track = track
1597
+ return
1598
+ }
1599
+ }
1600
+ pipModel?.text = peer.name
1601
+ pipModel?.track = nil
1602
+ } else {
1603
+ pipModel?.text = nil
1604
+ pipModel?.track = track
1605
+ }
1606
+ }
1607
+ }
1608
+
1423
1609
  if eventsEnableStatus[HMSConstants.ON_SPEAKER] != true {
1424
1610
  return
1425
1611
  }
@@ -1545,13 +1731,21 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1545
1731
  self.delegate?.emitEvent(HMSConstants.ON_REMOTE_VIDEO_STATS, ["remoteVideoStats": remoteStats, "track": remoteTrack, "peer": decodedPeer, "id": self.id])
1546
1732
  }
1547
1733
 
1734
+ func on(transcripts: HMSTranscripts) {
1735
+ if eventsEnableStatus[HMSConstants.ON_TRANSCRIPTS] != true {
1736
+ return
1737
+ }
1738
+ let transcriptsArray = HMSDecoder.getHmsTranscripts(transcripts.transcripts)
1739
+
1740
+ self.delegate?.emitEvent(HMSConstants.ON_TRANSCRIPTS, ["id": self.id, "transcripts": transcriptsArray])
1741
+ }
1742
+
1548
1743
  // MARK: - Simulcast
1549
1744
 
1550
1745
  func getVideoTrackLayerDefinition(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
1551
1746
  guard let trackId = data.value(forKey: "trackId") as? String
1552
1747
  else {
1553
1748
  let errorMessage = "\(#function) " + HMSHelper.getUnavailableRequiredKey(data, ["trackId"])
1554
- emitRequiredKeysError(errorMessage)
1555
1749
  reject?(errorMessage, errorMessage, nil)
1556
1750
  return
1557
1751
  }
@@ -1563,7 +1757,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1563
1757
  let remoteVideoTrack = HMSHelper.getRemoteVideoTrackFromTrackId(trackId, remotePeers)
1564
1758
  else {
1565
1759
  let errorMessage = "\(#function) " + "TRACK_NOT_FOUND"
1566
- self?.emitRequiredKeysError(errorMessage)
1567
1760
  reject?(errorMessage, errorMessage, nil)
1568
1761
  return
1569
1762
  }
@@ -1571,7 +1764,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1571
1764
  guard let layerDefinitions = remoteVideoTrack.layerDefinitions
1572
1765
  else {
1573
1766
  let errorMessage = "\(#function) " + "layer definitions not available for track: '\(trackId)' !"
1574
- self.emitRequiredKeysError(errorMessage)
1575
1767
  reject?(errorMessage, errorMessage, nil)
1576
1768
  return
1577
1769
  }
@@ -1587,7 +1779,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1587
1779
  guard let trackId = data.value(forKey: "trackId") as? String
1588
1780
  else {
1589
1781
  let errorMessage = "\(#function) " + HMSHelper.getUnavailableRequiredKey(data, ["trackId"])
1590
- emitRequiredKeysError(errorMessage)
1591
1782
  reject?(errorMessage, errorMessage, nil)
1592
1783
  return
1593
1784
  }
@@ -1599,7 +1790,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1599
1790
  let remoteVideoTrack = HMSHelper.getRemoteVideoTrackFromTrackId(trackId, remotePeers)
1600
1791
  else {
1601
1792
  let errorMessage = "\(#function) " + "TRACK_NOT_FOUND"
1602
- self?.emitRequiredKeysError(errorMessage)
1603
1793
  reject?(errorMessage, errorMessage, nil)
1604
1794
  return
1605
1795
  }
@@ -1615,7 +1805,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1615
1805
  let layer = data.value(forKey: "layer") as? String
1616
1806
  else {
1617
1807
  let errorMessage = "\(#function) " + HMSHelper.getUnavailableRequiredKey(data, ["trackId", "layer"])
1618
- emitRequiredKeysError(errorMessage)
1619
1808
  reject?(errorMessage, errorMessage, nil)
1620
1809
  return
1621
1810
  }
@@ -1627,7 +1816,6 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1627
1816
  let remoteVideoTrack = HMSHelper.getRemoteVideoTrackFromTrackId(trackId, remotePeers)
1628
1817
  else {
1629
1818
  let errorMessage = "\(#function) " + "TRACK_NOT_FOUND"
1630
- self?.emitRequiredKeysError(errorMessage)
1631
1819
  reject?(errorMessage, errorMessage, nil)
1632
1820
  return
1633
1821
  }
@@ -1724,15 +1912,22 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1724
1912
  return
1725
1913
  }
1726
1914
 
1727
- if let value = value {
1728
- if let stringValue = value as? String {
1729
- resolve?(stringValue)
1730
- } else {
1731
- let errorMessage = "\(#function) Session Store value for the key: \(key) is not of String Type. Value: \(value)"
1732
- reject?("6004", errorMessage, nil)
1733
- }
1734
- } else {
1915
+ switch value {
1916
+ case .none:
1735
1917
  resolve?(nil)
1918
+ case let boolValue as Bool:
1919
+ resolve?(boolValue)
1920
+ case let doubleValue as Double:
1921
+ resolve?(doubleValue)
1922
+ case let dictValue as [AnyHashable: Any]:
1923
+ resolve?(dictValue)
1924
+ case let arrayValue as [Any]:
1925
+ resolve?(arrayValue)
1926
+ case let stringValue as String:
1927
+ resolve?(stringValue)
1928
+ default:
1929
+ let errorMessage = "\(#function) Session Store value for the key: \(key) is not of valid type. Value: \(String(describing: value))"
1930
+ reject?("6004", errorMessage, nil)
1736
1931
  }
1737
1932
  }
1738
1933
  }
@@ -1759,14 +1954,13 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1759
1954
 
1760
1955
  let valueToBeSet = data["value"] as Any
1761
1956
 
1762
- store.set(valueToBeSet, forKey: key) { value, error in
1957
+ store.set(valueToBeSet, forKey: key) { _, error in
1763
1958
 
1764
1959
  if let error = error {
1765
- let errorMessage = "\(#function) Error in setting value: \(valueToBeSet) for key: \(key) to the Session Store. Error: \(error.localizedDescription)"
1766
- reject?("6004", errorMessage, nil)
1960
+ reject?("6004", error.localizedDescription, nil)
1767
1961
  return
1768
1962
  }
1769
- resolve?(["success": true, "finalValue": value])
1963
+ resolve?(["success": true])
1770
1964
  }
1771
1965
  }
1772
1966
  }
@@ -1811,13 +2005,23 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1811
2005
 
1812
2006
  data["key"] = key
1813
2007
 
1814
- if let value = value {
1815
- if let stringValue = value as? String {
1816
- data["value"] = stringValue
1817
- } else {
1818
- let errorMessage = "\(#function) Session Store value for the key: \(key) is not of String Type. Value: \(value)"
1819
- print(errorMessage)
1820
- }
2008
+ switch value {
2009
+ case .none:
2010
+ data["value"] = nil
2011
+ case let boolValue as Bool:
2012
+ data["value"] = boolValue
2013
+ case let doubleValue as Double:
2014
+ data["value"] = doubleValue
2015
+ case let dictValue as [AnyHashable: Any]:
2016
+ data["value"] = dictValue
2017
+ case let arrayValue as [Any]:
2018
+ data["value"] = arrayValue
2019
+ case let stringValue as String:
2020
+ data["value"] = stringValue
2021
+ default:
2022
+ let message = "\(#function) Session Store value for the key: \(key) is not of valid type. Value: \(String(describing: value))"
2023
+ print(message)
2024
+ data["value"] = nil
1821
2025
  }
1822
2026
  self?.delegate?.emitEvent(HMSConstants.ON_SESSION_STORE_CHANGED, data)
1823
2027
 
@@ -1890,6 +2094,552 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1890
2094
  }
1891
2095
  }
1892
2096
 
2097
+ // MARK: - Peer List Iterator
2098
+
2099
+ func getPeerListIterator(_ data: NSDictionary) -> [AnyHashable: Any]? {
2100
+ guard let uniqueId = data["uniqueId"] as? String else {
2101
+ print("Error in getPeerListIterator: uniqueId is not available")
2102
+ return nil
2103
+ }
2104
+
2105
+ guard let hmssdk = hms else {
2106
+ print("Error in getPeerListIterator: HMSSDK is not available")
2107
+ return nil
2108
+ }
2109
+
2110
+ var peerListIterator: HMSPeerListIterator
2111
+
2112
+ if let peerListIteratorOptions = HMSHelper.getPeerListIteratorOptions(data) {
2113
+ peerListIterator = hmssdk.getPeerListIterator(options: peerListIteratorOptions)
2114
+ } else {
2115
+ peerListIterator = hmssdk.getPeerListIterator()
2116
+ }
2117
+
2118
+ peerListIterators[uniqueId] = peerListIterator
2119
+
2120
+ return [
2121
+ "success": true,
2122
+ "uniqueId": uniqueId,
2123
+ "totalCount": peerListIterator.totalCount
2124
+ ]
2125
+ }
2126
+
2127
+ func peerListIteratorHasNext(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
2128
+ guard let uniqueId = data["uniqueId"] as? String else {
2129
+ let errorMessage = "\(#function) uniqueId is not available"
2130
+ reject?("6004", errorMessage, nil)
2131
+ return
2132
+ }
2133
+
2134
+ guard let peerListIterator = peerListIterators[uniqueId] else {
2135
+ let errorMessage = "\(#function) HMSPeerListIterator is not available for uniqueId - \(uniqueId)"
2136
+ reject?("6004", errorMessage, nil)
2137
+ return
2138
+ }
2139
+
2140
+ resolve?(peerListIterator.hasNext)
2141
+ }
2142
+
2143
+ func peerListIteratorNext(_ data: NSDictionary, _ resolve: RCTPromiseResolveBlock?, _ reject: RCTPromiseRejectBlock?) {
2144
+ guard let uniqueId = data["uniqueId"] as? String else {
2145
+ let errorMessage = "\(#function) uniqueId is not available"
2146
+ reject?("6004", errorMessage, nil)
2147
+ return
2148
+ }
2149
+
2150
+ guard let peerListIterator = peerListIterators[uniqueId] else {
2151
+ let errorMessage = "\(#function) HMSPeerListIterator is not available for uniqueId - \(uniqueId)"
2152
+ reject?("6004", errorMessage, nil)
2153
+ return
2154
+ }
2155
+
2156
+ peerListIterator.next { peers, error in
2157
+ if let nonnilError = error {
2158
+ reject?("6004", nonnilError.localizedDescription, nil)
2159
+ return
2160
+ }
2161
+
2162
+ if let nonnilPeers = peers {
2163
+ var data = [[String: Any]]()
2164
+ for peer in nonnilPeers {
2165
+ data.append(HMSDecoder.getHmsPeer(peer))
2166
+ }
2167
+ resolve?(["totalCount": peerListIterator.totalCount, "peers": data])
2168
+ } else {
2169
+ let errorMessage = "\(#function) peers is nil"
2170
+ reject?("6004", errorMessage, nil)
2171
+ }
2172
+ }
2173
+ }
2174
+
2175
+ // MARK: - Noise Cancellation Plugin Functions
2176
+
2177
+ func enableNoiseCancellationPlugin(_ data: NSDictionary,
2178
+ _ resolve: RCTPromiseResolveBlock?,
2179
+ _ reject: RCTPromiseRejectBlock?) {
2180
+
2181
+ guard let noiseCancellationPlugin = self.noiseCancellationPlugin else {
2182
+ let errorMessage = "\(#function) noiseCancellationPlugin instance is not available!"
2183
+ reject?("6004", errorMessage, nil)
2184
+ return
2185
+ }
2186
+ do {
2187
+ try noiseCancellationPlugin.enable()
2188
+ resolve?(true)
2189
+ } catch {
2190
+ reject?("6004", error.localizedDescription, nil)
2191
+ }
2192
+ }
2193
+
2194
+ func disableNoiseCancellationPlugin(_ data: NSDictionary,
2195
+ _ resolve: RCTPromiseResolveBlock?,
2196
+ _ reject: RCTPromiseRejectBlock?) {
2197
+
2198
+ guard let noiseCancellationPlugin = self.noiseCancellationPlugin else {
2199
+ let errorMessage = "\(#function) noiseCancellationPlugin instance is not available!"
2200
+ reject?("6004", errorMessage, nil)
2201
+ return
2202
+ }
2203
+ do {
2204
+ try noiseCancellationPlugin.disable()
2205
+ resolve?(true)
2206
+ } catch {
2207
+ reject?("6004", error.localizedDescription, nil)
2208
+ }
2209
+ }
2210
+
2211
+ func isNoiseCancellationPluginEnabled(_ data: NSDictionary,
2212
+ _ resolve: RCTPromiseResolveBlock?,
2213
+ _ reject: RCTPromiseRejectBlock?) {
2214
+
2215
+ guard let noiseCancellationPlugin = self.noiseCancellationPlugin else {
2216
+ let errorMessage = "\(#function) noiseCancellationPlugin instance is not available!"
2217
+ reject?("6004", errorMessage, nil)
2218
+ return
2219
+ }
2220
+ let isEnabled = noiseCancellationPlugin.isEnabled()
2221
+ resolve?(isEnabled)
2222
+ }
2223
+
2224
+ func isNoiseCancellationPluginAvailable(_ data: NSDictionary,
2225
+ _ resolve: RCTPromiseResolveBlock?,
2226
+ _ reject: RCTPromiseRejectBlock?) {
2227
+
2228
+ guard let noiseCancellationPlugin = self.noiseCancellationPlugin else {
2229
+ let errorMessage = "\(#function) noiseCancellationPlugin instance is not available!"
2230
+ reject?("6004", errorMessage, nil)
2231
+ return
2232
+ }
2233
+ let isAvailable = noiseCancellationPlugin.isNoiseCancellationAvailable
2234
+ resolve?(isAvailable)
2235
+ }
2236
+
2237
+ // MARK: - Video Plugins Functions
2238
+
2239
+ func enableVideoPlugin(_ data: NSDictionary,
2240
+ _ resolve: RCTPromiseResolveBlock?,
2241
+ _ reject: RCTPromiseRejectBlock?) {
2242
+ guard let videoPluginType = data.value(forKey: "type") as? String else {
2243
+ let errorMessage = "\(#function) HMSVideoPlugin type not passed!"
2244
+ reject?("6004", errorMessage, nil)
2245
+ return
2246
+ }
2247
+ switch videoPluginType {
2248
+ case "HMSVirtualBackgroundPlugin":
2249
+ if #available(iOS 15.0, *) {
2250
+ guard let virtualBackgroundPlugin = self.virtualBackgroundPlugin as? HMSVirtualBackgroundPlugin else {
2251
+ let errorMessage = "\(#function) Unable to cast `var virtualBackgroundPlugin` to type `HMSVirtualBackgroundPlugin`, It is \(String(describing: virtualBackgroundPlugin))"
2252
+ reject?("6004", errorMessage, nil)
2253
+ return
2254
+ }
2255
+ virtualBackgroundPlugin.activate()
2256
+ resolve?(true)
2257
+ } else {
2258
+ let errorMessage = "\(#function) HMSVirtualBackgroundPlugin not available below iOS 15.0"
2259
+ reject?("6004", errorMessage, nil)
2260
+ return
2261
+ }
2262
+ case "HMSVideoFilterPlugin":
2263
+ guard let videoFilterPlugin = self.videoFilterPlugin else {
2264
+ let errorMessage = "\(#function) `videoFilterPlugin` is `nil`, Make sure you are passing `HMSVideoFilterPlugin` instance to `videoTrackSettings` in `HMSSDK.build`"
2265
+ reject?("6004", errorMessage, nil)
2266
+ return
2267
+ }
2268
+ videoFilterPlugin.activate()
2269
+ resolve?(true)
2270
+ default:
2271
+ let errorMessage = "\(#function) Unknown HMSVideoPlugin type passed!"
2272
+ reject?("6004", errorMessage, nil)
2273
+ return
2274
+ }
2275
+ }
2276
+
2277
+ func disableVideoPlugin(_ data: NSDictionary,
2278
+ _ resolve: RCTPromiseResolveBlock?,
2279
+ _ reject: RCTPromiseRejectBlock?) {
2280
+ guard let videoPluginType = data.value(forKey: "type") as? String else {
2281
+ let errorMessage = "\(#function) HMSVideoPlugin `type` not passed!"
2282
+ reject?("6004", errorMessage, nil)
2283
+ return
2284
+ }
2285
+ switch videoPluginType {
2286
+ case "HMSVirtualBackgroundPlugin":
2287
+ if #available(iOS 15.0, *) {
2288
+ guard let virtualBackgroundPlugin = self.virtualBackgroundPlugin as? HMSVirtualBackgroundPlugin else {
2289
+ let errorMessage = "\(#function) Unable to cast `var virtualBackgroundPlugin` to type `HMSVirtualBackgroundPlugin`, It is \(String(describing: virtualBackgroundPlugin))"
2290
+ reject?("6004", errorMessage, nil)
2291
+ return
2292
+ }
2293
+ virtualBackgroundPlugin.deactivate()
2294
+ resolve?(true)
2295
+ } else {
2296
+ let errorMessage = "\(#function) HMSVirtualBackgroundPlugin not available below iOS 15.0"
2297
+ reject?("6004", errorMessage, nil)
2298
+ return
2299
+ }
2300
+ case "HMSVideoFilterPlugin":
2301
+ guard let videoFilterPlugin = self.videoFilterPlugin else {
2302
+ let errorMessage = "\(#function) `videoFilterPlugin` is `nil`, Make sure you are passing `HMSVideoFilterPlugin` instance to `videoTrackSettings` in `HMSSDK.build`"
2303
+ reject?("6004", errorMessage, nil)
2304
+ return
2305
+ }
2306
+ videoFilterPlugin.deactivate()
2307
+ resolve?(true)
2308
+ default:
2309
+ let errorMessage = "\(#function) Unknown HMSVideoPlugin `type` passed!"
2310
+ reject?("6004", errorMessage, nil)
2311
+ return
2312
+ }
2313
+ }
2314
+
2315
+ func changeVirtualBackground(_ data: NSDictionary,
2316
+ _ resolve: RCTPromiseResolveBlock?,
2317
+ _ reject: RCTPromiseRejectBlock?) {
2318
+ if #available(iOS 15.0, *) {
2319
+ guard let backgroundDict = data.value(forKey: "background") as? NSDictionary
2320
+ else {
2321
+ let errorMessage = "\(#function) No background object passed!"
2322
+ reject?("6004", errorMessage, nil)
2323
+ return
2324
+ }
2325
+ guard let backgroundType = backgroundDict.value(forKey: "type") as? String
2326
+ else {
2327
+ let errorMessage = "\(#function) No background `type` passed!"
2328
+ reject?("6004", errorMessage, nil)
2329
+ return
2330
+ }
2331
+ guard let virtualBackgroundPlugin = self.virtualBackgroundPlugin as? HMSVirtualBackgroundPlugin else {
2332
+ let errorMessage = "\(#function) Unable to cast `var virtualBackgroundPlugin` to type `HMSVirtualBackgroundPlugin`, It is \(String(describing: virtualBackgroundPlugin))"
2333
+ reject?("6004", errorMessage, nil)
2334
+ return
2335
+ }
2336
+ switch backgroundType {
2337
+ case "blur":
2338
+ virtualBackgroundPlugin.backgroundImage = nil
2339
+ resolve?(true)
2340
+ case "image":
2341
+ guard let imageSource = backgroundDict.value(forKey: "source") as? NSDictionary else {
2342
+ let errorMessage = "\(#function) No background `source` passed for image!"
2343
+ reject?("6004", errorMessage, nil)
2344
+ return
2345
+ }
2346
+
2347
+ // Check if it's a remote URL
2348
+ if let uriString = imageSource.value(forKey: "uri") as? String,
2349
+ (uriString.hasPrefix("http://") || uriString.hasPrefix("https://")),
2350
+ let url = URL(string: uriString) {
2351
+ // Download remote image
2352
+ URLSession.shared.dataTask(with: url) { data, response, error in
2353
+ DispatchQueue.main.async {
2354
+ if let error = error {
2355
+ let errorMessage = "\(#function) Failed to download image: \(error.localizedDescription)"
2356
+ reject?("6004", errorMessage, nil)
2357
+ return
2358
+ }
2359
+ guard let data = data, let image = UIImage(data: data) else {
2360
+ let errorMessage = "\(#function) Unable to create `UIImage` from downloaded data!"
2361
+ reject?("6004", errorMessage, nil)
2362
+ return
2363
+ }
2364
+ virtualBackgroundPlugin.backgroundImage = image
2365
+ resolve?(true)
2366
+ }
2367
+ }.resume()
2368
+ } else {
2369
+ // Use RCTConvert for local files and bundled resources
2370
+ DispatchQueue.main.async {
2371
+ guard let image = RCTConvert.uiImage(imageSource) else {
2372
+ let errorMessage = "\(#function) Unable to create `UIImage` from given background `source` object!"
2373
+ reject?("6004", errorMessage, nil)
2374
+ return
2375
+ }
2376
+ virtualBackgroundPlugin.backgroundImage = image
2377
+ resolve?(true)
2378
+ }
2379
+ }
2380
+ default:
2381
+ let errorMessage = "\(#function) Unknown background `type` passed!"
2382
+ reject?("6004", errorMessage, nil)
2383
+ return
2384
+ }
2385
+ } else {
2386
+ let errorMessage = "\(#function) HMSVirtualBackgroundPlugin not available below iOS 15.0"
2387
+ reject?("6004", errorMessage, nil)
2388
+ return
2389
+ }
2390
+ }
2391
+
2392
+ func setVideoFilterParameter(_ data: NSDictionary,
2393
+ _ resolve: RCTPromiseResolveBlock?,
2394
+ _ reject: RCTPromiseRejectBlock?) {
2395
+ guard let videoFilterPlugin = self.videoFilterPlugin else {
2396
+ let errorMessage = "\(#function) `videoFilterPlugin` is `nil`, Make sure you are passing `HMSVideoFilterPlugin` instance to `videoTrackSettings` in `HMSSDK.build`"
2397
+ reject?("6004", errorMessage, nil)
2398
+ return
2399
+ }
2400
+ guard let filterType = data.value(forKey: "filter") as? String else {
2401
+ let errorMessage = "\(#function) `filter` property not passed!"
2402
+ reject?("6004", errorMessage, nil)
2403
+ return
2404
+ }
2405
+ guard let filterValue = data.value(forKey: "value") as? NSNumber else {
2406
+ let errorMessage = "\(#function) `value` property not passed!"
2407
+ reject?("6004", errorMessage, nil)
2408
+ return
2409
+ }
2410
+ switch filterType {
2411
+ case "brightness":
2412
+ videoFilterPlugin.brightness = CGFloat(truncating: filterValue)
2413
+ case "contrast":
2414
+ videoFilterPlugin.contrast = CGFloat(truncating: filterValue)
2415
+ case "exposure":
2416
+ videoFilterPlugin.exposure = CGFloat(truncating: filterValue)
2417
+ case "hue":
2418
+ videoFilterPlugin.hue = CGFloat(truncating: filterValue)
2419
+ case "redness":
2420
+ videoFilterPlugin.redness = CGFloat(truncating: filterValue)
2421
+ case "saturation":
2422
+ videoFilterPlugin.saturation = CGFloat(truncating: filterValue)
2423
+ case "sharpness":
2424
+ videoFilterPlugin.sharpness = CGFloat(truncating: filterValue)
2425
+ case "smoothness":
2426
+ videoFilterPlugin.smoothness = CGFloat(truncating: filterValue)
2427
+ default:
2428
+ let errorMessage = "\(#function) Unknown `filter` type passed!"
2429
+ reject?("6004", errorMessage, nil)
2430
+ return
2431
+ }
2432
+ resolve?(true)
2433
+ }
2434
+
2435
+ // MARK: - WebRTC Transcriptions
2436
+
2437
+ func handleRealTimeTranscription(_ data: NSDictionary,
2438
+ _ resolve: RCTPromiseResolveBlock?,
2439
+ _ reject: RCTPromiseRejectBlock?) {
2440
+ guard let action = data.value(forKey: "action") as? String else {
2441
+ reject?("\(#function): `action` key not passed", "\(#function): `action` key not passed", nil)
2442
+ return
2443
+ }
2444
+ switch action {
2445
+ case "start":
2446
+ startRealTimeTranscription(data, resolve, reject)
2447
+ case "stop":
2448
+ stopRealTimeTranscription(data, resolve, reject)
2449
+ default:
2450
+ reject?("\(#function): Unknown `action` key passed", "\(#function): Unknown `action` key passed", nil)
2451
+ }
2452
+ }
2453
+
2454
+ private func startRealTimeTranscription(_ data: NSDictionary,
2455
+ _ resolve: RCTPromiseResolveBlock?,
2456
+ _ reject: RCTPromiseRejectBlock?) {
2457
+ guard let hmssdk = hms else {
2458
+ reject?("\(#function): HMSSDK not available", "\(#function): HMSSDK not available", nil)
2459
+ return
2460
+ }
2461
+ hmssdk.startTranscription { success, error in
2462
+ if let error = error {
2463
+ reject?(error.localizedDescription, error.localizedDescription, nil)
2464
+ return
2465
+ }
2466
+ resolve?(success)
2467
+ }
2468
+ }
2469
+
2470
+ private func stopRealTimeTranscription(_ data: NSDictionary,
2471
+ _ resolve: RCTPromiseResolveBlock?,
2472
+ _ reject: RCTPromiseRejectBlock?) {
2473
+ guard let hmssdk = hms else {
2474
+ reject?("\(#function): HMSSDK not available", "\(#function): HMSSDK not available", nil)
2475
+ return
2476
+ }
2477
+ hmssdk.stopTranscription { success, error in
2478
+ if let error = error {
2479
+ reject?(error.localizedDescription, error.localizedDescription, nil)
2480
+ return
2481
+ }
2482
+ resolve?(success)
2483
+ }
2484
+ }
2485
+
2486
+ // MARK: - PIP Mode Support
2487
+
2488
+ internal var _pipVideoCallViewController: Any?
2489
+
2490
+ @available(iOS 15.0, *)
2491
+ internal var pipVideoCallViewController: AVPictureInPictureVideoCallViewController? {
2492
+ if _pipVideoCallViewController == nil {
2493
+ _pipVideoCallViewController = AVPictureInPictureVideoCallViewController()
2494
+ }
2495
+ return _pipVideoCallViewController as? AVPictureInPictureVideoCallViewController
2496
+ }
2497
+
2498
+ internal var _pipModel: Any?
2499
+
2500
+ @available(iOS 15.0, *)
2501
+ internal var pipModel: HMSPipModel? {
2502
+ if _pipModel == nil {
2503
+ _pipModel = HMSPipModel()
2504
+ }
2505
+ return _pipModel as? HMSPipModel
2506
+ }
2507
+
2508
+ internal var pipController: AVPictureInPictureController?
2509
+
2510
+ private var useActiveSpeakerInPIP: Bool = true
2511
+
2512
+ @available(iOS 15.0, *)
2513
+ func setPictureInPictureParams(_ data: NSDictionary,
2514
+ _ resolve: RCTPromiseResolveBlock?,
2515
+ _ reject: RCTPromiseRejectBlock?) {
2516
+
2517
+ guard AVPictureInPictureController.isPictureInPictureSupported() else {
2518
+ let errorMessage = "\(#function) PIP is not supported on this device"
2519
+ reject?("6004", errorMessage, nil)
2520
+ return
2521
+ }
2522
+
2523
+ guard let uiView = UIApplication.shared.keyWindow?.rootViewController?.view else {
2524
+ let errorMessage = "\(#function) Failed to setup PIP"
2525
+ reject?("6004", errorMessage, nil)
2526
+ return
2527
+ }
2528
+
2529
+ pipModel?.pipViewEnabled = true
2530
+
2531
+ if let scaleType = data["scaleType"] as? String {
2532
+ pipModel?.scaleType = getViewContentMode(scaleType)
2533
+ } else {
2534
+ pipModel?.scaleType = .scaleAspectFill
2535
+ }
2536
+
2537
+ pipModel?.color = .black
2538
+ pipModel?.text = hms?.localPeer?.name
2539
+
2540
+ let controller = UIHostingController(rootView: HMSPipView(model: pipModel!))
2541
+
2542
+ pipVideoCallViewController?.view.addConstrained(subview: controller.view)
2543
+
2544
+ if let ratio = data["aspectRatio"] as? [Int], ratio.count == 2 {
2545
+ pipVideoCallViewController?.preferredContentSize = CGSize(width: ratio[0], height: ratio[1])
2546
+ } else {
2547
+ pipVideoCallViewController?.preferredContentSize = CGSize(width: uiView.frame.size.width, height: uiView.frame.size.height)
2548
+ }
2549
+
2550
+ guard let pipVideoCallViewController = pipVideoCallViewController else {
2551
+ let errorMessage = "\(#function) Failed to setup PIP"
2552
+ reject?("6004", errorMessage, nil)
2553
+ return
2554
+ }
2555
+
2556
+ let pipContentSource = AVPictureInPictureController.ContentSource(activeVideoCallSourceView: uiView, contentViewController: pipVideoCallViewController)
2557
+
2558
+ pipController = AVPictureInPictureController(contentSource: pipContentSource)
2559
+
2560
+ pipController?.delegate = self
2561
+
2562
+ pipController?.canStartPictureInPictureAutomaticallyFromInline = true
2563
+
2564
+ if let autoEnterPIP = data["autoEnterPipMode"] as? Bool {
2565
+ pipController?.canStartPictureInPictureAutomaticallyFromInline = autoEnterPIP
2566
+ }
2567
+
2568
+ NotificationCenter.default.addObserver(forName: UIApplication.didBecomeActiveNotification,
2569
+ object: nil, queue: .main) { [weak self] _ in
2570
+ self?.stopPIP(nil, nil)
2571
+ }
2572
+
2573
+ resolve?(true)
2574
+ }
2575
+
2576
+ func enterPipMode(_ resolve: RCTPromiseResolveBlock?,
2577
+ _ reject: RCTPromiseRejectBlock?) {
2578
+ pipController?.startPictureInPicture()
2579
+ resolve?(true)
2580
+ }
2581
+
2582
+ func stopPIP(_ resolve: RCTPromiseResolveBlock?,
2583
+ _ reject: RCTPromiseRejectBlock?) {
2584
+ pipController?.stopPictureInPicture()
2585
+ resolve?(nil)
2586
+ }
2587
+
2588
+ func disposePIP(_ resolve: RCTPromiseResolveBlock?,
2589
+ _ reject: RCTPromiseRejectBlock?) {
2590
+ pipController = nil
2591
+ _pipModel = nil
2592
+ _pipVideoCallViewController = nil
2593
+ NotificationCenter.default.removeObserver(UIApplication.didBecomeActiveNotification)
2594
+ resolve?(nil)
2595
+ }
2596
+
2597
+ func isPIPActive(_ resolve: RCTPromiseResolveBlock?,
2598
+ _ reject: RCTPromiseRejectBlock?) {
2599
+ if pipController != nil && pipController!.isPictureInPictureActive {
2600
+ resolve?(true)
2601
+ } else {
2602
+ resolve?(false)
2603
+ }
2604
+ }
2605
+
2606
+ /// Change the video track in PIP Mode
2607
+ /// - Parameters:
2608
+ /// - data: Data containing the trackId of the video track to be changed
2609
+ /// - resolve: Promise resolve block
2610
+ /// - reject: Promise reject block
2611
+ @available(iOS 15.0, *)
2612
+ func changeIOSPIPVideoTrack(_ data: NSDictionary,
2613
+ _ resolve: RCTPromiseResolveBlock?,
2614
+ _ reject: RCTPromiseRejectBlock?) {
2615
+
2616
+ guard let trackID = data["trackId"] as? String,
2617
+ let room = hms?.room,
2618
+ let track = HMSUtilities.getVideoTrack(for: trackID, in: room)
2619
+ else {
2620
+ let errorMessage = "\(#function) Incorrect data passed for changing track in PIP Mode"
2621
+ reject?("6004", errorMessage, nil)
2622
+ return
2623
+ }
2624
+
2625
+ useActiveSpeakerInPIP = false
2626
+ pipModel?.track = track
2627
+ resolve?(nil)
2628
+ }
2629
+
2630
+ func setActiveSpeakerInIOSPIP(_ data: NSDictionary,
2631
+ _ resolve: RCTPromiseResolveBlock?,
2632
+ _ reject: RCTPromiseRejectBlock?) {
2633
+ guard let enabled = data["enable"] as? Bool else {
2634
+ let errorMessage = "\(#function) Incorrect data passed for setActiveSpeakerInIOSPIP in PIP Mode"
2635
+ reject?("6004", errorMessage, nil)
2636
+ return
2637
+ }
2638
+
2639
+ useActiveSpeakerInPIP = enabled
2640
+ resolve?(nil)
2641
+ }
2642
+
1893
2643
  // MARK: - Helper Functions
1894
2644
 
1895
2645
  // Handle resetting states and data cleanup
@@ -1907,6 +2657,8 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1907
2657
  self.eventsEnableStatus.removeAll()
1908
2658
  self.sessionStore = nil
1909
2659
  self.sessionStoreChangeObservers.removeAll()
2660
+ self.peerListIterators.removeAll()
2661
+ self.roomMutedLocally = false
1910
2662
  HMSDecoder.clearRestrictDataStates()
1911
2663
  }
1912
2664
 
@@ -1966,6 +2718,8 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1966
2718
  return "SERVER_RECORDING_STATE_UPDATED"
1967
2719
  case .hlsRecordingStateUpdated:
1968
2720
  return "HLS_RECORDING_STATE_UPDATED"
2721
+ case .transcriptionStateUpdated:
2722
+ return "TRANSCRIPTIONS_UPDATED"
1969
2723
  default:
1970
2724
  return ""
1971
2725
  }
@@ -1986,6 +2740,19 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
1986
2740
  static private func getTimeStamp() -> String {
1987
2741
  "\(Date().timeIntervalSince1970)"
1988
2742
  }
2743
+
2744
+ private func getViewContentMode(_ type: String?) -> UIView.ContentMode {
2745
+ switch type {
2746
+ case "ASPECT_FILL":
2747
+ return .scaleAspectFill
2748
+ case "ASPECT_FIT":
2749
+ return .scaleAspectFit
2750
+ case "ASPECT_BALANCED":
2751
+ return .center
2752
+ default:
2753
+ return .scaleAspectFill
2754
+ }
2755
+ }
1989
2756
  }
1990
2757
 
1991
2758
  extension UIImage {
@@ -2001,3 +2768,63 @@ extension UIImage {
2001
2768
  return normalizedImage
2002
2769
  }
2003
2770
  }
2771
+
2772
+ extension HMSRNSDK: AVPictureInPictureControllerDelegate {
2773
+
2774
+ public func pictureInPictureControllerWillStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
2775
+ print(#function)
2776
+ }
2777
+
2778
+ public func pictureInPictureControllerDidStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
2779
+
2780
+ if eventsEnableStatus[HMSConstants.ON_PIP_MODE_CHANGED] != true {
2781
+ return
2782
+ }
2783
+
2784
+ self.delegate?.emitEvent(HMSConstants.ON_PIP_MODE_CHANGED,
2785
+ ["event": HMSConstants.ON_PIP_MODE_CHANGED,
2786
+ "id": self.id,
2787
+ "isInPictureInPictureMode": true])
2788
+ }
2789
+
2790
+ public func pictureInPictureControllerWillStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
2791
+ print(#function)
2792
+ }
2793
+
2794
+ public func pictureInPictureControllerDidStopPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
2795
+ if eventsEnableStatus[HMSConstants.ON_PIP_MODE_CHANGED] != true {
2796
+ return
2797
+ }
2798
+
2799
+ self.delegate?.emitEvent(HMSConstants.ON_PIP_MODE_CHANGED,
2800
+ ["event": HMSConstants.ON_PIP_MODE_CHANGED,
2801
+ "id": self.id,
2802
+ "isInPictureInPictureMode": false])
2803
+ }
2804
+
2805
+ public func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, failedToStartPictureInPictureWithError error: Error) {
2806
+ if eventsEnableStatus[HMSConstants.ON_PIP_MODE_CHANGED] != true {
2807
+ return
2808
+ }
2809
+
2810
+ self.delegate?.emitEvent(HMSConstants.ON_PIP_MODE_CHANGED,
2811
+ ["event": HMSConstants.ON_PIP_MODE_CHANGED,
2812
+ "id": self.id,
2813
+ "isInPictureInPictureMode": false])
2814
+ }
2815
+
2816
+ public func pictureInPictureController(_ pictureInPictureController: AVPictureInPictureController, restoreUserInterfaceForPictureInPictureStopWithCompletionHandler completionHandler: @escaping (Bool) -> Void) {
2817
+ print(#function)
2818
+ }
2819
+ }
2820
+
2821
+ extension UIView {
2822
+ func addConstrained(subview: UIView) {
2823
+ addSubview(subview)
2824
+ subview.translatesAutoresizingMaskIntoConstraints = false
2825
+ subview.topAnchor.constraint(equalTo: topAnchor).isActive = true
2826
+ subview.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
2827
+ subview.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true
2828
+ subview.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
2829
+ }
2830
+ }