agora-appbuilder-core 3.0.9 → 4.0.0-api.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/Readme.md +6 -0
  2. package/package.json +2 -2
  3. package/template/_package-lock.json +5871 -4728
  4. package/template/agora-rn-uikit/src/AgoraUIKit.tsx +6 -6
  5. package/template/agora-rn-uikit/src/Contexts/ContentContext.tsx +10 -0
  6. package/template/agora-rn-uikit/src/Contexts/DispatchContext.tsx +22 -0
  7. package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +10 -6
  8. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +28 -8
  9. package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +7 -15
  10. package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +30 -26
  11. package/template/agora-rn-uikit/src/Controls/Icons.ts +30 -83
  12. package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +6 -6
  13. package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +4 -2
  14. package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +4 -2
  15. package/template/agora-rn-uikit/src/Controls/Local/Recording.tsx +0 -2
  16. package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +6 -6
  17. package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +5 -5
  18. package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +4 -4
  19. package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +4 -4
  20. package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +2 -2
  21. package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +6 -6
  22. package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +6 -6
  23. package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +23 -0
  24. package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +6 -6
  25. package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +7 -7
  26. package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +7 -7
  27. package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +10 -10
  28. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +6 -6
  29. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +6 -6
  30. package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +5 -5
  31. package/template/agora-rn-uikit/src/Reducer/UserPin.ts +11 -0
  32. package/template/agora-rn-uikit/src/Reducer/index.ts +2 -0
  33. package/template/agora-rn-uikit/src/Rtc/Create.tsx +74 -7
  34. package/template/agora-rn-uikit/src/Rtc/Join.tsx +5 -4
  35. package/template/agora-rn-uikit/src/RtcConfigure.tsx +76 -49
  36. package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +17 -7
  37. package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +17 -11
  38. package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +2 -2
  39. package/template/agora-rn-uikit/src/index.ts +17 -9
  40. package/template/android/app/build.gradle +1 -0
  41. package/template/android/app/src/main/AndroidManifest.xml +22 -15
  42. package/template/android/app/src/main/assets/fonts/SourceSansPro-Regular.ttf +0 -0
  43. package/template/android/app/src/main/assets/fonts/icomoon.ttf +0 -0
  44. package/template/android/app/src/main/java/com/helloworld/MainActivity.java +50 -0
  45. package/template/android/app/src/main/res/values/colors.xml +7 -0
  46. package/template/android/build.gradle +3 -3
  47. package/template/babel.config.js +1 -0
  48. package/template/bridge/rtc/webNg/RtcEngine.ts +110 -17
  49. package/template/customization-api/action-library.ts +10 -14
  50. package/template/customization-api/app-state.ts +4 -6
  51. package/template/customization-api/customEvents.ts +2 -2
  52. package/template/customization-api/customize.ts +1 -1
  53. package/template/customization-api/sub-components.ts +4 -12
  54. package/template/customization-api/typeDefinition.ts +15 -38
  55. package/template/customization-implementation/createHook.ts +24 -6
  56. package/template/customization-implementation/index.ts +1 -1
  57. package/template/customization-implementation/useCustomization.tsx +5 -7
  58. package/template/electron/index.html +27 -27
  59. package/template/electron/renderer/index.js +1 -0
  60. package/template/global.d.ts +26 -4
  61. package/template/index.rsdk.tsx +1 -0
  62. package/template/index.web.js +2 -1
  63. package/template/index.wsdk.tsx +9 -2
  64. package/template/ios/HelloWorld/Info.plist +14 -1
  65. package/template/ios/HelloWorld.xcodeproj/project.pbxproj +17 -0
  66. package/template/metro.config.js +1 -1
  67. package/template/package.json +18 -7
  68. package/template/react-native-toast-message/index.d.ts +43 -43
  69. package/template/react-native-toast-message/src/colors/index.js +3 -2
  70. package/template/react-native-toast-message/src/components/base/index.js +46 -59
  71. package/template/react-native-toast-message/src/components/base/styles.js +16 -32
  72. package/template/react-native-toast-message/src/components/checkbox.js +178 -0
  73. package/template/react-native-toast-message/src/components/error.js +3 -2
  74. package/template/react-native-toast-message/src/components/info.js +3 -2
  75. package/template/react-native-toast-message/src/components/success.js +3 -2
  76. package/template/react-native-toast-message/src/index.js +122 -31
  77. package/template/react-native-toast-message/src/index.sdk.tsx +125 -35
  78. package/template/react-native-toast-message/src/styles.js +3 -4
  79. package/template/react-native-toast-message/src/styles.sdk.ts +3 -4
  80. package/template/react-native.config.js +7 -0
  81. package/template/src/App.tsx +19 -14
  82. package/template/src/AppWrapper.tsx +74 -29
  83. package/template/src/SDKAppWrapper.tsx +60 -64
  84. package/template/src/app-state/useLocalUserInfo.ts +3 -3
  85. package/template/src/assets/font-styles.css +329 -0
  86. package/template/src/assets/fonts/SourceSansPro-Regular.ttf +0 -0
  87. package/template/src/assets/fonts/icomoon.ttf +0 -0
  88. package/template/src/assets/permission.png +0 -0
  89. package/template/src/assets/selection.json +1 -0
  90. package/template/src/atoms/ActionMenu.tsx +236 -0
  91. package/template/src/atoms/AnimatedActiveSpeaker.native.tsx +71 -0
  92. package/template/src/atoms/AnimatedActiveSpeaker.tsx +84 -0
  93. package/template/src/atoms/AnimatedRings.native.tsx +68 -0
  94. package/template/src/atoms/AnimatedRings.tsx +70 -0
  95. package/template/src/atoms/Card.tsx +61 -0
  96. package/template/src/atoms/CircularProgress.native.tsx +121 -0
  97. package/template/src/atoms/CircularProgress.tsx +102 -0
  98. package/template/src/atoms/CustomIcon.tsx +88 -0
  99. package/template/src/atoms/CustomSwitch.tsx +287 -0
  100. package/template/src/atoms/Dropdown.tsx +306 -0
  101. package/template/src/atoms/HorizontalRule.tsx +3 -1
  102. package/template/src/atoms/IconButton.tsx +162 -0
  103. package/template/src/atoms/ImageIcon.tsx +98 -0
  104. package/template/src/atoms/InfoBubble.tsx +291 -0
  105. package/template/src/atoms/Input.tsx +87 -0
  106. package/template/src/atoms/InviteInfo.tsx +166 -0
  107. package/template/src/atoms/LinkButton.tsx +28 -0
  108. package/template/src/atoms/OutlineButton.tsx +61 -0
  109. package/template/src/atoms/ParticipantsCount.tsx +74 -0
  110. package/template/src/atoms/Popup.tsx +147 -0
  111. package/template/src/atoms/PrimaryButton.tsx +51 -26
  112. package/template/src/atoms/RecordingInfo.tsx +52 -0
  113. package/template/src/atoms/SecondaryButton.tsx +8 -5
  114. package/template/src/atoms/Spacer.tsx +22 -0
  115. package/template/src/atoms/TertiaryButton.tsx +78 -0
  116. package/template/src/atoms/TextInput.tsx +12 -14
  117. package/template/src/atoms/Toggle.tsx +47 -0
  118. package/template/src/atoms/Toolbar.tsx +68 -0
  119. package/template/src/atoms/ToolbarItem.tsx +63 -0
  120. package/template/src/atoms/Tooltip.native.tsx +65 -0
  121. package/template/src/atoms/Tooltip.tsx +94 -0
  122. package/template/src/atoms/UserAvatar.tsx +60 -0
  123. package/template/src/components/Chat.tsx +164 -278
  124. package/template/src/components/ChatContext.ts +8 -1
  125. package/template/src/components/ColorConfigure.tsx +1 -1
  126. package/template/src/components/ColorContext.ts +1 -1
  127. package/template/src/components/CommonStyles.ts +44 -0
  128. package/template/src/components/Controls.tsx +331 -73
  129. package/template/src/components/{Controls.native.tsx → Controls1.native.tsx} +8 -6
  130. package/template/src/components/DeviceConfigure.tsx +511 -106
  131. package/template/src/components/DeviceContext.tsx +8 -4
  132. package/template/src/components/EventsConfigure.tsx +192 -10
  133. package/template/src/components/GraphQLProvider.tsx +1 -1
  134. package/template/src/components/GridVideo.tsx +60 -45
  135. package/template/src/components/HostControlView.tsx +114 -35
  136. package/template/src/components/Navbar.tsx +219 -437
  137. package/template/src/components/Navigation.tsx +15 -1
  138. package/template/src/components/NetworkQualityContext.tsx +22 -22
  139. package/template/src/components/ParticipantsView.tsx +178 -156
  140. package/template/src/components/PinnedVideo.tsx +206 -121
  141. package/template/src/components/Precall.native.tsx +358 -119
  142. package/template/src/components/Precall.tsx +272 -138
  143. package/template/src/components/RTMConfigure.tsx +66 -19
  144. package/template/src/components/Router.electron.ts +1 -0
  145. package/template/src/components/Router.native.ts +1 -0
  146. package/template/src/components/Router.sdk.ts +1 -0
  147. package/template/src/components/Router.ts +1 -0
  148. package/template/src/components/SdkApiContext.tsx +161 -0
  149. package/template/src/components/Settings.tsx +26 -95
  150. package/template/src/components/SettingsView.tsx +251 -56
  151. package/template/src/components/Share.tsx +305 -276
  152. package/template/src/components/StorageContext.tsx +30 -3
  153. package/template/src/components/ToastComponent.tsx +8 -0
  154. package/template/src/components/chat-messages/useChatMessages.tsx +97 -50
  155. package/template/src/components/chat-ui/useChatUIControls.tsx +76 -0
  156. package/template/src/components/common/Error.tsx +20 -6
  157. package/template/src/components/common/Logo.tsx +16 -15
  158. package/template/src/components/contexts/LiveStreamDataContext.tsx +16 -11
  159. package/template/src/components/contexts/VideoMeetingDataContext.tsx +41 -11
  160. package/template/src/components/contexts/WhiteboardContext.tsx +3 -3
  161. package/template/src/components/livestream/LiveStreamContext.tsx +284 -50
  162. package/template/src/components/livestream/Types.ts +39 -14
  163. package/template/src/components/livestream/index.ts +1 -0
  164. package/template/src/components/livestream/views/LiveStreamControls.tsx +9 -4
  165. package/template/src/components/participants/AllAudienceParticipants.tsx +102 -31
  166. package/template/src/components/participants/AllHostParticipants.tsx +106 -35
  167. package/template/src/components/participants/Participant.tsx +300 -0
  168. package/template/src/components/participants/ParticipantName.tsx +13 -7
  169. package/template/src/components/participants/ParticipantSectionTitle.tsx +35 -10
  170. package/template/src/components/participants/ScreenshareParticipants.tsx +144 -12
  171. package/template/src/components/participants/UserActionMenuOptions.tsx +396 -0
  172. package/template/src/components/popups/InvitePopup.tsx +115 -0
  173. package/template/src/components/popups/StopRecordingPopup.tsx +114 -0
  174. package/template/src/components/precall/LocalMute.tsx +84 -14
  175. package/template/src/components/precall/{LocalMute.native.tsx → LocalMute1.native.tsx} +21 -5
  176. package/template/src/components/precall/PermissionHelper.native.tsx +5 -0
  177. package/template/src/components/precall/PermissionHelper.tsx +126 -0
  178. package/template/src/components/precall/PreCallSettings.tsx +52 -0
  179. package/template/src/components/precall/VideoPreview.native.tsx +51 -6
  180. package/template/src/components/precall/VideoPreview.tsx +164 -8
  181. package/template/src/components/precall/joinCallBtn.native.tsx +2 -2
  182. package/template/src/components/precall/joinCallBtn.tsx +17 -4
  183. package/template/src/components/precall/meetingTitle.tsx +17 -14
  184. package/template/src/components/precall/selectDevice.tsx +1 -21
  185. package/template/src/components/precall/textInput.tsx +34 -6
  186. package/template/src/components/precall/usePreCall.tsx +39 -1
  187. package/template/src/components/{meeting-info/useMeetingInfo.tsx → room-info/useRoomInfo.tsx} +34 -10
  188. package/template/src/components/{meeting-info/useSetMeetingInfo.tsx → room-info/useSetRoomInfo.tsx} +12 -12
  189. package/template/src/components/styles.ts +42 -21
  190. package/template/src/components/useShareLink.tsx +19 -21
  191. package/template/src/components/useToast.tsx +41 -0
  192. package/template/src/components/useUserPreference.tsx +9 -6
  193. package/template/src/components/useVideoCall.tsx +84 -0
  194. package/template/src/language/default-labels/createScreenLabels.ts +3 -3
  195. package/template/src/language/default-labels/joinScreenLabels.ts +2 -2
  196. package/template/src/language/default-labels/precallScreenLabels.ts +3 -3
  197. package/template/src/language/default-labels/shareLinkScreenLabels.ts +5 -5
  198. package/template/src/language/default-labels/videoCallScreenLabels.ts +5 -5
  199. package/template/src/pages/Authenticate.tsx +5 -15
  200. package/template/src/pages/Create.tsx +304 -191
  201. package/template/src/pages/Endcall.tsx +148 -0
  202. package/template/src/pages/Join.tsx +96 -70
  203. package/template/src/pages/VideoCall.tsx +179 -69
  204. package/template/src/pages/video-call/ActionSheet.native.tsx +215 -0
  205. package/template/src/pages/video-call/ActionSheet.tsx +226 -0
  206. package/template/src/pages/video-call/ActionSheetContent.tsx +479 -0
  207. package/template/src/pages/video-call/ActionSheetHandle.tsx +38 -0
  208. package/template/src/pages/video-call/ActionSheetStyles.css +138 -0
  209. package/template/src/pages/video-call/DefaultLayouts.ts +6 -6
  210. package/template/src/pages/video-call/NameWithMicIcon.tsx +93 -49
  211. package/template/src/pages/video-call/RenderComponent.tsx +6 -30
  212. package/template/src/pages/video-call/SidePanelHeader.tsx +186 -0
  213. package/template/src/pages/video-call/VideoCallMobileView.tsx +138 -0
  214. package/template/src/pages/video-call/VideoCallScreen.native.tsx +37 -0
  215. package/template/src/pages/video-call/VideoCallScreen.tsx +109 -66
  216. package/template/src/pages/video-call/VideoComponent.tsx +20 -4
  217. package/template/src/pages/video-call/VideoRenderer.tsx +227 -61
  218. package/template/src/pages/video-call/index.ts +35 -7
  219. package/template/src/rtm/RTMEngine.ts +8 -0
  220. package/template/src/rtm-events/constants.ts +3 -1
  221. package/template/src/rtm-events-api/Events.ts +5 -4
  222. package/template/src/rtm-events-api/LocalEvents.ts +6 -0
  223. package/template/src/rtm-events-api/types.ts +5 -5
  224. package/template/src/subComponents/ChatBubble.tsx +125 -84
  225. package/template/src/subComponents/ChatContainer.tsx +280 -93
  226. package/template/src/subComponents/ChatInput.ios.tsx +175 -0
  227. package/template/src/subComponents/ChatInput.tsx +72 -115
  228. package/template/src/subComponents/Checkbox.native.tsx +16 -5
  229. package/template/src/subComponents/Checkbox.tsx +2 -2
  230. package/template/src/subComponents/CopyJoinInfo.tsx +36 -58
  231. package/template/src/subComponents/EndcallPopup.tsx +107 -0
  232. package/template/src/subComponents/FallbackLogo.tsx +122 -40
  233. package/template/src/subComponents/LanguageSelector.tsx +1 -1
  234. package/template/src/subComponents/LayoutIconButton.tsx +201 -0
  235. package/template/src/subComponents/LayoutIconDropdown.tsx +131 -134
  236. package/template/src/subComponents/{LayoutIconDropdown.native.tsx → LayoutIconDropdown1.native.tsx} +4 -18
  237. package/template/src/subComponents/LocalAudioMute.tsx +119 -27
  238. package/template/src/subComponents/LocalEndCall.tsx +73 -35
  239. package/template/src/subComponents/LocalSwitchCamera.tsx +19 -32
  240. package/template/src/subComponents/LocalVideoMute.tsx +117 -27
  241. package/template/src/subComponents/Logo.tsx +3 -4
  242. package/template/src/subComponents/LogoutButton.tsx +1 -1
  243. package/template/src/subComponents/NetworkQualityPill.tsx +66 -68
  244. package/template/src/subComponents/OpenInNativeButton.tsx +3 -3
  245. package/template/src/subComponents/Recording.tsx +28 -29
  246. package/template/src/subComponents/RemoteAudioMute.tsx +83 -29
  247. package/template/src/subComponents/RemoteEndCall.tsx +8 -5
  248. package/template/src/subComponents/RemoteMutePopup.tsx +193 -0
  249. package/template/src/subComponents/RemoteVideoMute.tsx +74 -21
  250. package/template/src/subComponents/RemoveMeetingPopup.tsx +109 -0
  251. package/template/src/subComponents/RemoveScreensharePopup.tsx +109 -0
  252. package/template/src/subComponents/ScreenShareNotice.tsx +83 -8
  253. package/template/src/subComponents/SelectDevice.tsx +404 -61
  254. package/template/src/subComponents/SelectDeviceSettings.backup.tsx +207 -0
  255. package/template/src/subComponents/SelectOAuth.tsx +9 -8
  256. package/template/src/subComponents/SidePanelButtons.ts +0 -3
  257. package/template/src/subComponents/SidePanelHeader.tsx +112 -0
  258. package/template/src/subComponents/ToastConfig.tsx +150 -10
  259. package/template/src/subComponents/chat/ChatParticipants.tsx +188 -79
  260. package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +97 -34
  261. package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +29 -33
  262. package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +8 -8
  263. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +24 -11
  264. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +17 -10
  265. package/template/src/subComponents/recording/useRecording.tsx +81 -29
  266. package/template/src/subComponents/screenshare/ScreenshareButton.tsx +52 -70
  267. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +23 -12
  268. package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +44 -19
  269. package/template/src/theme/index.ts +46 -0
  270. package/template/src/utils/PlatformWrapper.tsx +21 -0
  271. package/template/src/utils/SdkEvents.ts +23 -14
  272. package/template/src/utils/SdkMethodEvents.ts +81 -0
  273. package/template/src/utils/common.tsx +155 -1
  274. package/template/src/utils/hexadecimalTransparency.ts +108 -0
  275. package/template/src/utils/index.tsx +19 -0
  276. package/template/src/utils/isMobileOrTablet.ts +7 -2
  277. package/template/src/utils/pendingStateUpdateHelper.ts +19 -0
  278. package/template/src/utils/useActiveSpeaker.ts +42 -0
  279. package/template/src/utils/{useCreateMeeting.ts → useCreateRoom.ts} +19 -14
  280. package/template/src/utils/{useButtonTemplate.tsx → useFocus.tsx} +19 -16
  281. package/template/src/utils/useGetMeetingPhrase.ts +10 -10
  282. package/template/src/utils/useIsAudioEnabled.ts +3 -3
  283. package/template/src/utils/useIsHandRaised.ts +13 -0
  284. package/template/src/utils/useIsPSTN.ts +3 -3
  285. package/template/src/utils/useIsVideoEnabled.ts +3 -3
  286. package/template/src/utils/{useJoinMeeting.ts → useJoinRoom.ts} +27 -21
  287. package/template/src/utils/useMutePSTN.ts +2 -2
  288. package/template/src/utils/useMuteToggleLocal.ts +58 -5
  289. package/template/src/utils/useRemoteEndCall.ts +4 -4
  290. package/template/src/utils/useRemoteEndScreenshare.ts +26 -0
  291. package/template/src/utils/useRemoteMute.ts +7 -7
  292. package/template/src/utils/useRemoteRequest.ts +84 -0
  293. package/template/src/utils/useSwitchCamera.native.tsx +25 -0
  294. package/template/src/utils/useSwitchCamera.tsx +19 -0
  295. package/template/src/utils/useToolbar.tsx +59 -0
  296. package/template/web/index.html +5 -0
  297. package/template/webpack.commons.js +13 -8
  298. package/template/webpack.rsdk.config.js +1 -2
  299. package/template/webpack.web.config.js +1 -0
  300. package/template/agora-rn-uikit/src/Contexts/RenderContext.tsx +0 -10
  301. package/template/src/assets/icons.ts +0 -102
  302. package/template/src/components/chat-ui/useChatUIControl.tsx +0 -69
  303. package/template/src/components/participants/MeParticipant.tsx +0 -38
  304. package/template/src/components/participants/RemoteParticipants.tsx +0 -71
  305. package/template/src/pages/video-call/CustomUserContextHolder.tsx +0 -20
@@ -1,6 +1,5 @@
1
1
  import React, {useContext} from 'react';
2
2
  import PropsContext from '../../Contexts/PropsContext';
3
- import RtcContext, {DispatchType} from '../../Contexts/RtcContext';
4
3
  import BtnTemplate from '../BtnTemplate';
5
4
  import styles from '../../Style';
6
5
 
@@ -8,7 +7,6 @@ function Recording() {
8
7
  const {styleProps} = useContext(PropsContext);
9
8
  const {localBtnStyles} = styleProps || {};
10
9
  const {recording} = localBtnStyles || {};
11
- const {dispatch} = useContext(RtcContext);
12
10
 
13
11
  return (
14
12
  <BtnTemplate
@@ -1,28 +1,28 @@
1
1
  import React, {useContext} from 'react';
2
- import PropsContext,{ToggleState} from '../../Contexts/PropsContext';
2
+ import PropsContext, {ToggleState} from '../../Contexts/PropsContext';
3
3
  import {LocalContext} from '../../Contexts/LocalUserContext';
4
4
  import RtcContext from '../../Contexts/RtcContext';
5
5
  import BtnTemplate from '../BtnTemplate';
6
6
  import styles from '../../Style';
7
7
 
8
- interface Props{
9
- btnText?: string
8
+ interface Props {
9
+ btnText?: string;
10
10
  }
11
11
 
12
12
  function SwitchCamera(props?: Props) {
13
13
  const {styleProps, callbacks} = useContext(PropsContext);
14
14
  const {localBtnStyles} = styleProps || {};
15
15
  const {switchCamera} = localBtnStyles || {};
16
- const {RtcEngine} = useContext(RtcContext);
16
+ const {RtcEngineUnsafe} = useContext(RtcContext);
17
17
  const local = useContext(LocalContext);
18
18
  return (
19
19
  <BtnTemplate
20
20
  name={'switchCamera'}
21
21
  style={{...styles.localBtn, ...(switchCamera as object)}}
22
- btnText={props?.btnText ||'Switch'}
22
+ btnText={props?.btnText || 'Switch'}
23
23
  disabled={local.video === ToggleState.enabled ? false : true}
24
24
  onPress={() => {
25
- RtcEngine.switchCamera();
25
+ RtcEngineUnsafe.switchCamera();
26
26
  callbacks?.SwitchCamera && callbacks.SwitchCamera();
27
27
  }}
28
28
  />
@@ -6,7 +6,7 @@ import LocalAudioMute from './Local/LocalAudioMute';
6
6
  import LocalVideoMute from './Local/LocalVideoMute';
7
7
  import SwitchCamera from './Local/SwitchCamera';
8
8
  import RemoteControls from './RemoteControls';
9
- import {RenderConsumer} from '../Contexts/RenderContext';
9
+ import {ContentConsumer} from '../Contexts/ContentContext';
10
10
  import PropsContext from '../Contexts/PropsContext';
11
11
  import LocalUserContextComponent from '../Contexts/LocalUserContext';
12
12
  import useLocalUid from '../Utils/useLocalUid';
@@ -29,16 +29,16 @@ function Controls(props: ControlsPropsInterface) {
29
29
  <EndCall />
30
30
  </View>
31
31
  {showButton ? (
32
- <RenderConsumer>
33
- {({renderList, activeUids}) => (
32
+ <ContentConsumer>
33
+ {({defaultContent, activeUids}) => (
34
34
  <View style={{...styles.Controls, top: styles.Controls.top - 100}}>
35
35
  <RemoteControls
36
- user={renderList[activeUids[0]]}
36
+ user={defaultContent[activeUids[0]]}
37
37
  showRemoteSwap={false}
38
38
  />
39
39
  </View>
40
40
  )}
41
- </RenderConsumer>
41
+ </ContentConsumer>
42
42
  ) : (
43
43
  <></>
44
44
  )}
@@ -4,16 +4,16 @@ import BtnTemplate from '../BtnTemplate';
4
4
  import styles from '../../Style';
5
5
  import PropsContext, {
6
6
  ToggleState,
7
- RenderInterface,
7
+ ContentInterface,
8
8
  } from '../../Contexts/PropsContext';
9
9
  import useLocalUid from '../../Utils/useLocalUid';
10
10
 
11
11
  interface RemoteAudioMuteInterface {
12
- user: RenderInterface;
12
+ user: ContentInterface;
13
13
  }
14
14
 
15
15
  const RemoteAudioMute: React.FC<RemoteAudioMuteInterface> = (props) => {
16
- const {RtcEngine} = useContext(RtcContext);
16
+ const {RtcEngineUnsafe} = useContext(RtcContext);
17
17
  const {styleProps} = useContext(PropsContext);
18
18
  const {remoteBtnStyles} = styleProps || {};
19
19
  const {muteRemoteAudio} = remoteBtnStyles || {};
@@ -23,7 +23,7 @@ const RemoteAudioMute: React.FC<RemoteAudioMuteInterface> = (props) => {
23
23
  name={props.user.audio === ToggleState.enabled ? 'mic' : 'micOff'}
24
24
  style={{...styles.leftRemoteBtn, ...(muteRemoteAudio as object)}}
25
25
  onPress={() => {
26
- RtcEngine.muteRemoteAudioStream(
26
+ RtcEngineUnsafe.muteRemoteAudioStream(
27
27
  props.user.uid as number,
28
28
  props.user.audio === ToggleState.enabled,
29
29
  );
@@ -2,19 +2,19 @@ import React, {useContext} from 'react';
2
2
  import useLocalUid from '../../Utils/useLocalUid';
3
3
  import PropsContext, {
4
4
  ToggleState,
5
- RenderInterface,
5
+ ContentInterface,
6
6
  } from '../../Contexts/PropsContext';
7
7
  import RtcContext from '../../Contexts/RtcContext';
8
8
  import styles from '../../Style';
9
9
  import BtnTemplate from '../BtnTemplate';
10
10
 
11
11
  interface RemoteVideoMuteInterface {
12
- user: RenderInterface;
12
+ user: ContentInterface;
13
13
  rightButton: boolean;
14
14
  }
15
15
 
16
16
  const RemoteVideoMute: React.FC<RemoteVideoMuteInterface> = (props) => {
17
- const {RtcEngine} = useContext(RtcContext);
17
+ const {RtcEngineUnsafe} = useContext(RtcContext);
18
18
  const {styleProps} = useContext(PropsContext);
19
19
  const {remoteBtnStyles} = styleProps || {};
20
20
  const {muteRemoteVideo} = remoteBtnStyles || {};
@@ -30,7 +30,7 @@ const RemoteVideoMute: React.FC<RemoteVideoMuteInterface> = (props) => {
30
30
  : {...(muteRemoteVideo as object)}
31
31
  }
32
32
  onPress={() => {
33
- RtcEngine.muteRemoteVideoStream(
33
+ RtcEngineUnsafe.muteRemoteVideoStream(
34
34
  props.user.uid as number,
35
35
  props.user.video === ToggleState.enabled, //If enabled, disable or vice-versa
36
36
  );
@@ -1,6 +1,6 @@
1
1
  import React, {useContext} from 'react';
2
2
  import {View} from 'react-native';
3
- import PropsContext, {RenderInterface} from '../Contexts/PropsContext';
3
+ import PropsContext, {ContentInterface} from '../Contexts/PropsContext';
4
4
  import styles from '../Style';
5
5
  import RemoteAudioMute from './Remote/RemoteAudioMute';
6
6
  import RemoteSwap from './Remote/RemoteSwap';
@@ -10,7 +10,7 @@ interface RemoteControlsInterface {
10
10
  showMuteRemoteVideo?: boolean;
11
11
  showMuteRemoteAudio?: boolean;
12
12
  showRemoteSwap?: boolean;
13
- user: RenderInterface;
13
+ user: ContentInterface;
14
14
  }
15
15
 
16
16
  const RemoteControls: React.FC<RemoteControlsInterface> = (props) => {
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  ActionType,
3
- RenderStateInterface,
3
+ ContentStateInterface,
4
4
  UidType,
5
5
  } from '../Contexts/RtcContext';
6
6
 
7
7
  export default function LocalMuteAudio(
8
- state: RenderStateInterface,
8
+ state: ContentStateInterface,
9
9
  action: ActionType<'LocalMuteAudio'>,
10
10
  localUid: UidType,
11
11
  ) {
12
- let stateUpdate: RenderStateInterface = {
13
- renderList: {
14
- ...state.renderList,
12
+ let stateUpdate: ContentStateInterface = {
13
+ defaultContent: {
14
+ ...state.defaultContent,
15
15
  [localUid]: {
16
- ...state.renderList[localUid],
16
+ ...state.defaultContent[localUid],
17
17
  audio: action.value[0],
18
18
  },
19
19
  },
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  ActionType,
3
- RenderStateInterface,
3
+ ContentStateInterface,
4
4
  UidType,
5
5
  } from '../Contexts/RtcContext';
6
6
 
7
7
  export default function LocalMuteVideo(
8
- state: RenderStateInterface,
8
+ state: ContentStateInterface,
9
9
  action: ActionType<'LocalMuteVideo'>,
10
10
  localUid: UidType,
11
11
  ) {
12
- let stateUpdate: RenderStateInterface = {
13
- renderList: {
14
- ...state.renderList,
12
+ let stateUpdate: ContentStateInterface = {
13
+ defaultContent: {
14
+ ...state.defaultContent,
15
15
  [localUid]: {
16
- ...state.renderList[localUid],
16
+ ...state.defaultContent[localUid],
17
17
  video: action.value[0],
18
18
  },
19
19
  },
@@ -0,0 +1,23 @@
1
+ import {
2
+ ActionType,
3
+ ContentStateInterface,
4
+ UidType,
5
+ } from '../Contexts/RtcContext';
6
+
7
+ export default function LocalPermissionState(
8
+ state: ContentStateInterface,
9
+ action: ActionType<'LocalPermissionState'>,
10
+ localUid: UidType,
11
+ ) {
12
+ let stateUpdate: ContentStateInterface = {
13
+ defaultContent: {
14
+ ...state.defaultContent,
15
+ [localUid]: {
16
+ ...state.defaultContent[localUid],
17
+ permissionStatus: action.value[0],
18
+ },
19
+ },
20
+ activeUids: [...state.activeUids],
21
+ };
22
+ return stateUpdate;
23
+ }
@@ -1,8 +1,8 @@
1
1
  import {ToggleState} from '../Contexts/PropsContext';
2
- import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
2
+ import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
3
3
 
4
4
  export default function RemoteAudioStateChanged(
5
- state: RenderStateInterface,
5
+ state: ContentStateInterface,
6
6
  action: ActionType<'RemoteAudioStateChanged'>,
7
7
  ) {
8
8
  let audioState: ToggleState;
@@ -12,11 +12,11 @@ export default function RemoteAudioStateChanged(
12
12
  audioState = ToggleState.disabled;
13
13
  }
14
14
 
15
- const stateUpdate: RenderStateInterface = {
16
- renderList: {
17
- ...state.renderList,
15
+ const stateUpdate: ContentStateInterface = {
16
+ defaultContent: {
17
+ ...state.defaultContent,
18
18
  [action.value[0]]: {
19
- ...state.renderList[action.value[0]],
19
+ ...state.defaultContent[action.value[0]],
20
20
  audio: audioState,
21
21
  },
22
22
  },
@@ -1,8 +1,8 @@
1
1
  import {ToggleState} from '../Contexts/PropsContext';
2
- import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
2
+ import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
3
3
 
4
4
  export default function RemoteVideoStateChanged(
5
- state: RenderStateInterface,
5
+ state: ContentStateInterface,
6
6
  action: ActionType<'RemoteVideoStateChanged'>,
7
7
  ) {
8
8
  let videoState: ToggleState;
@@ -12,15 +12,15 @@ export default function RemoteVideoStateChanged(
12
12
  videoState = ToggleState.enabled;
13
13
  }
14
14
 
15
- const stateUpdate: RenderStateInterface = {
16
- renderList: {
17
- ...state.renderList,
15
+ const stateUpdate: ContentStateInterface = {
16
+ defaultContent: {
17
+ ...state.defaultContent,
18
18
  [action.value[0]]: {
19
- ...state.renderList[action.value[0]],
19
+ ...state.defaultContent[action.value[0]],
20
20
  video:
21
21
  videoState !== undefined
22
22
  ? videoState
23
- : state.renderList[action.value[0]].video,
23
+ : state.defaultContent[action.value[0]].video,
24
24
  },
25
25
  },
26
26
  activeUids: [...state.activeUids],
@@ -1,23 +1,23 @@
1
1
  import {DualStreamMode} from '../Contexts/PropsContext';
2
2
  import {
3
3
  ActionType,
4
- RenderStateInterface,
4
+ ContentStateInterface,
5
5
  UidType,
6
6
  } from '../Contexts/RtcContext';
7
7
 
8
8
  export default function UpdateDualStreamMode(
9
- state: RenderStateInterface,
9
+ state: ContentStateInterface,
10
10
  action: ActionType<'UpdateDualStreamMode'>,
11
11
  ) {
12
12
  const newMode = action.value[0];
13
- let renderList = {...state.renderList};
14
- let stateUpdate: RenderStateInterface;
13
+ let defaultContent = {...state.defaultContent};
14
+ let stateUpdate: ContentStateInterface;
15
15
  const setHighStreamType = (uid: UidType) => {
16
- renderList[uid].streamType = 'high';
16
+ defaultContent[uid].streamType = 'high';
17
17
  };
18
18
 
19
19
  const setLowStreamType = (uid: UidType) => {
20
- renderList[uid].streamType = 'low';
20
+ defaultContent[uid].streamType = 'low';
21
21
  };
22
22
 
23
23
  if (newMode === DualStreamMode.HIGH) {
@@ -36,7 +36,7 @@ export default function UpdateDualStreamMode(
36
36
  minUids.forEach(setLowStreamType);
37
37
  }
38
38
  stateUpdate = {
39
- renderList: renderList,
39
+ defaultContent: defaultContent,
40
40
  activeUids: [...state.activeUids],
41
41
  };
42
42
  return stateUpdate;
@@ -1,12 +1,12 @@
1
1
  import {DualStreamMode, ToggleState} from '../Contexts/PropsContext';
2
2
  import {
3
3
  ActionType,
4
- RenderStateInterface,
4
+ ContentStateInterface,
5
5
  UidType,
6
6
  } from '../Contexts/RtcContext';
7
7
 
8
8
  export default function UserJoined(
9
- state: RenderStateInterface,
9
+ state: ContentStateInterface,
10
10
  action: ActionType<'UserJoined'>,
11
11
  dualStreamMode: DualStreamMode,
12
12
  localUid: UidType,
@@ -17,14 +17,14 @@ export default function UserJoined(
17
17
  let typeData = {
18
18
  type: 'rtc',
19
19
  };
20
- if (state.renderList[newUid] && 'type' in state.renderList[newUid]) {
21
- typeData.type = state.renderList[newUid].type;
20
+ if (state.defaultContent[newUid] && 'type' in state.defaultContent[newUid]) {
21
+ typeData.type = state.defaultContent[newUid].type;
22
22
  }
23
23
 
24
- let renderList: RenderStateInterface['renderList'] = {
25
- ...state.renderList,
24
+ let defaultContent: ContentStateInterface['defaultContent'] = {
25
+ ...state.defaultContent,
26
26
  [newUid]: {
27
- ...state.renderList[newUid],
27
+ ...state.defaultContent[newUid],
28
28
  uid: newUid,
29
29
  audio: ToggleState.disabled,
30
30
  video: ToggleState.disabled,
@@ -40,18 +40,18 @@ export default function UserJoined(
40
40
  //Only one remote and local is maximized
41
41
  //Change stream type to high if dualStreaMode is DYNAMIC
42
42
  if (dualStreamMode === DualStreamMode.DYNAMIC) {
43
- renderList[newUid].streamType = 'high';
43
+ defaultContent[newUid].streamType = 'high';
44
44
  }
45
45
  //Swap render positions
46
46
  stateUpdate = {
47
- renderList: renderList,
47
+ defaultContent: defaultContent,
48
48
  activeUids: activeUids.reverse(),
49
49
  lastJoinedUid: newUid,
50
50
  };
51
51
  } else {
52
52
  //More than one remote
53
53
  stateUpdate = {
54
- renderList: renderList,
54
+ defaultContent: defaultContent,
55
55
  activeUids: activeUids,
56
56
  lastJoinedUid: newUid,
57
57
  };
@@ -1,14 +1,14 @@
1
- import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
1
+ import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
2
2
 
3
3
  export default function UserMuteRemoteAudio(
4
- state: RenderStateInterface,
4
+ state: ContentStateInterface,
5
5
  action: ActionType<'UserMuteRemoteAudio'>,
6
6
  ) {
7
- let stateUpdate: RenderStateInterface = {
8
- renderList: {
9
- ...state.renderList,
7
+ let stateUpdate: ContentStateInterface = {
8
+ defaultContent: {
9
+ ...state.defaultContent,
10
10
  [action.value[0]]: {
11
- ...state.renderList[action.value[0]],
11
+ ...state.defaultContent[action.value[0]],
12
12
  audio: action.value[1],
13
13
  },
14
14
  },
@@ -1,14 +1,14 @@
1
- import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
1
+ import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
2
2
 
3
3
  export default function UserMuteRemoteVideo(
4
- state: RenderStateInterface,
4
+ state: ContentStateInterface,
5
5
  action: ActionType<'UserMuteRemoteVideo'>,
6
6
  ) {
7
- let stateUpdate: RenderStateInterface = {
8
- renderList: {
9
- ...state.renderList,
7
+ let stateUpdate: ContentStateInterface = {
8
+ defaultContent: {
9
+ ...state.defaultContent,
10
10
  [action.value[0]]: {
11
- ...state.renderList[action.value[0]],
11
+ ...state.defaultContent[action.value[0]],
12
12
  video: action.value[1],
13
13
  },
14
14
  },
@@ -1,11 +1,11 @@
1
- import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
1
+ import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
2
2
 
3
3
  export default function UserOffline(
4
- state: RenderStateInterface,
4
+ state: ContentStateInterface,
5
5
  action: ActionType<'UserOffline'>,
6
6
  ) {
7
7
  // let updatedRenderList = {
8
- // ...state.renderList,
8
+ // ...state.defaultContent,
9
9
  // };
10
10
  // //don't delete user data from renderlist
11
11
  // //we will update user data with {offline:true} from RTM user left event
@@ -15,8 +15,8 @@ export default function UserOffline(
15
15
  const updatedActiveUids = [...state.activeUids].filter(
16
16
  (uid) => uid !== action.value[0],
17
17
  );
18
- const stateUpdate: RenderStateInterface = {
19
- renderList: state.renderList,
18
+ const stateUpdate: ContentStateInterface = {
19
+ defaultContent: state.defaultContent,
20
20
  activeUids: updatedActiveUids,
21
21
  };
22
22
 
@@ -0,0 +1,11 @@
1
+ import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
2
+
3
+ export default function UserPin(
4
+ state: ContentStateInterface,
5
+ action: ActionType<'UserPin'>,
6
+ ) {
7
+ return {
8
+ ...state,
9
+ pinnedUid: action?.value && action.value?.length ? action.value[0] : '',
10
+ };
11
+ }
@@ -5,5 +5,7 @@ export {default as UserMuteRemoteAudio} from './UserMuteRemoteAudio';
5
5
  export {default as UserMuteRemoteVideo} from './UserMuteRemoteVideo';
6
6
  export {default as LocalMuteAudio} from './LocalMuteAudio';
7
7
  export {default as LocalMuteVideo} from './LocalMuteVideo';
8
+ export {default as LocalPermissionState} from './LocalPermissionState';
8
9
  export {default as RemoteAudioStateChanged} from './RemoteAudioStateChanged';
9
10
  export {default as RemoteVideoStateChanged} from './RemoteVideoStateChanged';
11
+ export {default as UserPin} from './UserPin';
@@ -7,11 +7,12 @@ import RtcEngine, {
7
7
  } from 'react-native-agora';
8
8
  import {Platform} from 'react-native';
9
9
  import requestCameraAndAudioPermission from '../Utils/permission';
10
- import {DispatchType} from '../Contexts/RtcContext';
10
+ import {DispatchType} from '../Contexts/DispatchContext';
11
11
  import PropsContext, {
12
12
  ToggleState,
13
13
  ClientRole,
14
14
  ChannelProfile,
15
+ PermissionState,
15
16
  } from '../Contexts/PropsContext';
16
17
  import quality from '../Utils/quality';
17
18
 
@@ -22,9 +23,14 @@ const Create = ({
22
23
  dispatch: DispatchType;
23
24
  children: (engine: React.MutableRefObject<RtcEngine>) => JSX.Element;
24
25
  }) => {
26
+ const mutexLock = useRef(false);
25
27
  const [ready, setReady] = useState(false);
26
28
  const {callbacks, rtcProps, mode} = useContext(PropsContext);
27
- const {geoFencing = true, audioRoom = false} = rtcProps || {};
29
+ const {
30
+ geoFencing = true,
31
+ audioRoom = false,
32
+ activeSpeaker = false,
33
+ } = rtcProps || {};
28
34
  let engine = useRef<RtcEngine>({} as RtcEngine);
29
35
  // commented for v1 release
30
36
  // const beforeCreate = rtcProps?.lifecycle?.useBeforeCreate
@@ -33,16 +39,52 @@ const Create = ({
33
39
  const isVideoEnabledRef = useRef<boolean>(false);
34
40
  const firstUpdate = useRef(true);
35
41
 
42
+ const dispatchPermissionState = (audioError: any, videoError: any) => {
43
+ if (audioError && videoError) {
44
+ dispatch({
45
+ type: 'LocalPermissionState',
46
+ value: [PermissionState.REJECTED],
47
+ });
48
+ } else if (audioError && !videoError) {
49
+ dispatch({
50
+ type: 'LocalPermissionState',
51
+ value: [PermissionState.GRANTED_FOR_CAM_ONLY],
52
+ });
53
+ } else if (!audioError && videoError) {
54
+ dispatch({
55
+ type: 'LocalPermissionState',
56
+ value: [PermissionState.GRANTED_FOR_MIC_ONLY],
57
+ });
58
+ } else {
59
+ dispatch({
60
+ type: 'LocalPermissionState',
61
+ value: [PermissionState.GRANTED_FOR_CAM_AND_MIC],
62
+ });
63
+ }
64
+ };
65
+
36
66
  const enableVideoAndAudioWithDisabledState = async () => {
37
67
  try {
68
+ dispatch({
69
+ type: 'LocalPermissionState',
70
+ value: [PermissionState.REQUESTED],
71
+ });
38
72
  if (audioRoom === true) {
39
73
  await engine.current.enableAudio();
74
+ dispatch({
75
+ type: 'LocalPermissionState',
76
+ value: [PermissionState.GRANTED_FOR_MIC_ONLY],
77
+ });
40
78
  dispatch({
41
79
  type: 'LocalMuteAudio',
42
80
  value: [ToggleState.disabled],
43
81
  });
44
82
  } else {
45
83
  await engine.current.enableVideo();
84
+ dispatch({
85
+ type: 'LocalPermissionState',
86
+ value: [PermissionState.GRANTED_FOR_CAM_AND_MIC],
87
+ });
46
88
  dispatch({
47
89
  type: 'LocalMuteAudio',
48
90
  value: [ToggleState.disabled],
@@ -75,20 +117,33 @@ const Create = ({
75
117
  } else {
76
118
  console.error('No video device', videoError);
77
119
  }
120
+ dispatchPermissionState(audioError, videoError);
78
121
  }
79
122
  console.error('No devices', error);
80
123
  }
81
124
  };
82
125
  const enableVideoAndAudioWithEnabledState = async () => {
83
126
  try {
127
+ dispatch({
128
+ type: 'LocalPermissionState',
129
+ value: [PermissionState.REQUESTED],
130
+ });
84
131
  if (audioRoom === true) {
85
132
  await engine.current.enableAudio();
133
+ dispatch({
134
+ type: 'LocalPermissionState',
135
+ value: [PermissionState.GRANTED_FOR_MIC_ONLY],
136
+ });
86
137
  dispatch({
87
138
  type: 'LocalMuteAudio',
88
139
  value: [ToggleState.enabled],
89
140
  });
90
141
  } else {
91
142
  await engine.current.enableVideo();
143
+ dispatch({
144
+ type: 'LocalPermissionState',
145
+ value: [PermissionState.GRANTED_FOR_CAM_AND_MIC],
146
+ });
92
147
  dispatch({
93
148
  type: 'LocalMuteAudio',
94
149
  value: [ToggleState.enabled],
@@ -122,6 +177,7 @@ const Create = ({
122
177
  } else {
123
178
  console.error('No video device', videoError);
124
179
  }
180
+ dispatchPermissionState(audioError, videoError);
125
181
  }
126
182
  console.error('No devices', e);
127
183
  }
@@ -131,14 +187,15 @@ const Create = ({
131
187
  mode == ChannelProfile.LiveBroadcasting &&
132
188
  rtcProps?.role == ClientRole.Audience
133
189
  ) {
134
- enableVideoAndAudioWithDisabledState();
190
+ await enableVideoAndAudioWithDisabledState();
135
191
  } else {
136
- enableVideoAndAudioWithEnabledState();
192
+ await enableVideoAndAudioWithEnabledState();
137
193
  }
138
194
  };
139
195
 
140
196
  useEffect(() => {
141
197
  async function init() {
198
+ mutexLock.current = true;
142
199
  if (Platform.OS === 'android') {
143
200
  //Request required permissions from Android
144
201
  await requestCameraAndAudioPermission(audioRoom);
@@ -177,6 +234,9 @@ const Create = ({
177
234
  } else {
178
235
  await engine.current.setChannelProfile(ChannelProfile.Communication);
179
236
  }
237
+ if (activeSpeaker) {
238
+ await engine.current.enableAudioVolumeIndication(500, 3, true);
239
+ }
180
240
  if (!audioRoom) {
181
241
  if (rtcProps.profile) {
182
242
  if (Platform.OS === 'web') {
@@ -277,12 +337,16 @@ const Create = ({
277
337
  value: args,
278
338
  });
279
339
  });
340
+
280
341
  setReady(true);
281
342
  } catch (e) {
282
343
  console.error(e);
283
344
  }
345
+ mutexLock.current = false;
346
+ }
347
+ if (!mutexLock.current) {
348
+ init();
284
349
  }
285
- init();
286
350
  return () => {
287
351
  /**
288
352
  * if condition add for websdk issue
@@ -293,11 +357,14 @@ const Create = ({
293
357
  engine.current!.destroy();
294
358
  }
295
359
  };
296
- }, [rtcProps.appId]);
360
+ }, [rtcProps.appId, rtcProps.uid]);
297
361
 
298
362
  useEffect(() => {
299
363
  const toggleRole = async () => {
300
- if (mode == ChannelProfile.LiveBroadcasting) {
364
+ if (
365
+ mode == ChannelProfile.LiveBroadcasting &&
366
+ engine.current.setClientRole // Check if engine initialized
367
+ ) {
301
368
  if (rtcProps.role == ClientRole.Broadcaster) {
302
369
  await engine.current?.setClientRole(ClientRole.Broadcaster);
303
370
  // isVideoEnabledRef checks if the permission is already taken once