agora-appbuilder-core 3.0.9 → 3.0.10

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 (248) 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/Contexts/LocalUserContext.tsx +4 -0
  5. package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +18 -0
  6. package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +2 -0
  7. package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +30 -26
  8. package/template/agora-rn-uikit/src/Controls/Icons.ts +30 -83
  9. package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +6 -6
  10. package/template/agora-rn-uikit/src/Reducer/ActiveSpeakerDetected.ts +11 -0
  11. package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +1 -0
  12. package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +1 -0
  13. package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +24 -0
  14. package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +1 -0
  15. package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +1 -0
  16. package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +1 -0
  17. package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +2 -0
  18. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +1 -0
  19. package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +1 -0
  20. package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +1 -0
  21. package/template/agora-rn-uikit/src/Reducer/UserPin.ts +11 -0
  22. package/template/agora-rn-uikit/src/Reducer/index.ts +3 -0
  23. package/template/agora-rn-uikit/src/Rtc/Create.tsx +89 -1
  24. package/template/agora-rn-uikit/src/RtcConfigure.tsx +39 -2
  25. package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +15 -5
  26. package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +15 -9
  27. package/template/agora-rn-uikit/src/index.ts +3 -1
  28. package/template/android/app/build.gradle +1 -0
  29. package/template/android/app/src/main/AndroidManifest.xml +22 -15
  30. package/template/android/app/src/main/assets/fonts/SourceSansPro-Regular.ttf +0 -0
  31. package/template/android/app/src/main/assets/fonts/icomoon.ttf +0 -0
  32. package/template/android/app/src/main/java/com/helloworld/MainActivity.java +50 -0
  33. package/template/android/app/src/main/res/values/colors.xml +7 -0
  34. package/template/android/build.gradle +3 -3
  35. package/template/babel.config.js +1 -0
  36. package/template/bridge/rtc/webNg/RtcEngine.ts +110 -17
  37. package/template/customization-api/sub-components.ts +1 -1
  38. package/template/customization-api/typeDefinition.ts +2 -1
  39. package/template/electron/index.html +27 -27
  40. package/template/electron/renderer/index.js +1 -0
  41. package/template/global.d.ts +25 -4
  42. package/template/index.rsdk.tsx +1 -0
  43. package/template/index.web.js +2 -1
  44. package/template/index.wsdk.tsx +1 -1
  45. package/template/ios/HelloWorld/Info.plist +14 -1
  46. package/template/ios/HelloWorld.xcodeproj/project.pbxproj +17 -0
  47. package/template/metro.config.js +1 -1
  48. package/template/package.json +18 -7
  49. package/template/react-native-toast-message/index.d.ts +43 -43
  50. package/template/react-native-toast-message/src/colors/index.js +3 -2
  51. package/template/react-native-toast-message/src/components/base/index.js +46 -59
  52. package/template/react-native-toast-message/src/components/base/styles.js +16 -32
  53. package/template/react-native-toast-message/src/components/checkbox.js +178 -0
  54. package/template/react-native-toast-message/src/components/error.js +3 -2
  55. package/template/react-native-toast-message/src/components/info.js +3 -2
  56. package/template/react-native-toast-message/src/components/success.js +3 -2
  57. package/template/react-native-toast-message/src/index.js +122 -31
  58. package/template/react-native-toast-message/src/index.sdk.tsx +125 -35
  59. package/template/react-native-toast-message/src/styles.js +3 -4
  60. package/template/react-native-toast-message/src/styles.sdk.ts +3 -4
  61. package/template/react-native.config.js +7 -0
  62. package/template/src/App.tsx +6 -0
  63. package/template/src/AppWrapper.tsx +63 -28
  64. package/template/src/assets/font-styles.css +329 -0
  65. package/template/src/assets/fonts/SourceSansPro-Regular.ttf +0 -0
  66. package/template/src/assets/fonts/icomoon.ttf +0 -0
  67. package/template/src/assets/permission.png +0 -0
  68. package/template/src/assets/selection.json +1 -0
  69. package/template/src/atoms/ActionMenu.tsx +236 -0
  70. package/template/src/atoms/AnimatedActiveSpeaker.native.tsx +71 -0
  71. package/template/src/atoms/AnimatedActiveSpeaker.tsx +84 -0
  72. package/template/src/atoms/AnimatedRings.native.tsx +68 -0
  73. package/template/src/atoms/AnimatedRings.tsx +70 -0
  74. package/template/src/atoms/Card.tsx +61 -0
  75. package/template/src/atoms/CircularProgress.native.tsx +121 -0
  76. package/template/src/atoms/CircularProgress.tsx +102 -0
  77. package/template/src/atoms/CustomIcon.tsx +88 -0
  78. package/template/src/atoms/CustomSwitch.tsx +287 -0
  79. package/template/src/atoms/Dropdown.tsx +306 -0
  80. package/template/src/atoms/HorizontalRule.tsx +3 -1
  81. package/template/src/atoms/IconButton.tsx +162 -0
  82. package/template/src/atoms/ImageIcon.tsx +98 -0
  83. package/template/src/atoms/InfoBubble.tsx +291 -0
  84. package/template/src/atoms/Input.tsx +87 -0
  85. package/template/src/atoms/InviteInfo.tsx +166 -0
  86. package/template/src/atoms/LinkButton.tsx +28 -0
  87. package/template/src/atoms/OutlineButton.tsx +61 -0
  88. package/template/src/atoms/ParticipantsCount.tsx +73 -0
  89. package/template/src/atoms/Popup.tsx +147 -0
  90. package/template/src/atoms/PrimaryButton.tsx +51 -26
  91. package/template/src/atoms/RecordingInfo.tsx +49 -0
  92. package/template/src/atoms/SecondaryButton.tsx +8 -5
  93. package/template/src/atoms/Spacer.tsx +22 -0
  94. package/template/src/atoms/TertiaryButton.tsx +78 -0
  95. package/template/src/atoms/TextInput.tsx +12 -14
  96. package/template/src/atoms/Toggle.tsx +47 -0
  97. package/template/src/atoms/Tooltip.native.tsx +65 -0
  98. package/template/src/atoms/Tooltip.tsx +94 -0
  99. package/template/src/atoms/UserAvatar.tsx +60 -0
  100. package/template/src/components/Chat.tsx +86 -214
  101. package/template/src/components/ChatContext.ts +8 -1
  102. package/template/src/components/ColorConfigure.tsx +1 -1
  103. package/template/src/components/ColorContext.ts +1 -1
  104. package/template/src/components/CommonStyles.ts +44 -0
  105. package/template/src/components/Controls.tsx +342 -42
  106. package/template/src/components/{Controls.native.tsx → Controls1.native.tsx} +6 -4
  107. package/template/src/components/DeviceConfigure.tsx +461 -101
  108. package/template/src/components/DeviceContext.tsx +8 -4
  109. package/template/src/components/EventsConfigure.tsx +144 -7
  110. package/template/src/components/GraphQLProvider.tsx +1 -1
  111. package/template/src/components/GridVideo.tsx +59 -44
  112. package/template/src/components/HostControlView.tsx +114 -35
  113. package/template/src/components/Navbar.tsx +216 -398
  114. package/template/src/components/NetworkQualityContext.tsx +20 -20
  115. package/template/src/components/ParticipantsView.tsx +177 -154
  116. package/template/src/components/PinnedVideo.tsx +207 -120
  117. package/template/src/components/Precall.native.tsx +358 -119
  118. package/template/src/components/Precall.tsx +269 -135
  119. package/template/src/components/RTMConfigure.tsx +27 -4
  120. package/template/src/components/Router.electron.ts +1 -0
  121. package/template/src/components/Router.native.ts +1 -0
  122. package/template/src/components/Router.sdk.ts +1 -0
  123. package/template/src/components/Router.ts +1 -0
  124. package/template/src/components/Settings.tsx +26 -95
  125. package/template/src/components/SettingsView.tsx +251 -56
  126. package/template/src/components/Share.tsx +302 -273
  127. package/template/src/components/StorageContext.tsx +30 -3
  128. package/template/src/components/ToastComponent.tsx +8 -0
  129. package/template/src/components/chat-messages/useChatMessages.tsx +69 -23
  130. package/template/src/components/chat-ui/useChatUIControl.tsx +7 -0
  131. package/template/src/components/common/Error.tsx +20 -6
  132. package/template/src/components/common/Logo.tsx +16 -15
  133. package/template/src/components/contexts/LiveStreamDataContext.tsx +10 -5
  134. package/template/src/components/contexts/VideoMeetingDataContext.tsx +37 -7
  135. package/template/src/components/livestream/LiveStreamContext.tsx +270 -36
  136. package/template/src/components/livestream/Types.ts +39 -14
  137. package/template/src/components/livestream/index.ts +1 -0
  138. package/template/src/components/livestream/views/LiveStreamControls.tsx +12 -4
  139. package/template/src/components/participants/AllAudienceParticipants.tsx +101 -30
  140. package/template/src/components/participants/AllHostParticipants.tsx +103 -34
  141. package/template/src/components/participants/Participant.tsx +302 -0
  142. package/template/src/components/participants/ParticipantName.tsx +13 -7
  143. package/template/src/components/participants/ParticipantSectionTitle.tsx +35 -10
  144. package/template/src/components/participants/ScreenshareParticipants.tsx +144 -12
  145. package/template/src/components/participants/UserActionMenuOptions.tsx +398 -0
  146. package/template/src/components/popups/InvitePopup.tsx +115 -0
  147. package/template/src/components/popups/StopRecordingPopup.tsx +114 -0
  148. package/template/src/components/precall/LocalMute.tsx +84 -14
  149. package/template/src/components/precall/{LocalMute.native.tsx → LocalMute1.native.tsx} +21 -5
  150. package/template/src/components/precall/PermissionHelper.native.tsx +5 -0
  151. package/template/src/components/precall/PermissionHelper.tsx +126 -0
  152. package/template/src/components/precall/PreCallSettings.tsx +52 -0
  153. package/template/src/components/precall/VideoPreview.native.tsx +48 -3
  154. package/template/src/components/precall/VideoPreview.tsx +163 -7
  155. package/template/src/components/precall/joinCallBtn.tsx +15 -2
  156. package/template/src/components/precall/meetingTitle.tsx +15 -12
  157. package/template/src/components/precall/selectDevice.tsx +1 -21
  158. package/template/src/components/precall/textInput.tsx +32 -4
  159. package/template/src/components/precall/usePreCall.tsx +16 -0
  160. package/template/src/components/styles.ts +42 -21
  161. package/template/src/components/useShareLink.tsx +12 -14
  162. package/template/src/components/useToast.tsx +41 -0
  163. package/template/src/components/useVideoCall.tsx +65 -0
  164. package/template/src/language/default-labels/precallScreenLabels.ts +3 -3
  165. package/template/src/pages/Authenticate.tsx +5 -15
  166. package/template/src/pages/Create.tsx +293 -165
  167. package/template/src/pages/Endcall.tsx +148 -0
  168. package/template/src/pages/Join.tsx +93 -67
  169. package/template/src/pages/VideoCall.tsx +89 -64
  170. package/template/src/pages/video-call/ActionSheet.native.tsx +215 -0
  171. package/template/src/pages/video-call/ActionSheet.tsx +226 -0
  172. package/template/src/pages/video-call/ActionSheetContent.tsx +479 -0
  173. package/template/src/pages/video-call/ActionSheetHandle.tsx +38 -0
  174. package/template/src/pages/video-call/ActionSheetStyles.css +138 -0
  175. package/template/src/pages/video-call/DefaultLayouts.ts +4 -4
  176. package/template/src/pages/video-call/NameWithMicIcon.tsx +120 -44
  177. package/template/src/pages/video-call/RenderComponent.tsx +3 -2
  178. package/template/src/pages/video-call/SidePanelHeader.tsx +190 -0
  179. package/template/src/pages/video-call/VideoCallMobileView.tsx +139 -0
  180. package/template/src/pages/video-call/VideoCallScreen.native.tsx +37 -0
  181. package/template/src/pages/video-call/VideoCallScreen.tsx +45 -9
  182. package/template/src/pages/video-call/VideoComponent.tsx +18 -3
  183. package/template/src/pages/video-call/VideoRenderer.tsx +218 -60
  184. package/template/src/rtm-events/constants.ts +2 -0
  185. package/template/src/subComponents/ChatBubble.tsx +123 -83
  186. package/template/src/subComponents/ChatContainer.tsx +257 -84
  187. package/template/src/subComponents/ChatInput.ios.tsx +237 -0
  188. package/template/src/subComponents/ChatInput.tsx +61 -46
  189. package/template/src/subComponents/Checkbox.native.tsx +16 -5
  190. package/template/src/subComponents/Checkbox.tsx +2 -2
  191. package/template/src/subComponents/CopyJoinInfo.tsx +36 -58
  192. package/template/src/subComponents/EndcallPopup.tsx +107 -0
  193. package/template/src/subComponents/FallbackLogo.tsx +122 -40
  194. package/template/src/subComponents/LanguageSelector.tsx +1 -1
  195. package/template/src/subComponents/LayoutIconButton.tsx +201 -0
  196. package/template/src/subComponents/LayoutIconDropdown.tsx +131 -134
  197. package/template/src/subComponents/{LayoutIconDropdown.native.tsx → LayoutIconDropdown1.native.tsx} +4 -18
  198. package/template/src/subComponents/LocalAudioMute.tsx +119 -27
  199. package/template/src/subComponents/LocalEndCall.tsx +71 -33
  200. package/template/src/subComponents/LocalSwitchCamera.tsx +17 -30
  201. package/template/src/subComponents/LocalVideoMute.tsx +117 -27
  202. package/template/src/subComponents/Logo.tsx +3 -4
  203. package/template/src/subComponents/LogoutButton.tsx +1 -1
  204. package/template/src/subComponents/NetworkQualityPill.tsx +60 -63
  205. package/template/src/subComponents/OpenInNativeButton.tsx +3 -3
  206. package/template/src/subComponents/Recording.tsx +28 -29
  207. package/template/src/subComponents/RemoteAudioMute.tsx +83 -29
  208. package/template/src/subComponents/RemoteEndCall.tsx +8 -5
  209. package/template/src/subComponents/RemoteMutePopup.tsx +193 -0
  210. package/template/src/subComponents/RemoteVideoMute.tsx +74 -21
  211. package/template/src/subComponents/RemoveMeetingPopup.tsx +109 -0
  212. package/template/src/subComponents/RemoveScreensharePopup.tsx +109 -0
  213. package/template/src/subComponents/ScreenShareNotice.tsx +83 -8
  214. package/template/src/subComponents/SelectDevice.tsx +404 -61
  215. package/template/src/subComponents/SelectDeviceSettings.backup.tsx +207 -0
  216. package/template/src/subComponents/SelectOAuth.tsx +9 -8
  217. package/template/src/subComponents/SidePanelHeader.tsx +112 -0
  218. package/template/src/subComponents/ToastConfig.tsx +150 -10
  219. package/template/src/subComponents/chat/ChatParticipants.tsx +187 -78
  220. package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +95 -32
  221. package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +29 -33
  222. package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +6 -6
  223. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +24 -11
  224. package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +17 -10
  225. package/template/src/subComponents/recording/useRecording.tsx +79 -27
  226. package/template/src/subComponents/screenshare/ScreenshareButton.tsx +52 -70
  227. package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +11 -2
  228. package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +26 -4
  229. package/template/src/theme/index.ts +46 -0
  230. package/template/src/utils/PlatformWrapper.tsx +21 -0
  231. package/template/src/utils/common.tsx +155 -1
  232. package/template/src/utils/hexadecimalTransparency.ts +108 -0
  233. package/template/src/utils/index.tsx +19 -0
  234. package/template/src/utils/isMobileOrTablet.ts +7 -2
  235. package/template/src/utils/pendingStateUpdateHelper.ts +19 -0
  236. package/template/src/utils/useButtonTemplate.tsx +1 -0
  237. package/template/src/utils/useFocus.tsx +46 -0
  238. package/template/src/utils/useIsActiveSpeaker.ts +27 -0
  239. package/template/src/utils/useIsHandRaised.ts +13 -0
  240. package/template/src/utils/useMuteToggleLocal.ts +54 -3
  241. package/template/src/utils/useRemoteEndScreenshare.ts +26 -0
  242. package/template/src/utils/useRemoteRequest.ts +84 -0
  243. package/template/web/index.html +5 -0
  244. package/template/webpack.commons.js +13 -8
  245. package/template/webpack.web.config.js +1 -0
  246. package/template/src/assets/icons.ts +0 -102
  247. package/template/src/components/participants/MeParticipant.tsx +0 -38
  248. package/template/src/components/participants/RemoteParticipants.tsx +0 -71
@@ -13,6 +13,7 @@ export default function RemoteAudioStateChanged(
13
13
  }
14
14
 
15
15
  const stateUpdate: RenderStateInterface = {
16
+ activeSpeaker: state.activeSpeaker,
16
17
  renderList: {
17
18
  ...state.renderList,
18
19
  [action.value[0]]: {
@@ -13,6 +13,7 @@ export default function RemoteVideoStateChanged(
13
13
  }
14
14
 
15
15
  const stateUpdate: RenderStateInterface = {
16
+ activeSpeaker: state.activeSpeaker,
16
17
  renderList: {
17
18
  ...state.renderList,
18
19
  [action.value[0]]: {
@@ -36,6 +36,7 @@ export default function UpdateDualStreamMode(
36
36
  minUids.forEach(setLowStreamType);
37
37
  }
38
38
  stateUpdate = {
39
+ activeSpeaker: state.activeSpeaker,
39
40
  renderList: renderList,
40
41
  activeUids: [...state.activeUids],
41
42
  };
@@ -44,6 +44,7 @@ export default function UserJoined(
44
44
  }
45
45
  //Swap render positions
46
46
  stateUpdate = {
47
+ activeSpeaker: state.activeSpeaker,
47
48
  renderList: renderList,
48
49
  activeUids: activeUids.reverse(),
49
50
  lastJoinedUid: newUid,
@@ -51,6 +52,7 @@ export default function UserJoined(
51
52
  } else {
52
53
  //More than one remote
53
54
  stateUpdate = {
55
+ activeSpeaker: state.activeSpeaker,
54
56
  renderList: renderList,
55
57
  activeUids: activeUids,
56
58
  lastJoinedUid: newUid,
@@ -5,6 +5,7 @@ export default function UserMuteRemoteAudio(
5
5
  action: ActionType<'UserMuteRemoteAudio'>,
6
6
  ) {
7
7
  let stateUpdate: RenderStateInterface = {
8
+ activeSpeaker: state.activeSpeaker,
8
9
  renderList: {
9
10
  ...state.renderList,
10
11
  [action.value[0]]: {
@@ -5,6 +5,7 @@ export default function UserMuteRemoteVideo(
5
5
  action: ActionType<'UserMuteRemoteVideo'>,
6
6
  ) {
7
7
  let stateUpdate: RenderStateInterface = {
8
+ activeSpeaker: state.activeSpeaker,
8
9
  renderList: {
9
10
  ...state.renderList,
10
11
  [action.value[0]]: {
@@ -16,6 +16,7 @@ export default function UserOffline(
16
16
  (uid) => uid !== action.value[0],
17
17
  );
18
18
  const stateUpdate: RenderStateInterface = {
19
+ activeSpeaker: state.activeSpeaker,
19
20
  renderList: state.renderList,
20
21
  activeUids: updatedActiveUids,
21
22
  };
@@ -0,0 +1,11 @@
1
+ import {ActionType, RenderStateInterface} from '../Contexts/RtcContext';
2
+
3
+ export default function UserPin(
4
+ state: RenderStateInterface,
5
+ action: ActionType<'UserPin'>,
6
+ ) {
7
+ return {
8
+ ...state,
9
+ pinnedUid: action?.value && action.value?.length ? action.value[0] : '',
10
+ };
11
+ }
@@ -5,5 +5,8 @@ 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 ActiveSpeakerDetected} from './ActiveSpeakerDetected';
12
+ export {default as UserPin} from './UserPin';
@@ -12,6 +12,7 @@ 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
 
@@ -33,16 +34,52 @@ const Create = ({
33
34
  const isVideoEnabledRef = useRef<boolean>(false);
34
35
  const firstUpdate = useRef(true);
35
36
 
37
+ const dispatchPermissionState = (audioError: any, videoError: any) => {
38
+ if (audioError && videoError) {
39
+ dispatch({
40
+ type: 'LocalPermissionState',
41
+ value: [PermissionState.REJECTED],
42
+ });
43
+ } else if (audioError && !videoError) {
44
+ dispatch({
45
+ type: 'LocalPermissionState',
46
+ value: [PermissionState.GRANTED_FOR_CAM_ONLY],
47
+ });
48
+ } else if (!audioError && videoError) {
49
+ dispatch({
50
+ type: 'LocalPermissionState',
51
+ value: [PermissionState.GRANTED_FOR_MIC_ONLY],
52
+ });
53
+ } else {
54
+ dispatch({
55
+ type: 'LocalPermissionState',
56
+ value: [PermissionState.GRANTED_FOR_CAM_AND_MIC],
57
+ });
58
+ }
59
+ };
60
+
36
61
  const enableVideoAndAudioWithDisabledState = async () => {
37
62
  try {
63
+ dispatch({
64
+ type: 'LocalPermissionState',
65
+ value: [PermissionState.REQUESTED],
66
+ });
38
67
  if (audioRoom === true) {
39
68
  await engine.current.enableAudio();
69
+ dispatch({
70
+ type: 'LocalPermissionState',
71
+ value: [PermissionState.GRANTED_FOR_MIC_ONLY],
72
+ });
40
73
  dispatch({
41
74
  type: 'LocalMuteAudio',
42
75
  value: [ToggleState.disabled],
43
76
  });
44
77
  } else {
45
78
  await engine.current.enableVideo();
79
+ dispatch({
80
+ type: 'LocalPermissionState',
81
+ value: [PermissionState.GRANTED_FOR_CAM_AND_MIC],
82
+ });
46
83
  dispatch({
47
84
  type: 'LocalMuteAudio',
48
85
  value: [ToggleState.disabled],
@@ -75,20 +112,33 @@ const Create = ({
75
112
  } else {
76
113
  console.error('No video device', videoError);
77
114
  }
115
+ dispatchPermissionState(audioError, videoError);
78
116
  }
79
117
  console.error('No devices', error);
80
118
  }
81
119
  };
82
120
  const enableVideoAndAudioWithEnabledState = async () => {
83
121
  try {
122
+ dispatch({
123
+ type: 'LocalPermissionState',
124
+ value: [PermissionState.REQUESTED],
125
+ });
84
126
  if (audioRoom === true) {
85
127
  await engine.current.enableAudio();
128
+ dispatch({
129
+ type: 'LocalPermissionState',
130
+ value: [PermissionState.GRANTED_FOR_MIC_ONLY],
131
+ });
86
132
  dispatch({
87
133
  type: 'LocalMuteAudio',
88
134
  value: [ToggleState.enabled],
89
135
  });
90
136
  } else {
91
137
  await engine.current.enableVideo();
138
+ dispatch({
139
+ type: 'LocalPermissionState',
140
+ value: [PermissionState.GRANTED_FOR_CAM_AND_MIC],
141
+ });
92
142
  dispatch({
93
143
  type: 'LocalMuteAudio',
94
144
  value: [ToggleState.enabled],
@@ -122,6 +172,7 @@ const Create = ({
122
172
  } else {
123
173
  console.error('No video device', videoError);
124
174
  }
175
+ dispatchPermissionState(audioError, videoError);
125
176
  }
126
177
  console.error('No devices', e);
127
178
  }
@@ -177,6 +228,7 @@ const Create = ({
177
228
  } else {
178
229
  await engine.current.setChannelProfile(ChannelProfile.Communication);
179
230
  }
231
+ await engine.current.enableAudioVolumeIndication(500, 3, true);
180
232
  if (!audioRoom) {
181
233
  if (rtcProps.profile) {
182
234
  if (Platform.OS === 'web') {
@@ -277,6 +329,42 @@ const Create = ({
277
329
  value: args,
278
330
  });
279
331
  });
332
+
333
+ engine.current.addListener('AudioVolumeIndication', (...args) => {
334
+ // console.log('-- AudioVolumeCallback', args);
335
+ const [speakers, totalVolume] = args;
336
+ if (speakers[0]?.uid === 0) {
337
+ //callback for local user
338
+ const isLocalUserSpeaking = speakers[0].vad; //1-speaking , 0-not speaking
339
+ const localUserVolumeLevel = speakers[0].volume;
340
+ // vad value is not consistent while speaking so using volume level
341
+ if (localUserVolumeLevel > 0) {
342
+ dispatch({
343
+ type: 'ActiveSpeakerDetected',
344
+ value: [rtcProps.uid],
345
+ });
346
+ } else {
347
+ dispatch({
348
+ type: 'ActiveSpeakerDetected',
349
+ value: [undefined],
350
+ });
351
+ }
352
+ } else {
353
+ // remote users callback, this will be handeled in ActiveSpeaker callback(367)
354
+ // const highestvolumeObj = speakers.reduce(function (prev, current) {
355
+ // return prev.volume > current.volume ? prev : current;
356
+ // }, null);
357
+ }
358
+ });
359
+
360
+ engine.current.addListener('ActiveSpeaker', (...args) => {
361
+ // used as a callback from the web bridge as well remote users
362
+ dispatch({
363
+ type: 'ActiveSpeakerDetected',
364
+ value: args,
365
+ });
366
+ });
367
+
280
368
  setReady(true);
281
369
  } catch (e) {
282
370
  console.error(e);
@@ -293,7 +381,7 @@ const Create = ({
293
381
  engine.current!.destroy();
294
382
  }
295
383
  };
296
- }, [rtcProps.appId]);
384
+ }, [rtcProps.appId, rtcProps.uid]);
297
385
 
298
386
  useEffect(() => {
299
387
  const toggleRole = async () => {
@@ -11,13 +11,18 @@ import PropsContext, {
11
11
  RtcPropsInterface,
12
12
  CallbacksInterface,
13
13
  DualStreamMode,
14
+ PermissionState,
15
+ ChannelProfile,
16
+ ClientRole,
14
17
  } from './Contexts/PropsContext';
15
18
  import {RenderProvider} from './Contexts/RenderContext';
16
19
  import {actionTypeGuard} from './Utils/actionTypeGuard';
17
20
 
18
21
  import {
22
+ ActiveSpeakerDetected,
19
23
  LocalMuteAudio,
20
24
  LocalMuteVideo,
25
+ LocalPermissionState,
21
26
  RemoteAudioStateChanged,
22
27
  RemoteVideoStateChanged,
23
28
  UpdateDualStreamMode,
@@ -25,13 +30,14 @@ import {
25
30
  UserMuteRemoteAudio,
26
31
  UserMuteRemoteVideo,
27
32
  UserOffline,
33
+ UserPin,
28
34
  } from './Reducer';
29
35
  import Create from './Rtc/Create';
30
36
  import Join from './Rtc/Join';
31
37
  import useLocalUid from './Utils/useLocalUid';
32
38
 
33
39
  const RtcConfigure = (props: {children: React.ReactNode}) => {
34
- const {callbacks, rtcProps} = useContext(PropsContext);
40
+ const {callbacks, rtcProps, mode} = useContext(PropsContext);
35
41
  let [dualStreamMode, setDualStreamMode] = useState<DualStreamMode>(
36
42
  rtcProps?.initialDualStreamMode || DualStreamMode.DYNAMIC,
37
43
  );
@@ -44,9 +50,12 @@ const RtcConfigure = (props: {children: React.ReactNode}) => {
44
50
  video: ToggleState.disabled,
45
51
  streamType: 'high',
46
52
  type: 'rtc',
53
+ permissionStatus: PermissionState.NOT_REQUESTED,
47
54
  },
48
55
  },
49
56
  activeUids: [localUid],
57
+ activeSpeaker: undefined,
58
+ pinnedUid: undefined,
50
59
  lastJoinedUid: 0,
51
60
  };
52
61
 
@@ -172,6 +181,11 @@ const RtcConfigure = (props: {children: React.ReactNode}) => {
172
181
  stateUpdate = LocalMuteVideo(state, action, localUid);
173
182
  }
174
183
  break;
184
+ case 'LocalPermissionState':
185
+ if (actionTypeGuard(action, action.type)) {
186
+ stateUpdate = LocalPermissionState(state, action, localUid);
187
+ }
188
+ break;
175
189
  case 'RemoteAudioStateChanged':
176
190
  if (actionTypeGuard(action, action.type)) {
177
191
  stateUpdate = RemoteAudioStateChanged(state, action);
@@ -182,6 +196,16 @@ const RtcConfigure = (props: {children: React.ReactNode}) => {
182
196
  stateUpdate = RemoteVideoStateChanged(state, action);
183
197
  }
184
198
  break;
199
+ case 'ActiveSpeakerDetected':
200
+ if (actionTypeGuard(action, action.type)) {
201
+ stateUpdate = ActiveSpeakerDetected(state, action);
202
+ }
203
+ break;
204
+ case 'UserPin':
205
+ if (actionTypeGuard(action, action.type)) {
206
+ stateUpdate = UserPin(state, action);
207
+ }
208
+ break;
185
209
  }
186
210
 
187
211
  // TODO: remove Handle event listeners
@@ -247,6 +271,7 @@ const RtcConfigure = (props: {children: React.ReactNode}) => {
247
271
  return {
248
272
  activeUids: activeUids,
249
273
  renderList: renderList,
274
+ activeSpeaker: state.activeSpeaker,
250
275
  };
251
276
  },
252
277
  [dualStreamMode],
@@ -292,6 +317,7 @@ const RtcConfigure = (props: {children: React.ReactNode}) => {
292
317
  activeUids = [newMaxUid, currentMaxUid, ...minIds];
293
318
 
294
319
  return {
320
+ activeSpeaker: state.activeSpeaker,
295
321
  activeUids: activeUids,
296
322
  renderList: renderList,
297
323
  };
@@ -321,7 +347,18 @@ const RtcConfigure = (props: {children: React.ReactNode}) => {
321
347
  <RenderProvider
322
348
  value={{
323
349
  renderList: uidState.renderList,
324
- activeUids: uidState.activeUids,
350
+ activeUids:
351
+ //In livestreaming mode ->audience should not see their local video tile
352
+ mode == ChannelProfile.LiveBroadcasting &&
353
+ rtcProps?.role == ClientRole.Audience
354
+ ? uidState.activeUids.filter((i) => i !== localUid)
355
+ : uidState.activeUids,
356
+ activeSpeaker: uidState.activeSpeaker,
357
+ pinnedUid:
358
+ uidState?.pinnedUid &&
359
+ uidState?.activeUids?.indexOf(uidState.pinnedUid) !== -1
360
+ ? uidState.pinnedUid
361
+ : undefined,
325
362
  lastJoinedUid: uidState.lastJoinedUid,
326
363
  }}>
327
364
  {props.children}
@@ -2,7 +2,7 @@ import React, {useContext} from 'react';
2
2
  import {RtcLocalView, RtcRemoteView, VideoRenderMode} from 'react-native-agora';
3
3
  import styles from '../Style';
4
4
  import PropsContext, {RenderInterface} from '../Contexts/PropsContext';
5
- import {View} from 'react-native';
5
+ import {View, ViewStyle} from 'react-native';
6
6
  import useLocalUid from '../Utils/useLocalUid';
7
7
 
8
8
  const LocalView = RtcLocalView.SurfaceView;
@@ -11,35 +11,45 @@ const RemoteView = RtcRemoteView.SurfaceView;
11
11
  interface MaxViewInterface {
12
12
  user: RenderInterface;
13
13
  fallback?: React.ComponentType;
14
+ containerStyle?: ViewStyle;
14
15
  }
15
16
 
16
17
  const MaxVideoView: React.FC<MaxViewInterface> = (props) => {
17
18
  const {styleProps, rtcProps} = useContext(PropsContext);
18
19
  const {maxViewStyles} = styleProps || {};
20
+ const {containerStyle = {}} = props;
19
21
  const Fallback = props.fallback;
20
22
  const localUid = useLocalUid();
21
23
  const uid = props.user.uid === rtcProps?.screenShareUid ? 1 : props.user.uid;
22
24
  return uid === localUid ? (
23
25
  props.user.video ? (
24
26
  <LocalView
25
- style={{...styles.fullView, ...(maxViewStyles as object)}}
27
+ style={{
28
+ ...styles.fullView,
29
+ ...(maxViewStyles as object),
30
+ ...containerStyle,
31
+ }}
26
32
  renderMode={VideoRenderMode.Fit}
27
33
  />
28
34
  ) : Fallback ? (
29
35
  <Fallback />
30
36
  ) : (
31
- <View style={{flex: 1, backgroundColor: '#000'}} />
37
+ <View style={[{flex: 1, backgroundColor: '#000'}, containerStyle]} />
32
38
  )
33
39
  ) : props.user.video ? (
34
40
  <RemoteView
35
- style={{...styles.fullView, ...(maxViewStyles as object)}}
41
+ style={{
42
+ ...styles.fullView,
43
+ ...(maxViewStyles as object),
44
+ ...containerStyle,
45
+ }}
36
46
  uid={uid as number}
37
47
  renderMode={VideoRenderMode.Fit}
38
48
  />
39
49
  ) : Fallback ? (
40
50
  <Fallback />
41
51
  ) : (
42
- <View style={{flex: 1, backgroundColor: '#000'}} />
52
+ <View style={[{flex: 1, backgroundColor: '#000'}, containerStyle]} />
43
53
  );
44
54
  };
45
55
 
@@ -2,7 +2,7 @@ import React, {useContext} from 'react';
2
2
  import {RtcLocalView, RtcRemoteView, VideoRenderMode} from 'react-native-agora';
3
3
  import styles from '../Style';
4
4
  import PropsContext, {RenderInterface} from '../Contexts/PropsContext';
5
- import {View} from 'react-native';
5
+ import {View, ViewStyle} from 'react-native';
6
6
  import useLocalUid from '../Utils/useLocalUid';
7
7
 
8
8
  const LocalView = RtcLocalView.SurfaceView;
@@ -11,30 +11,34 @@ const RemoteView = RtcRemoteView.SurfaceView;
11
11
  interface MaxViewInterface {
12
12
  user: RenderInterface;
13
13
  fallback?: React.ComponentType;
14
+ containerStyle?: ViewStyle;
14
15
  }
15
16
 
16
17
  const MaxVideoView: React.FC<MaxViewInterface> = (props) => {
17
18
  const {styleProps, rtcProps} = useContext(PropsContext);
18
19
  const {maxViewStyles} = styleProps || {};
19
20
  const Fallback = props.fallback;
21
+ const {containerStyle = {}} = props;
20
22
  const localUid = useLocalUid();
21
23
  const uid = props.user.uid === rtcProps?.screenShareUid ? 1 : props.user.uid;
22
24
  return uid === localUid ? (
23
25
  props.user.video ? (
24
- <LocalView
25
- style={{...styles.fullView, ...(maxViewStyles as object)}}
26
- renderMode={VideoRenderMode.Fit}
27
- />
26
+ <LocalView style={containerStyle} renderMode={VideoRenderMode.Fit} />
28
27
  ) : Fallback ? (
29
28
  <Fallback />
30
29
  ) : (
31
- <View style={{flex: 1, backgroundColor: '#000'}} />
30
+ <View style={[{flex: 1, backgroundColor: '#000'}, containerStyle]} />
32
31
  )
33
32
  ) : (
34
33
  <>
35
- <div style={{flex: 1, display: props.user.video ? 'flex' : 'none'}}>
34
+ <div
35
+ style={{
36
+ flex: 1,
37
+ overflow: 'hidden',
38
+ display: props.user.video ? 'flex' : 'none',
39
+ }}>
36
40
  <RemoteView
37
- style={{...styles.fullView, ...(maxViewStyles as object)}}
41
+ style={containerStyle}
38
42
  uid={uid as number}
39
43
  renderMode={VideoRenderMode.Fit}
40
44
  />
@@ -46,7 +50,9 @@ const MaxVideoView: React.FC<MaxViewInterface> = (props) => {
46
50
  {Fallback ? (
47
51
  <Fallback />
48
52
  ) : (
49
- <View style={{flex: 1, backgroundColor: '#000'}} />
53
+ <View
54
+ style={[{flex: 1, backgroundColor: '#000'}, containerStyle]}
55
+ />
50
56
  )}
51
57
  </>
52
58
  )}
@@ -25,7 +25,7 @@ export {
25
25
 
26
26
  export {DualStreamMode} from './Contexts/PropsContext';
27
27
 
28
- export {ToggleState} from './Contexts/PropsContext';
28
+ export {ToggleState, PermissionState} from './Contexts/PropsContext';
29
29
 
30
30
  export type {
31
31
  DefaultRenderInterface,
@@ -67,4 +67,6 @@ export {default as RemoteVideoMute} from './Controls/Remote/RemoteVideoMute';
67
67
  export {default as RemoteControls} from './Controls/RemoteControls';
68
68
 
69
69
  export {default as ImageIcon} from './Controls/ImageIcon';
70
+ export {default as Icons} from './Controls/Icons';
71
+ export type {IconsInterface} from './Controls/Icons';
70
72
  export {default as useLocalUid} from './Utils/useLocalUid';
@@ -178,6 +178,7 @@ android {
178
178
 
179
179
  }
180
180
  }
181
+
181
182
  }
182
183
 
183
184
  dependencies {
@@ -1,27 +1,34 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
1
+ <manifest
2
+ xmlns:android="http://schemas.android.com/apk/res/android"
2
3
  package="com.helloworld">
3
-
4
- <uses-permission android:name="android.permission.INTERNET" />
5
-
6
- <application
4
+ <uses-permission android:name="android.permission.INTERNET" />
5
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
6
+ <uses-permission android:name="android.permission.WAKE_LOCK" />
7
+ <application
7
8
  android:name=".MainApplication"
8
9
  android:label="@string/app_name"
9
10
  android:icon="@mipmap/ic_launcher"
10
11
  android:roundIcon="@mipmap/ic_launcher_round"
11
12
  android:allowBackup="false"
12
13
  android:theme="@style/AppTheme">
13
- <activity
14
+ <activity
14
15
  android:name=".MainActivity"
15
16
  android:label="@string/app_name"
16
17
  android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
17
18
  android:launchMode="singleTask"
18
- android:windowSoftInputMode="adjustResize">
19
- <intent-filter>
20
- <action android:name="android.intent.action.MAIN" />
21
- <category android:name="android.intent.category.LAUNCHER" />
22
- </intent-filter>
23
- </activity>
24
- <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
25
- </application>
26
-
19
+ android:windowSoftInputMode="adjustResize"
20
+ android:screenOrientation="portrait"
21
+ android:exported="true">
22
+ <intent-filter>
23
+ <action android:name="android.intent.action.MAIN" />
24
+ <category android:name="android.intent.category.LAUNCHER" />
25
+ </intent-filter>
26
+ </activity>
27
+ <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
28
+ <meta-data android:name="com.supersami.foregroundservice.notification_channel_name" android:value="AppBuilder"/>
29
+ <meta-data android:name="com.supersami.foregroundservice.notification_channel_description" android:value="AppBuilder is running"/>
30
+ <meta-data android:name="com.supersami.foregroundservice.notification_color" android:resource="@color/blue"/>
31
+ <service android:name="com.supersami.foregroundservice.ForegroundService" />
32
+ <service android:name="com.supersami.foregroundservice.ForegroundServiceTask" />
33
+ </application>
27
34
  </manifest>
@@ -2,8 +2,58 @@ package com.helloworld;
2
2
 
3
3
  import com.facebook.react.ReactActivity;
4
4
 
5
+ // for bg audio
6
+ import android.content.Intent;
7
+ import android.util.Log;
8
+ import com.facebook.react.bridge.WritableMap;
9
+ import com.facebook.react.bridge.Arguments;
10
+ import com.facebook.react.modules.core.DeviceEventManagerModule;
11
+
5
12
  public class MainActivity extends ReactActivity {
6
13
 
14
+ // Added for bg audio till end of main activity
15
+ public boolean isOnNewIntent = false;
16
+
17
+ @Override
18
+ public void onNewIntent(Intent intent) {
19
+ super.onNewIntent(intent);
20
+ isOnNewIntent = true;
21
+ ForegroundEmitter();
22
+ }
23
+
24
+ @Override
25
+ protected void onStart() {
26
+ super.onStart();
27
+ if(isOnNewIntent == true){}else {
28
+ ForegroundEmitter();
29
+ }
30
+ }
31
+
32
+ public void ForegroundEmitter(){
33
+ // this method is to send back data from java to javascript so one can easily
34
+ // know which button from notification or the notification button is clicked
35
+ String main = getIntent().getStringExtra("mainOnPress");
36
+ String btn = getIntent().getStringExtra("buttonOnPress");
37
+ String btn2 = getIntent().getStringExtra("button2OnPress");
38
+ WritableMap map = Arguments.createMap();
39
+ if (main != null) {
40
+ map.putString("main", main);
41
+ }
42
+ if (btn != null) {
43
+ map.putString("button", btn);
44
+ }
45
+ if (btn2 != null) {
46
+ map.putString("button", btn);
47
+ }
48
+ try {
49
+ getReactInstanceManager().getCurrentReactContext()
50
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
51
+ .emit("notificationClickHandle", map);
52
+ } catch (Exception e) {
53
+ Log.e("SuperLog", "Caught Exception: " + e.getMessage());
54
+ }
55
+ }
56
+
7
57
  /**
8
58
  * Returns the name of the main component registered from JavaScript. This is used to schedule
9
59
  * rendering of the component.
@@ -0,0 +1,7 @@
1
+ <resources>
2
+ <item name="blue" type="color">#099DFD
3
+ </item>
4
+ <integer-array name="androidcolors">
5
+ <item>@color/blue</item>
6
+ </integer-array>
7
+ </resources>
@@ -4,15 +4,15 @@ buildscript {
4
4
  ext {
5
5
  buildToolsVersion = "29.0.2"
6
6
  minSdkVersion = 21
7
- compileSdkVersion = 29
8
- targetSdkVersion = 29
7
+ compileSdkVersion = 34
8
+ targetSdkVersion = 34
9
9
  }
10
10
  repositories {
11
11
  google()
12
12
  jcenter()
13
13
  }
14
14
  dependencies {
15
- classpath("com.android.tools.build:gradle:3.5.3")
15
+ classpath("com.android.tools.build:gradle:4.1.2")
16
16
  // NOTE: Do not place your application dependencies here; they belong
17
17
  // in the individual module build.gradle files
18
18
  }
@@ -29,5 +29,6 @@ module.exports = {
29
29
  },
30
30
  },
31
31
  ],
32
+ 'react-native-reanimated/plugin'
32
33
  ],
33
34
  };