agora-appbuilder-core 3.0.9 → 4.0.0-api.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.
- package/Readme.md +6 -0
- package/package.json +2 -2
- package/template/_package-lock.json +5871 -4728
- package/template/agora-rn-uikit/src/AgoraUIKit.tsx +6 -6
- package/template/agora-rn-uikit/src/Contexts/ContentContext.tsx +10 -0
- package/template/agora-rn-uikit/src/Contexts/DispatchContext.tsx +22 -0
- package/template/agora-rn-uikit/src/Contexts/LocalUserContext.tsx +10 -6
- package/template/agora-rn-uikit/src/Contexts/PropsContext.tsx +28 -8
- package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +7 -15
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +30 -26
- package/template/agora-rn-uikit/src/Controls/Icons.ts +30 -83
- package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +6 -6
- package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +4 -2
- package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +4 -2
- package/template/agora-rn-uikit/src/Controls/Local/Recording.tsx +0 -2
- package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +6 -6
- package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +5 -5
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +4 -4
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +4 -4
- package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +2 -2
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +6 -6
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +6 -6
- package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +23 -0
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +6 -6
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +7 -7
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +7 -7
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +10 -10
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteAudio.ts +6 -6
- package/template/agora-rn-uikit/src/Reducer/UserMuteRemoteVideo.ts +6 -6
- package/template/agora-rn-uikit/src/Reducer/UserOffline.ts +5 -5
- package/template/agora-rn-uikit/src/Reducer/UserPin.ts +11 -0
- package/template/agora-rn-uikit/src/Reducer/index.ts +2 -0
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +72 -5
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +5 -4
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +76 -49
- package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +17 -7
- package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +17 -11
- package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +2 -2
- package/template/agora-rn-uikit/src/index.ts +17 -9
- package/template/android/app/build.gradle +1 -0
- package/template/android/app/src/main/AndroidManifest.xml +22 -15
- package/template/android/app/src/main/assets/fonts/SourceSansPro-Regular.ttf +0 -0
- package/template/android/app/src/main/assets/fonts/icomoon.ttf +0 -0
- package/template/android/app/src/main/java/com/helloworld/MainActivity.java +50 -0
- package/template/android/app/src/main/res/values/colors.xml +7 -0
- package/template/android/build.gradle +3 -3
- package/template/babel.config.js +1 -0
- package/template/bridge/rtc/webNg/RtcEngine.ts +110 -17
- package/template/customization-api/action-library.ts +10 -14
- package/template/customization-api/app-state.ts +4 -6
- package/template/customization-api/customEvents.ts +2 -2
- package/template/customization-api/customize.ts +1 -1
- package/template/customization-api/sub-components.ts +4 -12
- package/template/customization-api/typeDefinition.ts +15 -38
- package/template/customization-implementation/createHook.ts +24 -6
- package/template/customization-implementation/index.ts +1 -1
- package/template/customization-implementation/useCustomization.tsx +5 -7
- package/template/electron/index.html +27 -27
- package/template/electron/renderer/index.js +1 -0
- package/template/global.d.ts +26 -4
- package/template/index.rsdk.tsx +1 -0
- package/template/index.web.js +2 -1
- package/template/index.wsdk.tsx +9 -2
- package/template/ios/HelloWorld/Info.plist +14 -1
- package/template/ios/HelloWorld.xcodeproj/project.pbxproj +17 -0
- package/template/metro.config.js +1 -1
- package/template/package.json +18 -7
- package/template/react-native-toast-message/index.d.ts +43 -43
- package/template/react-native-toast-message/src/colors/index.js +3 -2
- package/template/react-native-toast-message/src/components/base/index.js +46 -59
- package/template/react-native-toast-message/src/components/base/styles.js +16 -32
- package/template/react-native-toast-message/src/components/checkbox.js +178 -0
- package/template/react-native-toast-message/src/components/error.js +3 -2
- package/template/react-native-toast-message/src/components/info.js +3 -2
- package/template/react-native-toast-message/src/components/success.js +3 -2
- package/template/react-native-toast-message/src/index.js +122 -31
- package/template/react-native-toast-message/src/index.sdk.tsx +125 -35
- package/template/react-native-toast-message/src/styles.js +3 -4
- package/template/react-native-toast-message/src/styles.sdk.ts +3 -4
- package/template/react-native.config.js +7 -0
- package/template/src/App.tsx +19 -14
- package/template/src/AppWrapper.tsx +74 -29
- package/template/src/SDKAppWrapper.tsx +60 -64
- package/template/src/app-state/useLocalUserInfo.ts +3 -3
- package/template/src/assets/font-styles.css +329 -0
- package/template/src/assets/fonts/SourceSansPro-Regular.ttf +0 -0
- package/template/src/assets/fonts/icomoon.ttf +0 -0
- package/template/src/assets/permission.png +0 -0
- package/template/src/assets/selection.json +1 -0
- package/template/src/atoms/ActionMenu.tsx +236 -0
- package/template/src/atoms/AnimatedActiveSpeaker.native.tsx +71 -0
- package/template/src/atoms/AnimatedActiveSpeaker.tsx +84 -0
- package/template/src/atoms/AnimatedRings.native.tsx +68 -0
- package/template/src/atoms/AnimatedRings.tsx +70 -0
- package/template/src/atoms/Card.tsx +61 -0
- package/template/src/atoms/CircularProgress.native.tsx +121 -0
- package/template/src/atoms/CircularProgress.tsx +102 -0
- package/template/src/atoms/CustomIcon.tsx +88 -0
- package/template/src/atoms/CustomSwitch.tsx +287 -0
- package/template/src/atoms/Dropdown.tsx +306 -0
- package/template/src/atoms/HorizontalRule.tsx +3 -1
- package/template/src/atoms/IconButton.tsx +162 -0
- package/template/src/atoms/ImageIcon.tsx +98 -0
- package/template/src/atoms/InfoBubble.tsx +291 -0
- package/template/src/atoms/Input.tsx +87 -0
- package/template/src/atoms/InviteInfo.tsx +166 -0
- package/template/src/atoms/LinkButton.tsx +28 -0
- package/template/src/atoms/OutlineButton.tsx +61 -0
- package/template/src/atoms/ParticipantsCount.tsx +74 -0
- package/template/src/atoms/Popup.tsx +147 -0
- package/template/src/atoms/PrimaryButton.tsx +51 -26
- package/template/src/atoms/RecordingInfo.tsx +52 -0
- package/template/src/atoms/SecondaryButton.tsx +8 -5
- package/template/src/atoms/Spacer.tsx +22 -0
- package/template/src/atoms/TertiaryButton.tsx +78 -0
- package/template/src/atoms/TextInput.tsx +12 -14
- package/template/src/atoms/Toggle.tsx +47 -0
- package/template/src/atoms/Toolbar.tsx +68 -0
- package/template/src/atoms/ToolbarItem.tsx +63 -0
- package/template/src/atoms/Tooltip.native.tsx +65 -0
- package/template/src/atoms/Tooltip.tsx +94 -0
- package/template/src/atoms/UserAvatar.tsx +60 -0
- package/template/src/components/Chat.tsx +164 -278
- package/template/src/components/ChatContext.ts +8 -1
- package/template/src/components/ColorConfigure.tsx +1 -1
- package/template/src/components/ColorContext.ts +1 -1
- package/template/src/components/CommonStyles.ts +44 -0
- package/template/src/components/Controls.tsx +331 -73
- package/template/src/components/{Controls.native.tsx → Controls1.native.tsx} +8 -6
- package/template/src/components/DeviceConfigure.tsx +511 -106
- package/template/src/components/DeviceContext.tsx +8 -4
- package/template/src/components/EventsConfigure.tsx +192 -10
- package/template/src/components/GraphQLProvider.tsx +1 -1
- package/template/src/components/GridVideo.tsx +60 -45
- package/template/src/components/HostControlView.tsx +114 -35
- package/template/src/components/Navbar.tsx +219 -437
- package/template/src/components/Navigation.tsx +15 -1
- package/template/src/components/NetworkQualityContext.tsx +22 -22
- package/template/src/components/ParticipantsView.tsx +178 -156
- package/template/src/components/PinnedVideo.tsx +206 -121
- package/template/src/components/Precall.native.tsx +358 -119
- package/template/src/components/Precall.tsx +272 -138
- package/template/src/components/RTMConfigure.tsx +66 -19
- package/template/src/components/Router.electron.ts +1 -0
- package/template/src/components/Router.native.ts +1 -0
- package/template/src/components/Router.sdk.ts +1 -0
- package/template/src/components/Router.ts +1 -0
- package/template/src/components/SdkApiContext.tsx +161 -0
- package/template/src/components/Settings.tsx +26 -95
- package/template/src/components/SettingsView.tsx +251 -56
- package/template/src/components/Share.tsx +305 -276
- package/template/src/components/StorageContext.tsx +30 -3
- package/template/src/components/ToastComponent.tsx +8 -0
- package/template/src/components/chat-messages/useChatMessages.tsx +100 -52
- package/template/src/components/chat-ui/useChatUIControls.tsx +76 -0
- package/template/src/components/common/Error.tsx +20 -6
- package/template/src/components/common/Logo.tsx +16 -15
- package/template/src/components/contexts/LiveStreamDataContext.tsx +16 -11
- package/template/src/components/contexts/VideoMeetingDataContext.tsx +41 -11
- package/template/src/components/contexts/WhiteboardContext.tsx +3 -3
- package/template/src/components/livestream/LiveStreamContext.tsx +284 -50
- package/template/src/components/livestream/Types.ts +39 -14
- package/template/src/components/livestream/index.ts +1 -0
- package/template/src/components/livestream/views/LiveStreamControls.tsx +9 -4
- package/template/src/components/participants/AllAudienceParticipants.tsx +102 -31
- package/template/src/components/participants/AllHostParticipants.tsx +106 -35
- package/template/src/components/participants/Participant.tsx +300 -0
- package/template/src/components/participants/ParticipantName.tsx +13 -7
- package/template/src/components/participants/ParticipantSectionTitle.tsx +35 -10
- package/template/src/components/participants/ScreenshareParticipants.tsx +144 -12
- package/template/src/components/participants/UserActionMenuOptions.tsx +396 -0
- package/template/src/components/popups/InvitePopup.tsx +115 -0
- package/template/src/components/popups/StopRecordingPopup.tsx +114 -0
- package/template/src/components/precall/LocalMute.tsx +84 -14
- package/template/src/components/precall/{LocalMute.native.tsx → LocalMute1.native.tsx} +21 -5
- package/template/src/components/precall/PermissionHelper.native.tsx +5 -0
- package/template/src/components/precall/PermissionHelper.tsx +126 -0
- package/template/src/components/precall/PreCallSettings.tsx +52 -0
- package/template/src/components/precall/VideoPreview.native.tsx +51 -6
- package/template/src/components/precall/VideoPreview.tsx +164 -8
- package/template/src/components/precall/joinCallBtn.native.tsx +2 -2
- package/template/src/components/precall/joinCallBtn.tsx +17 -4
- package/template/src/components/precall/meetingTitle.tsx +17 -14
- package/template/src/components/precall/selectDevice.tsx +1 -21
- package/template/src/components/precall/textInput.tsx +34 -6
- package/template/src/components/precall/usePreCall.tsx +39 -1
- package/template/src/components/{meeting-info/useMeetingInfo.tsx → room-info/useRoomInfo.tsx} +34 -10
- package/template/src/components/{meeting-info/useSetMeetingInfo.tsx → room-info/useSetRoomInfo.tsx} +12 -12
- package/template/src/components/styles.ts +42 -21
- package/template/src/components/useShareLink.tsx +19 -21
- package/template/src/components/useToast.tsx +41 -0
- package/template/src/components/useUserPreference.tsx +9 -6
- package/template/src/components/useVideoCall.tsx +84 -0
- package/template/src/language/default-labels/createScreenLabels.ts +3 -3
- package/template/src/language/default-labels/joinScreenLabels.ts +2 -2
- package/template/src/language/default-labels/precallScreenLabels.ts +3 -3
- package/template/src/language/default-labels/shareLinkScreenLabels.ts +5 -5
- package/template/src/language/default-labels/videoCallScreenLabels.ts +5 -5
- package/template/src/pages/Authenticate.tsx +5 -15
- package/template/src/pages/Create.tsx +304 -191
- package/template/src/pages/Endcall.tsx +148 -0
- package/template/src/pages/Join.tsx +96 -70
- package/template/src/pages/VideoCall.tsx +179 -69
- package/template/src/pages/video-call/ActionSheet.native.tsx +215 -0
- package/template/src/pages/video-call/ActionSheet.tsx +226 -0
- package/template/src/pages/video-call/ActionSheetContent.tsx +479 -0
- package/template/src/pages/video-call/ActionSheetHandle.tsx +38 -0
- package/template/src/pages/video-call/ActionSheetStyles.css +138 -0
- package/template/src/pages/video-call/DefaultLayouts.ts +6 -6
- package/template/src/pages/video-call/NameWithMicIcon.tsx +93 -49
- package/template/src/pages/video-call/RenderComponent.tsx +6 -30
- package/template/src/pages/video-call/SidePanelHeader.tsx +186 -0
- package/template/src/pages/video-call/VideoCallMobileView.tsx +138 -0
- package/template/src/pages/video-call/VideoCallScreen.native.tsx +37 -0
- package/template/src/pages/video-call/VideoCallScreen.tsx +109 -66
- package/template/src/pages/video-call/VideoComponent.tsx +20 -4
- package/template/src/pages/video-call/VideoRenderer.tsx +227 -61
- package/template/src/pages/video-call/index.ts +35 -7
- package/template/src/rtm/RTMEngine.ts +8 -0
- package/template/src/rtm-events/constants.ts +3 -1
- package/template/src/rtm-events-api/Events.ts +5 -4
- package/template/src/rtm-events-api/LocalEvents.ts +6 -0
- package/template/src/rtm-events-api/types.ts +5 -5
- package/template/src/subComponents/ChatBubble.tsx +125 -84
- package/template/src/subComponents/ChatContainer.tsx +280 -93
- package/template/src/subComponents/ChatInput.ios.tsx +175 -0
- package/template/src/subComponents/ChatInput.tsx +72 -115
- package/template/src/subComponents/Checkbox.native.tsx +16 -5
- package/template/src/subComponents/Checkbox.tsx +2 -2
- package/template/src/subComponents/CopyJoinInfo.tsx +36 -58
- package/template/src/subComponents/EndcallPopup.tsx +107 -0
- package/template/src/subComponents/FallbackLogo.tsx +122 -40
- package/template/src/subComponents/LanguageSelector.tsx +1 -1
- package/template/src/subComponents/LayoutIconButton.tsx +201 -0
- package/template/src/subComponents/LayoutIconDropdown.tsx +131 -134
- package/template/src/subComponents/{LayoutIconDropdown.native.tsx → LayoutIconDropdown1.native.tsx} +4 -18
- package/template/src/subComponents/LocalAudioMute.tsx +119 -27
- package/template/src/subComponents/LocalEndCall.tsx +73 -35
- package/template/src/subComponents/LocalSwitchCamera.tsx +19 -32
- package/template/src/subComponents/LocalVideoMute.tsx +117 -27
- package/template/src/subComponents/Logo.tsx +3 -4
- package/template/src/subComponents/LogoutButton.tsx +1 -1
- package/template/src/subComponents/NetworkQualityPill.tsx +66 -68
- package/template/src/subComponents/OpenInNativeButton.tsx +3 -3
- package/template/src/subComponents/Recording.tsx +28 -29
- package/template/src/subComponents/RemoteAudioMute.tsx +83 -29
- package/template/src/subComponents/RemoteEndCall.tsx +8 -5
- package/template/src/subComponents/RemoteMutePopup.tsx +193 -0
- package/template/src/subComponents/RemoteVideoMute.tsx +74 -21
- package/template/src/subComponents/RemoveMeetingPopup.tsx +109 -0
- package/template/src/subComponents/RemoveScreensharePopup.tsx +109 -0
- package/template/src/subComponents/ScreenShareNotice.tsx +83 -8
- package/template/src/subComponents/SelectDevice.tsx +404 -61
- package/template/src/subComponents/SelectDeviceSettings.backup.tsx +207 -0
- package/template/src/subComponents/SelectOAuth.tsx +9 -8
- package/template/src/subComponents/SidePanelButtons.ts +0 -3
- package/template/src/subComponents/SidePanelHeader.tsx +112 -0
- package/template/src/subComponents/ToastConfig.tsx +150 -10
- package/template/src/subComponents/chat/ChatParticipants.tsx +188 -79
- package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +97 -34
- package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +29 -33
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +8 -8
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +24 -11
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +17 -10
- package/template/src/subComponents/recording/useRecording.tsx +81 -29
- package/template/src/subComponents/screenshare/ScreenshareButton.tsx +52 -70
- package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +23 -12
- package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +44 -19
- package/template/src/theme/index.ts +46 -0
- package/template/src/utils/PlatformWrapper.tsx +21 -0
- package/template/src/utils/SdkEvents.ts +23 -14
- package/template/src/utils/SdkMethodEvents.ts +81 -0
- package/template/src/utils/common.tsx +155 -1
- package/template/src/utils/hexadecimalTransparency.ts +108 -0
- package/template/src/utils/index.tsx +19 -0
- package/template/src/utils/isMobileOrTablet.ts +7 -2
- package/template/src/utils/pendingStateUpdateHelper.ts +19 -0
- package/template/src/utils/useActiveSpeaker.ts +42 -0
- package/template/src/utils/{useCreateMeeting.ts → useCreateRoom.ts} +19 -14
- package/template/src/utils/{useButtonTemplate.tsx → useFocus.tsx} +19 -16
- package/template/src/utils/useGetMeetingPhrase.ts +10 -10
- package/template/src/utils/useIsAudioEnabled.ts +3 -3
- package/template/src/utils/useIsHandRaised.ts +13 -0
- package/template/src/utils/useIsPSTN.ts +3 -3
- package/template/src/utils/useIsVideoEnabled.ts +3 -3
- package/template/src/utils/{useJoinMeeting.ts → useJoinRoom.ts} +27 -21
- package/template/src/utils/useMutePSTN.ts +2 -2
- package/template/src/utils/useMuteToggleLocal.ts +58 -5
- package/template/src/utils/useRemoteEndCall.ts +4 -4
- package/template/src/utils/useRemoteEndScreenshare.ts +26 -0
- package/template/src/utils/useRemoteMute.ts +7 -7
- package/template/src/utils/useRemoteRequest.ts +84 -0
- package/template/src/utils/useSwitchCamera.native.tsx +25 -0
- package/template/src/utils/useSwitchCamera.tsx +19 -0
- package/template/src/utils/useToolbar.tsx +59 -0
- package/template/web/index.html +5 -0
- package/template/webpack.commons.js +13 -8
- package/template/webpack.rsdk.config.js +1 -2
- package/template/webpack.web.config.js +1 -0
- package/template/agora-rn-uikit/src/Contexts/RenderContext.tsx +0 -10
- package/template/src/assets/icons.ts +0 -102
- package/template/src/components/chat-ui/useChatUIControl.tsx +0 -69
- package/template/src/components/participants/MeParticipant.tsx +0 -38
- package/template/src/components/participants/RemoteParticipants.tsx +0 -71
- 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 {
|
|
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
|
-
|
|
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 {
|
|
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
|
-
<
|
|
33
|
-
{({
|
|
32
|
+
<ContentConsumer>
|
|
33
|
+
{({defaultContent, activeUids}) => (
|
|
34
34
|
<View style={{...styles.Controls, top: styles.Controls.top - 100}}>
|
|
35
35
|
<RemoteControls
|
|
36
|
-
user={
|
|
36
|
+
user={defaultContent[activeUids[0]]}
|
|
37
37
|
showRemoteSwap={false}
|
|
38
38
|
/>
|
|
39
39
|
</View>
|
|
40
40
|
)}
|
|
41
|
-
</
|
|
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
|
-
|
|
7
|
+
ContentInterface,
|
|
8
8
|
} from '../../Contexts/PropsContext';
|
|
9
9
|
import useLocalUid from '../../Utils/useLocalUid';
|
|
10
10
|
|
|
11
11
|
interface RemoteAudioMuteInterface {
|
|
12
|
-
user:
|
|
12
|
+
user: ContentInterface;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const RemoteAudioMute: React.FC<RemoteAudioMuteInterface> = (props) => {
|
|
16
|
-
const {
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
12
|
+
user: ContentInterface;
|
|
13
13
|
rightButton: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const RemoteVideoMute: React.FC<RemoteVideoMuteInterface> = (props) => {
|
|
17
|
-
const {
|
|
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
|
-
|
|
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, {
|
|
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:
|
|
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
|
-
|
|
3
|
+
ContentStateInterface,
|
|
4
4
|
UidType,
|
|
5
5
|
} from '../Contexts/RtcContext';
|
|
6
6
|
|
|
7
7
|
export default function LocalMuteAudio(
|
|
8
|
-
state:
|
|
8
|
+
state: ContentStateInterface,
|
|
9
9
|
action: ActionType<'LocalMuteAudio'>,
|
|
10
10
|
localUid: UidType,
|
|
11
11
|
) {
|
|
12
|
-
let stateUpdate:
|
|
13
|
-
|
|
14
|
-
...state.
|
|
12
|
+
let stateUpdate: ContentStateInterface = {
|
|
13
|
+
defaultContent: {
|
|
14
|
+
...state.defaultContent,
|
|
15
15
|
[localUid]: {
|
|
16
|
-
...state.
|
|
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
|
-
|
|
3
|
+
ContentStateInterface,
|
|
4
4
|
UidType,
|
|
5
5
|
} from '../Contexts/RtcContext';
|
|
6
6
|
|
|
7
7
|
export default function LocalMuteVideo(
|
|
8
|
-
state:
|
|
8
|
+
state: ContentStateInterface,
|
|
9
9
|
action: ActionType<'LocalMuteVideo'>,
|
|
10
10
|
localUid: UidType,
|
|
11
11
|
) {
|
|
12
|
-
let stateUpdate:
|
|
13
|
-
|
|
14
|
-
...state.
|
|
12
|
+
let stateUpdate: ContentStateInterface = {
|
|
13
|
+
defaultContent: {
|
|
14
|
+
...state.defaultContent,
|
|
15
15
|
[localUid]: {
|
|
16
|
-
...state.
|
|
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,
|
|
2
|
+
import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
|
|
3
3
|
|
|
4
4
|
export default function RemoteAudioStateChanged(
|
|
5
|
-
state:
|
|
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:
|
|
16
|
-
|
|
17
|
-
...state.
|
|
15
|
+
const stateUpdate: ContentStateInterface = {
|
|
16
|
+
defaultContent: {
|
|
17
|
+
...state.defaultContent,
|
|
18
18
|
[action.value[0]]: {
|
|
19
|
-
...state.
|
|
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,
|
|
2
|
+
import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
|
|
3
3
|
|
|
4
4
|
export default function RemoteVideoStateChanged(
|
|
5
|
-
state:
|
|
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:
|
|
16
|
-
|
|
17
|
-
...state.
|
|
15
|
+
const stateUpdate: ContentStateInterface = {
|
|
16
|
+
defaultContent: {
|
|
17
|
+
...state.defaultContent,
|
|
18
18
|
[action.value[0]]: {
|
|
19
|
-
...state.
|
|
19
|
+
...state.defaultContent[action.value[0]],
|
|
20
20
|
video:
|
|
21
21
|
videoState !== undefined
|
|
22
22
|
? videoState
|
|
23
|
-
: state.
|
|
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
|
-
|
|
4
|
+
ContentStateInterface,
|
|
5
5
|
UidType,
|
|
6
6
|
} from '../Contexts/RtcContext';
|
|
7
7
|
|
|
8
8
|
export default function UpdateDualStreamMode(
|
|
9
|
-
state:
|
|
9
|
+
state: ContentStateInterface,
|
|
10
10
|
action: ActionType<'UpdateDualStreamMode'>,
|
|
11
11
|
) {
|
|
12
12
|
const newMode = action.value[0];
|
|
13
|
-
let
|
|
14
|
-
let stateUpdate:
|
|
13
|
+
let defaultContent = {...state.defaultContent};
|
|
14
|
+
let stateUpdate: ContentStateInterface;
|
|
15
15
|
const setHighStreamType = (uid: UidType) => {
|
|
16
|
-
|
|
16
|
+
defaultContent[uid].streamType = 'high';
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const setLowStreamType = (uid: UidType) => {
|
|
20
|
-
|
|
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
|
-
|
|
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
|
-
|
|
4
|
+
ContentStateInterface,
|
|
5
5
|
UidType,
|
|
6
6
|
} from '../Contexts/RtcContext';
|
|
7
7
|
|
|
8
8
|
export default function UserJoined(
|
|
9
|
-
state:
|
|
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.
|
|
21
|
-
typeData.type = state.
|
|
20
|
+
if (state.defaultContent[newUid] && 'type' in state.defaultContent[newUid]) {
|
|
21
|
+
typeData.type = state.defaultContent[newUid].type;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
let
|
|
25
|
-
...state.
|
|
24
|
+
let defaultContent: ContentStateInterface['defaultContent'] = {
|
|
25
|
+
...state.defaultContent,
|
|
26
26
|
[newUid]: {
|
|
27
|
-
...state.
|
|
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
|
-
|
|
43
|
+
defaultContent[newUid].streamType = 'high';
|
|
44
44
|
}
|
|
45
45
|
//Swap render positions
|
|
46
46
|
stateUpdate = {
|
|
47
|
-
|
|
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
|
-
|
|
54
|
+
defaultContent: defaultContent,
|
|
55
55
|
activeUids: activeUids,
|
|
56
56
|
lastJoinedUid: newUid,
|
|
57
57
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {ActionType,
|
|
1
|
+
import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
|
|
2
2
|
|
|
3
3
|
export default function UserMuteRemoteAudio(
|
|
4
|
-
state:
|
|
4
|
+
state: ContentStateInterface,
|
|
5
5
|
action: ActionType<'UserMuteRemoteAudio'>,
|
|
6
6
|
) {
|
|
7
|
-
let stateUpdate:
|
|
8
|
-
|
|
9
|
-
...state.
|
|
7
|
+
let stateUpdate: ContentStateInterface = {
|
|
8
|
+
defaultContent: {
|
|
9
|
+
...state.defaultContent,
|
|
10
10
|
[action.value[0]]: {
|
|
11
|
-
...state.
|
|
11
|
+
...state.defaultContent[action.value[0]],
|
|
12
12
|
audio: action.value[1],
|
|
13
13
|
},
|
|
14
14
|
},
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {ActionType,
|
|
1
|
+
import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
|
|
2
2
|
|
|
3
3
|
export default function UserMuteRemoteVideo(
|
|
4
|
-
state:
|
|
4
|
+
state: ContentStateInterface,
|
|
5
5
|
action: ActionType<'UserMuteRemoteVideo'>,
|
|
6
6
|
) {
|
|
7
|
-
let stateUpdate:
|
|
8
|
-
|
|
9
|
-
...state.
|
|
7
|
+
let stateUpdate: ContentStateInterface = {
|
|
8
|
+
defaultContent: {
|
|
9
|
+
...state.defaultContent,
|
|
10
10
|
[action.value[0]]: {
|
|
11
|
-
...state.
|
|
11
|
+
...state.defaultContent[action.value[0]],
|
|
12
12
|
video: action.value[1],
|
|
13
13
|
},
|
|
14
14
|
},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {ActionType,
|
|
1
|
+
import {ActionType, ContentStateInterface} from '../Contexts/RtcContext';
|
|
2
2
|
|
|
3
3
|
export default function UserOffline(
|
|
4
|
-
state:
|
|
4
|
+
state: ContentStateInterface,
|
|
5
5
|
action: ActionType<'UserOffline'>,
|
|
6
6
|
) {
|
|
7
7
|
// let updatedRenderList = {
|
|
8
|
-
// ...state.
|
|
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:
|
|
19
|
-
|
|
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/
|
|
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 {
|
|
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
|
}
|
|
@@ -139,6 +195,7 @@ const Create = ({
|
|
|
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 (
|
|
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
|