agora-appbuilder-core 3.0.13 → 3.0.28-beta-9
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 +3 -3
- package/template/.bundle/config +2 -0
- package/template/Gemfile +4 -0
- package/template/Gulpfile.js +31 -30
- package/template/_eslintrc.js +3 -3
- package/template/_gitignore +12 -11
- package/template/_package-lock.json +34387 -27128
- package/template/_prettierrc.js +2 -2
- package/template/agora-rn-uikit/.eslintrc.js +5 -0
- package/template/agora-rn-uikit/package-lock.json +25024 -0
- package/template/agora-rn-uikit/package.json +14 -14
- 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 +98 -37
- package/template/agora-rn-uikit/src/Contexts/RtcContext.tsx +27 -16
- package/template/agora-rn-uikit/src/Controls/BtnTemplate.tsx +31 -26
- package/template/agora-rn-uikit/src/Controls/Icons.ts +81 -83
- package/template/agora-rn-uikit/src/Controls/ImageIcon.tsx +6 -6
- package/template/agora-rn-uikit/src/Controls/Local/EndCall.tsx +6 -4
- package/template/agora-rn-uikit/src/Controls/Local/FullScreen.tsx +3 -1
- package/template/agora-rn-uikit/src/Controls/Local/LocalAudioMute.tsx +5 -2
- package/template/agora-rn-uikit/src/Controls/Local/LocalVideoMute.tsx +5 -2
- package/template/agora-rn-uikit/src/Controls/Local/Recording.tsx +0 -2
- package/template/agora-rn-uikit/src/Controls/Local/SwitchCamera.tsx +7 -6
- package/template/agora-rn-uikit/src/Controls/LocalControls.tsx +5 -5
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteAudioMute.tsx +5 -4
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteSwap.tsx +3 -1
- package/template/agora-rn-uikit/src/Controls/Remote/RemoteVideoMute.tsx +5 -4
- package/template/agora-rn-uikit/src/Controls/RemoteControls.tsx +2 -2
- package/template/agora-rn-uikit/src/Reducer/ActiveSpeaker.ts +30 -0
- package/template/agora-rn-uikit/src/Reducer/LocalMuteAudio.ts +8 -6
- package/template/agora-rn-uikit/src/Reducer/LocalMuteVideo.ts +8 -6
- package/template/agora-rn-uikit/src/Reducer/LocalPermissionState.ts +23 -0
- package/template/agora-rn-uikit/src/Reducer/RemoteAudioStateChanged.ts +7 -7
- package/template/agora-rn-uikit/src/Reducer/RemoteVideoStateChanged.ts +9 -8
- package/template/agora-rn-uikit/src/Reducer/UpdateDualStreamMode.ts +7 -7
- package/template/agora-rn-uikit/src/Reducer/UserJoined.ts +24 -14
- 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 +14 -5
- package/template/agora-rn-uikit/src/Reducer/UserPin.ts +28 -0
- package/template/agora-rn-uikit/src/Reducer/UserSecondaryPin.ts +23 -0
- package/template/agora-rn-uikit/src/Reducer/index.ts +4 -0
- package/template/agora-rn-uikit/src/Rtc/Create.tsx +197 -66
- package/template/agora-rn-uikit/src/Rtc/Join.tsx +60 -33
- package/template/agora-rn-uikit/src/RtcConfigure.tsx +194 -57
- package/template/agora-rn-uikit/src/Utils/isBotUser.ts +15 -0
- package/template/agora-rn-uikit/src/Utils/quality.tsx +8 -0
- package/template/agora-rn-uikit/src/Views/MaxVideoView.native.tsx +67 -13
- package/template/agora-rn-uikit/src/Views/MaxVideoView.tsx +53 -17
- package/template/agora-rn-uikit/src/Views/MinVideoView.tsx +19 -11
- package/template/agora-rn-uikit/src/index.ts +19 -10
- package/template/android/app/build.gradle +67 -155
- package/template/android/app/src/debug/AndroidManifest.xml +6 -1
- package/template/android/app/src/debug/java/com/helloworld/ReactNativeFlipper.java +7 -4
- package/template/android/app/src/main/AndroidManifest.xml +21 -27
- 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 +67 -0
- package/template/android/app/src/main/java/com/helloworld/MainApplication.java +22 -36
- package/template/android/app/src/main/java/com/helloworld/SSLPinningFactory.java +30 -0
- package/template/android/app/src/main/res/values/colors.xml +7 -0
- package/template/android/app/src/main/res/values/strings.xml +3 -0
- package/template/android/app/src/release/java/com/helloworld/ReactNativeFlipper.java +20 -0
- package/template/android/build.gradle +20 -31
- package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/android/gradle/wrapper/gradle-wrapper.properties +3 -2
- package/template/android/gradle.properties +18 -4
- package/template/android/gradlew +165 -104
- package/template/android/gradlew.bat +12 -23
- package/template/android/link-assets-manifest.json +13 -0
- package/template/android/settings.gradle +1 -0
- package/template/babel.config.js +1 -0
- package/template/bridge/rtc/webNg/RtcEngine.ts +940 -98
- package/template/bridge/rtc/webNg/{SurfaceView.tsx → RtcSurfaceView.tsx} +20 -27
- package/template/bridge/rtc/webNg/Types.ts +20 -5
- package/template/bridge/rtc/webNg/index.ts +81 -14
- package/template/bridge/rtm/web/index.ts +86 -35
- package/template/configTransform.js +16 -1
- package/template/customization-api/action-library.ts +4 -16
- package/template/customization-api/app-state.ts +18 -8
- package/template/customization-api/atoms.ts +8 -0
- package/template/customization-api/customEvents.ts +7 -2
- package/template/customization-api/customize.ts +30 -11
- package/template/customization-api/index.ts +5 -0
- package/template/customization-api/sub-components.ts +43 -18
- package/template/customization-api/temp.ts +51 -0
- package/template/customization-api/typeDefinition.ts +65 -49
- package/template/customization-api/types.ts +48 -0
- package/template/customization-api/utils.ts +19 -1
- package/template/customization-implementation/createHook.ts +24 -6
- package/template/customization-implementation/index.ts +1 -2
- package/template/customization-implementation/useCustomization.tsx +5 -7
- package/template/defaultConfig.js +84 -0
- package/template/electron/index.html +27 -27
- package/template/electron/renderer/index.js +1 -0
- package/template/global.d.ts +97 -6
- package/template/index.js +18 -1
- package/template/index.rsdk.tsx +1 -0
- package/template/index.web.js +1 -0
- package/template/index.wsdk.tsx +2 -13
- package/template/ios/.xcode.env +11 -0
- package/template/ios/HelloWorld/AppDelegate.h +2 -4
- package/template/ios/HelloWorld/AppDelegate.mm +64 -0
- package/template/ios/HelloWorld/HelloWorldDebug.entitlements +10 -0
- package/template/ios/HelloWorld/Info.plist +20 -1
- package/template/ios/HelloWorld/main.m +2 -1
- package/template/ios/HelloWorld.xcodeproj/project.pbxproj +596 -11
- package/template/ios/HelloWorld.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/template/ios/HelloWorld.xcodeproj/xcshareddata/xcschemes/ScreenSharing.xcscheme +95 -0
- package/template/ios/HelloWorld.xcworkspace/contents.xcworkspacedata +10 -0
- package/template/ios/HelloWorld.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/template/ios/HelloWorldTests/HelloWorldTests.m +14 -13
- package/template/ios/HelloWorldTests/Info.plist +2 -2
- package/template/ios/Podfile +54 -20
- package/template/ios/Podfile.lock +975 -0
- package/template/ios/ScreenSharing/Info.plist +15 -0
- package/template/ios/ScreenSharing/SampleHandler.h +5 -0
- package/template/ios/ScreenSharing/SampleHandler.m +39 -0
- package/template/ios/link-assets-manifest.json +13 -0
- package/template/jest.config.js +4 -0
- package/template/metro.config.js +7 -32
- package/template/package-lock.json +57746 -0
- package/template/package.json +71 -35
- package/template/react-native-toast-message/index.d.ts +46 -44
- package/template/react-native-toast-message/index.js +1 -0
- package/template/react-native-toast-message/package-lock.json +10553 -0
- package/template/react-native-toast-message/src/colors/index.js +3 -2
- package/template/react-native-toast-message/src/components/base/index.js +38 -63
- package/template/react-native-toast-message/src/components/base/styles.js +20 -39
- package/template/react-native-toast-message/src/components/checkbox.js +183 -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 +125 -32
- package/template/react-native-toast-message/src/index.sdk.tsx +129 -36
- 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 +53 -63
- package/template/src/AppRoutes.tsx +101 -0
- package/template/src/AppWrapper.tsx +83 -29
- package/template/src/SDKAppWrapper.tsx +145 -58
- package/template/src/app-state/useBeautyEffects.ts +30 -0
- package/template/src/app-state/useLocalUserInfo.ts +3 -3
- package/template/src/app-state/useMessages.ts +49 -9
- package/template/src/app-state/useNoiseSupression.native.tsx +73 -0
- package/template/src/app-state/useNoiseSupression.tsx +151 -0
- package/template/src/app-state/useVideoQuality.tsx +182 -0
- package/template/src/app-state/useVirtualBackground.ts +152 -0
- package/template/src/assets/font-styles.css +677 -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 +3491 -0
- package/template/src/atoms/ActionMenu.tsx +326 -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/Avatar.tsx +51 -0
- package/template/src/atoms/Card.tsx +74 -0
- package/template/src/atoms/Carousel.native.tsx +105 -0
- package/template/src/atoms/Carousel.tsx +109 -0
- package/template/src/atoms/Checkbox.tsx +98 -0
- package/template/src/atoms/CircularProgress.native.tsx +121 -0
- package/template/src/atoms/CircularProgress.tsx +101 -0
- package/template/src/atoms/ClipboardIconButton.tsx +91 -0
- package/template/src/atoms/CustomIcon.tsx +153 -0
- package/template/src/atoms/CustomSwitch.tsx +287 -0
- package/template/src/atoms/DropDownMulti.tsx +349 -0
- package/template/src/atoms/Dropdown.tsx +307 -0
- package/template/src/atoms/HorizontalRule.tsx +3 -1
- package/template/src/atoms/IconButton.tsx +205 -0
- package/template/src/atoms/ImageIcon.tsx +127 -0
- package/template/src/atoms/InfoBubble.tsx +291 -0
- package/template/src/atoms/InlineNotification.tsx +81 -0
- package/template/src/atoms/InlinePopup.tsx +185 -0
- package/template/src/atoms/Input.tsx +87 -0
- package/template/src/atoms/InviteInfo.tsx +166 -0
- package/template/src/atoms/LinkButton.tsx +29 -0
- package/template/src/atoms/MeetingLink.tsx +160 -0
- package/template/src/atoms/OutlineButton.tsx +61 -0
- package/template/src/atoms/ParticipantsCount.tsx +78 -0
- package/template/src/atoms/Popup.tsx +178 -0
- package/template/src/atoms/PrimaryButton.tsx +65 -26
- package/template/src/atoms/RecordingInfo.tsx +47 -0
- package/template/src/atoms/SecondaryButton.tsx +10 -5
- package/template/src/atoms/Spacer.tsx +23 -0
- package/template/src/atoms/TertiaryButton.tsx +108 -0
- package/template/src/atoms/TextInput.tsx +13 -14
- package/template/src/atoms/Toggle.tsx +47 -0
- package/template/src/atoms/Toolbar.tsx +94 -0
- package/template/src/atoms/ToolbarItem.tsx +99 -0
- package/template/src/atoms/ToolbarMenu.tsx +40 -0
- package/template/src/atoms/ToolbarMenuItem.tsx +104 -0
- package/template/src/atoms/ToolbarPreset.tsx +147 -0
- package/template/src/atoms/Tooltip.native.tsx +65 -0
- package/template/src/atoms/Tooltip.tsx +111 -0
- package/template/src/atoms/UserAvatar.tsx +60 -0
- package/template/src/atoms/pagination/Pagination.tsx +127 -0
- package/template/src/atoms/pagination/usePagination.tsx +88 -0
- package/template/src/auth/AuthProvider.tsx +710 -0
- package/template/src/auth/AuthRoute.tsx +94 -0
- package/template/src/auth/IDPAuth.electron.tsx +32 -0
- package/template/src/auth/IDPAuth.tsx +73 -0
- package/template/src/auth/IDPLogoutComponent.tsx +158 -0
- package/template/src/auth/UserCancelPopup.tsx +115 -0
- package/template/src/auth/config.ts +53 -0
- package/template/src/auth/openIDPURL.electron.tsx +39 -0
- package/template/src/auth/openIDPURL.native.tsx +62 -0
- package/template/src/auth/openIDPURL.tsx +20 -0
- package/template/src/auth/useIDPAuth.electron.tsx +125 -0
- package/template/src/auth/useIDPAuth.native.tsx +130 -0
- package/template/src/auth/useIDPAuth.tsx +124 -0
- package/template/src/auth/useTokenAuth.tsx +267 -0
- package/template/src/components/Chat.tsx +177 -279
- package/template/src/components/ChatContext.ts +22 -1
- package/template/src/components/ColorConfigure.tsx +1 -2
- package/template/src/components/ColorContext.ts +1 -1
- package/template/src/components/CommonStyles.ts +51 -0
- package/template/src/components/Controls.tsx +1275 -108
- package/template/src/components/{Controls.native.tsx → Controls1.native.tsx} +15 -9
- package/template/src/components/CustomSidePanel.tsx +82 -0
- package/template/src/components/DeviceConfigure.native.tsx +2 -2
- package/template/src/components/DeviceConfigure.tsx +789 -122
- package/template/src/components/DeviceContext.tsx +10 -4
- package/template/src/components/EventsConfigure.tsx +773 -12
- package/template/src/components/GraphQLProvider.tsx +83 -37
- package/template/src/components/GridVideo.tsx +86 -53
- package/template/src/components/HostControlView.tsx +118 -42
- package/template/src/components/JoinPhrase.tsx +0 -1
- package/template/src/components/Leftbar.tsx +129 -0
- package/template/src/components/Navbar.tsx +469 -488
- package/template/src/components/NavbarMobile.tsx +138 -0
- package/template/src/components/Navigation.native.tsx +1 -14
- package/template/src/components/{Settings.native.tsx → Navigation.sdk.tsx} +17 -6
- package/template/src/components/NetworkQualityContext.tsx +32 -26
- package/template/src/components/ParticipantsView.tsx +195 -165
- package/template/src/components/PinnedVideo.tsx +317 -122
- package/template/src/components/Precall.native.tsx +472 -116
- package/template/src/components/Precall.tsx +493 -154
- package/template/src/components/RTMConfigure.tsx +477 -83
- package/template/src/components/Rightbar.tsx +129 -0
- package/template/src/components/Router.electron.ts +2 -0
- package/template/src/components/Router.native.ts +2 -0
- package/template/src/components/Router.sdk.ts +2 -0
- package/template/src/components/Router.ts +2 -0
- package/template/src/components/SdkApiContext.tsx +319 -0
- package/template/src/components/SdkMuteToggleListener.tsx +88 -0
- package/template/src/components/SessionContext.tsx +0 -1
- package/template/src/components/Settings.tsx +51 -114
- package/template/src/components/SettingsView.tsx +293 -54
- package/template/src/components/Share.tsx +415 -297
- package/template/src/components/StorageContext.tsx +82 -7
- package/template/src/components/ToastComponent.tsx +17 -0
- package/template/src/components/WhiteboardLayout.tsx +291 -0
- package/template/src/components/beauty-effect/useBeautyEffects.native.tsx +119 -0
- package/template/src/components/beauty-effect/useBeautyEffects.tsx +152 -0
- package/template/src/components/chat/chatConfigure.native.tsx +511 -0
- package/template/src/components/chat/chatConfigure.tsx +529 -0
- package/template/src/components/chat-messages/useChatMessages.tsx +513 -386
- package/template/src/components/chat-ui/useChatUIControls.tsx +132 -0
- package/template/src/components/common/Error.tsx +36 -6
- package/template/src/components/common/Logo.tsx +16 -15
- package/template/src/components/contexts/LiveStreamDataContext.tsx +23 -17
- package/template/src/components/contexts/ScreenShareContext.tsx +15 -1
- package/template/src/components/contexts/VideoMeetingDataContext.tsx +41 -11
- package/template/src/components/contexts/WaitingRoomContext.tsx +61 -0
- package/template/src/components/contexts/WhiteboardContext.tsx +54 -54
- package/template/src/components/disable-chat/useDisableChat.tsx +32 -0
- package/template/src/components/livestream/LiveStreamContext.tsx +493 -165
- package/template/src/components/livestream/Types.ts +58 -17
- package/template/src/components/livestream/index.ts +1 -0
- package/template/src/components/livestream/views/LiveStreamAttendeeLandingTile.tsx +295 -0
- package/template/src/components/livestream/views/LiveStreamControls.tsx +8 -4
- package/template/src/components/meeting-info-invite/MeetingInfo.tsx +82 -0
- package/template/src/components/meeting-info-invite/MeetingInfoCardHeader.tsx +86 -0
- package/template/src/components/meeting-info-invite/MeetingInfoGridTile.tsx +221 -0
- package/template/src/components/meeting-info-invite/MeetingInfoLinks.tsx +122 -0
- package/template/src/components/participants/AllAudienceParticipants.tsx +105 -35
- package/template/src/components/participants/AllHostParticipants.tsx +108 -38
- package/template/src/components/participants/Participant.tsx +330 -0
- package/template/src/components/participants/ParticipantName.tsx +13 -7
- package/template/src/components/participants/ParticipantSectionTitle.tsx +38 -10
- package/template/src/components/participants/ScreenshareParticipants.tsx +142 -12
- package/template/src/components/participants/UserActionMenuOptions.tsx +510 -0
- package/template/src/components/participants/WaitingRoomParticipants.tsx +74 -0
- package/template/src/components/popups/InvitePopup.tsx +196 -0
- package/template/src/components/popups/StartScreenSharePopup.native.tsx +182 -0
- package/template/src/components/popups/StartScreenSharePopup.tsx +6 -0
- package/template/src/components/popups/StopRecordingPopup.tsx +120 -0
- package/template/src/components/popups/StopScreenSharePopup.native.tsx +135 -0
- package/template/src/components/popups/StopScreenSharePopup.tsx +6 -0
- package/template/src/components/popups/WhiteboardClearAllPopup.tsx +123 -0
- package/template/src/components/precall/LocalMute.tsx +109 -15
- 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 +154 -0
- package/template/src/components/precall/PreCallSettings.tsx +53 -0
- package/template/src/components/precall/VideoFallback.tsx +173 -0
- package/template/src/components/precall/VideoPreview.native.tsx +19 -8
- package/template/src/components/precall/VideoPreview.tsx +28 -7
- package/template/src/components/precall/index.tsx +2 -0
- package/template/src/components/precall/joinCallBtn.native.tsx +12 -5
- package/template/src/components/precall/joinCallBtn.tsx +34 -6
- package/template/src/components/precall/joinWaitingRoomBtn.native.tsx +215 -0
- package/template/src/components/precall/joinWaitingRoomBtn.tsx +255 -0
- package/template/src/components/precall/meetingTitle.tsx +42 -13
- package/template/src/components/precall/selectDevice.tsx +5 -25
- package/template/src/components/precall/textInput.tsx +40 -14
- package/template/src/components/precall/usePreCall.tsx +66 -2
- package/template/src/components/recording-bot/RecordingBotRoute.tsx +48 -0
- package/template/src/components/recordings/RecordingsDateTable.tsx +62 -0
- package/template/src/components/recordings/RecordingsModal.tsx +135 -0
- package/template/src/components/recordings/ViewRecordingsModal.tsx +51 -0
- package/template/src/components/recordings/recording-table.tsx +250 -0
- package/template/src/components/recordings/style.ts +238 -0
- package/template/src/components/recordings/utils.ts +122 -0
- package/template/src/components/room-info/useRoomInfo.tsx +142 -0
- 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 +33 -70
- package/template/src/{utils/useButtonTemplate.tsx → components/useToast.tsx} +18 -20
- package/template/src/components/useUserPreference.tsx +157 -16
- package/template/src/components/useVideoCall.tsx +157 -0
- package/template/src/components/useWakeLock.tsx +18 -4
- package/template/src/components/virtual-background/VBButton.tsx +62 -0
- package/template/src/components/virtual-background/VBCard.native.tsx +280 -0
- package/template/src/components/virtual-background/VBCard.tsx +308 -0
- package/template/src/components/virtual-background/VBPanel.tsx +282 -0
- package/template/src/components/virtual-background/VButils.native.ts +72 -0
- package/template/src/components/virtual-background/VButils.ts +144 -0
- package/template/src/components/virtual-background/VideoPreview.native.tsx +43 -0
- package/template/src/components/virtual-background/VideoPreview.tsx +116 -0
- package/template/src/components/virtual-background/imagePaths.ts +82 -0
- package/template/src/components/virtual-background/images/beachImageBase64.ts +1 -0
- package/template/src/components/virtual-background/images/bedroomImageBase64.ts +1 -0
- package/template/src/components/virtual-background/images/bookImageBase64.ts +1 -0
- package/template/src/components/virtual-background/images/earthImageBase64.ts +1 -0
- package/template/src/components/virtual-background/images/index.ts +37 -0
- package/template/src/components/virtual-background/images/lampImageBase64.ts +1 -0
- package/template/src/components/virtual-background/images/mountainsImageBase64.ts +1 -0
- package/template/src/components/virtual-background/images/office1ImageBase64.ts +1 -0
- package/template/src/components/virtual-background/images/officeImageBase64.ts +1 -0
- package/template/src/components/virtual-background/images/plantsImageBase64.ts +1 -0
- package/template/src/components/virtual-background/images/skyImageBase64.ts +1 -0
- package/template/src/components/virtual-background/images/wallImageBase64.ts +1 -0
- package/template/src/components/virtual-background/useVB.native.tsx +205 -0
- package/template/src/components/virtual-background/useVB.tsx +294 -0
- package/template/src/components/whiteboard/StrokeWidthTool.tsx +137 -0
- package/template/src/components/whiteboard/WhiteboardButton.tsx +93 -0
- package/template/src/components/whiteboard/WhiteboardCanvas.tsx +99 -0
- package/template/src/components/whiteboard/WhiteboardConfigure.native.tsx +148 -0
- package/template/src/components/whiteboard/WhiteboardConfigure.tsx +473 -0
- package/template/src/components/whiteboard/WhiteboardCursor.tsx +152 -0
- package/template/src/components/whiteboard/WhiteboardToolBox.tsx +1448 -0
- package/template/src/components/whiteboard/WhiteboardView.native.tsx +212 -0
- package/template/src/components/whiteboard/WhiteboardView.tsx +81 -0
- package/template/src/components/whiteboard/WhiteboardWidget.tsx +729 -0
- package/template/src/components/whiteboard/WhiteboardWrapper.tsx +38 -0
- package/template/src/language/default-labels/commonLabels.ts +51 -14
- package/template/src/language/default-labels/createScreenLabels.ts +97 -17
- package/template/src/language/default-labels/joinScreenLabels.ts +45 -6
- package/template/src/language/default-labels/precallScreenLabels.ts +158 -25
- package/template/src/language/default-labels/shareLinkScreenLabels.ts +85 -37
- package/template/src/language/default-labels/videoCallScreenLabels.ts +1290 -158
- package/template/src/language/i18nTypes.ts +1 -1
- package/template/src/language/useLanguage.tsx +10 -4
- package/template/src/logger/AppBuilderLogger.tsx +313 -0
- package/template/src/logger/constants.ts +18 -0
- package/template/src/logger/transports/agora-transport.native.ts +64 -0
- package/template/src/logger/transports/agora-transport.ts +36 -0
- package/template/src/logger/transports/customer-transport.ts +162 -0
- package/template/src/pages/Authenticate.tsx +5 -15
- package/template/src/pages/Create.tsx +394 -202
- package/template/src/pages/Endcall.tsx +153 -0
- package/template/src/pages/Join.tsx +188 -78
- package/template/src/pages/Login.tsx +26 -0
- package/template/src/pages/VideoCall.tsx +381 -130
- package/template/src/pages/video-call/ActionSheet.native.tsx +343 -0
- package/template/src/pages/video-call/ActionSheet.tsx +349 -0
- package/template/src/pages/video-call/ActionSheetContent.tsx +655 -0
- package/template/src/pages/video-call/ActionSheetHandle.tsx +54 -0
- package/template/src/pages/video-call/ActionSheetStyles.css +138 -0
- package/template/src/pages/video-call/DefaultLayouts.ts +32 -12
- package/template/src/pages/video-call/NameWithMicIcon.tsx +104 -51
- package/template/src/pages/video-call/PinchableView.tsx +119 -0
- package/template/src/pages/video-call/RenderComponent.tsx +16 -31
- package/template/src/pages/video-call/SidePanelHeader.tsx +424 -0
- package/template/src/pages/video-call/VideoCallMobileView.tsx +299 -0
- package/template/src/pages/video-call/VideoCallScreen.native.tsx +38 -0
- package/template/src/pages/video-call/VideoCallScreen.tsx +379 -74
- package/template/src/pages/video-call/VideoCallScreenWrapper.tsx +51 -0
- package/template/src/pages/video-call/VideoComponent.tsx +81 -6
- package/template/src/pages/video-call/VideoRenderer.tsx +525 -63
- package/template/src/pages/video-call/VisibilitySensor.tsx +104 -0
- package/template/src/pages/video-call/ZoomableWrapper.native.tsx +34 -0
- package/template/src/pages/video-call/ZoomableWrapper.tsx +5 -0
- package/template/src/pages/video-call/index.ts +51 -7
- package/template/src/rtm/RTMEngine.ts +22 -4
- package/template/src/rtm-events/constants.ts +26 -9
- package/template/src/rtm-events-api/Events.ts +114 -23
- package/template/src/rtm-events-api/LocalEvents.ts +15 -0
- package/template/src/rtm-events-api/types.ts +10 -5
- package/template/src/selection.json +1 -0
- package/template/src/subComponents/BlockUI.tsx +70 -0
- package/template/src/subComponents/ChatBubble.tsx +413 -96
- package/template/src/subComponents/ChatContainer.tsx +305 -101
- package/template/src/subComponents/ChatInput.native.tsx +269 -0
- package/template/src/subComponents/ChatInput.tsx +308 -156
- package/template/src/subComponents/Checkbox.native.tsx +46 -35
- package/template/src/subComponents/Checkbox.tsx +9 -8
- package/template/src/subComponents/CopyJoinInfo.tsx +52 -62
- package/template/src/subComponents/EndcallPopup.tsx +182 -0
- package/template/src/subComponents/FallbackLogo.tsx +122 -40
- package/template/src/subComponents/LanguageSelector.tsx +35 -31
- package/template/src/subComponents/LayoutIconButton.tsx +210 -0
- package/template/src/subComponents/LayoutIconDropdown.tsx +149 -133
- package/template/src/subComponents/{LayoutIconDropdown.native.tsx → LayoutIconDropdown1.native.tsx} +4 -18
- package/template/src/subComponents/Loading.tsx +60 -0
- package/template/src/subComponents/LocalAudioMute.tsx +181 -30
- package/template/src/subComponents/LocalEndCall.tsx +118 -36
- package/template/src/subComponents/LocalSwitchCamera.tsx +72 -40
- package/template/src/subComponents/LocalVideoMute.tsx +177 -30
- package/template/src/subComponents/Logo.tsx +3 -4
- package/template/src/subComponents/LogoutButton.tsx +2 -2
- package/template/src/subComponents/NetworkQualityPill.tsx +65 -84
- package/template/src/subComponents/OpenInNativeButton.tsx +3 -3
- package/template/src/subComponents/Recording.tsx +44 -31
- package/template/src/subComponents/RemoteAudioMute.tsx +83 -29
- package/template/src/subComponents/RemoteEndCall.tsx +8 -5
- package/template/src/subComponents/RemoteMutePopup.tsx +115 -0
- package/template/src/subComponents/RemoteVideoMute.tsx +74 -21
- package/template/src/subComponents/RemoveMeetingPopup.tsx +122 -0
- package/template/src/subComponents/RemoveScreensharePopup.tsx +124 -0
- package/template/src/subComponents/ScreenShareNotice.tsx +95 -12
- package/template/src/subComponents/SelectDevice.tsx +548 -66
- package/template/src/subComponents/SelectDeviceSettings.backup.tsx +210 -0
- package/template/src/subComponents/SelectOAuth.tsx +9 -8
- package/template/src/subComponents/SidePanelButtons.ts +0 -3
- package/template/src/subComponents/SidePanelEnum.tsx +6 -4
- package/template/src/subComponents/SidePanelHeader.tsx +146 -0
- package/template/src/subComponents/ToastConfig.tsx +160 -11
- package/template/src/subComponents/caption/Caption.tsx +132 -0
- package/template/src/subComponents/caption/CaptionContainer.tsx +331 -0
- package/template/src/subComponents/caption/CaptionIcon.tsx +115 -0
- package/template/src/subComponents/caption/CaptionText.tsx +182 -0
- package/template/src/subComponents/caption/DownloadTranscriptBtn.tsx +65 -0
- package/template/src/subComponents/caption/LanguageSelectorPopup.tsx +192 -0
- package/template/src/subComponents/caption/Transcript.tsx +452 -0
- package/template/src/subComponents/caption/TranscriptIcon.tsx +126 -0
- package/template/src/subComponents/caption/TranscriptText.tsx +98 -0
- package/template/src/subComponents/caption/index.ts +3 -0
- package/template/src/subComponents/caption/proto/ptoto.js +91 -0
- package/template/src/subComponents/caption/proto/test.proto +23 -0
- package/template/src/subComponents/caption/useCaption.tsx +123 -0
- package/template/src/subComponents/caption/useCaptionWidth.ts +27 -0
- package/template/src/subComponents/caption/useSTTAPI.tsx +275 -0
- package/template/src/subComponents/caption/useStreamMessageUtils.native.ts +211 -0
- package/template/src/subComponents/caption/useStreamMessageUtils.ts +235 -0
- package/template/src/subComponents/caption/useTranscriptDownload.native.ts +93 -0
- package/template/src/subComponents/caption/useTranscriptDownload.ts +62 -0
- package/template/src/subComponents/caption/utils.ts +126 -0
- package/template/src/subComponents/chat/ChatActionMenu.tsx +224 -0
- package/template/src/subComponents/chat/ChatAttachment.native.tsx +237 -0
- package/template/src/subComponents/chat/ChatAttachment.tsx +205 -0
- package/template/src/subComponents/chat/ChatEmoji.native.tsx +75 -0
- package/template/src/subComponents/chat/ChatEmoji.tsx +182 -0
- package/template/src/subComponents/chat/ChatParticipants.tsx +232 -81
- package/template/src/subComponents/chat/ChatSendButton.tsx +209 -0
- package/template/src/subComponents/chat/ChatUploadStatus.tsx +84 -0
- package/template/src/subComponents/chat/ImagePopup.tsx +400 -0
- package/template/src/subComponents/livestream/ApprovedLiveStreamControlsView.tsx +2 -2
- package/template/src/subComponents/livestream/CurrentLiveStreamRequestsView.tsx +109 -47
- package/template/src/subComponents/livestream/controls/LocalRaiseHand.tsx +61 -45
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamApprovedRequestRecall.tsx +9 -8
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestApprove.tsx +29 -12
- package/template/src/subComponents/livestream/controls/RemoteLiveStreamRequestReject.tsx +33 -17
- package/template/src/subComponents/recording/useIsRecordingBot.tsx +76 -0
- package/template/src/subComponents/recording/useRecording.tsx +761 -108
- package/template/src/subComponents/recording/useRecordingLayoutQuery.tsx +93 -9
- package/template/src/subComponents/screenshare/ScreenshareButton.tsx +82 -75
- package/template/src/subComponents/screenshare/ScreenshareConfigure.native.tsx +494 -78
- package/template/src/subComponents/screenshare/ScreenshareConfigure.tsx +247 -110
- package/template/src/subComponents/screenshare/useScreenshare.tsx +6 -4
- package/template/src/subComponents/waiting-rooms/WaitingRoomControls.tsx +85 -0
- package/template/src/subComponents/waiting-rooms/useWaitingRoomAPI.ts +126 -0
- package/template/src/theme/index.ts +59 -0
- package/template/src/utils/PlatformWrapper.tsx +21 -0
- package/template/src/utils/SdkEvents.ts +37 -14
- package/template/src/utils/SdkMethodEvents.ts +105 -0
- package/template/src/utils/axiomLogger.ts +122 -0
- package/template/src/utils/book.jpg +0 -0
- package/template/src/utils/common.tsx +350 -7
- package/template/src/utils/constants.ts +4 -0
- package/template/src/utils/fetch-retry.ts +23 -0
- package/template/src/utils/getCustomRoute.ts +7 -0
- package/template/src/utils/hexadecimalTransparency.ts +108 -0
- package/template/src/utils/index.tsx +83 -0
- package/template/src/utils/isMobileOrTablet.ts +7 -2
- package/template/src/utils/pendingStateUpdateHelper.ts +19 -0
- package/template/src/utils/useActionSheet.tsx +50 -0
- package/template/src/utils/useActiveSpeaker.ts +38 -0
- package/template/src/utils/useAppState.ts +17 -0
- package/template/src/utils/useAsyncEffect.ts +138 -0
- package/template/src/utils/useCreateRoom.ts +152 -0
- package/template/src/utils/useEndCall.ts +74 -0
- package/template/src/utils/useFindActiveSpeaker.native.ts +4 -0
- package/template/src/utils/useFindActiveSpeaker.ts +373 -0
- package/template/src/utils/useFocus.tsx +51 -0
- package/template/src/utils/useFullScreen.native.ts +12 -0
- package/template/src/utils/useFullScreen.ts +161 -0
- package/template/src/utils/useGetMeetingPhrase.ts +61 -10
- package/template/src/utils/useIsAudioEnabled.ts +3 -3
- package/template/src/utils/useIsHandRaised.ts +13 -0
- package/template/src/utils/useIsLocalUserSpeaking.native.ts +4 -0
- package/template/src/utils/useIsLocalUserSpeaking.ts +119 -0
- package/template/src/utils/useIsPSTN.ts +3 -3
- package/template/src/utils/useIsVideoEnabled.ts +3 -3
- package/template/src/utils/useJoinRoom.ts +304 -0
- package/template/src/utils/useLayout.tsx +9 -3
- package/template/src/utils/useLocalAudio.ts +69 -0
- package/template/src/utils/useLocalVideo.ts +69 -0
- package/template/src/{subComponents/screenshare/ScreenshareButton.native.tsx → utils/useMenu.tsx} +16 -3
- package/template/src/utils/useModal.tsx +8 -0
- package/template/src/utils/useMutePSTN.ts +45 -2
- package/template/src/utils/useMuteToggleLocal.ts +125 -49
- package/template/src/utils/useOrientation.native.tsx +3 -0
- package/template/src/utils/useOrientation.tsx +59 -0
- 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/useSearchParams.tsx +28 -0
- package/template/src/utils/useSidePanel.tsx +16 -5
- package/template/src/utils/useSpeechToText.ts +102 -0
- package/template/src/utils/useString.ts +19 -7
- 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/src/wasms/agora-virtual-background.wasm +0 -0
- package/template/static.d.ts +42 -0
- package/template/tsconfig_rsdk_index.json +3 -3
- package/template/tsconfig_wsdk_index.json +3 -3
- package/template/web/index.html +45 -17
- package/template/webpack.commons.js +16 -0
- package/template/webpack.rsdk.config.js +1 -2
- package/template/webpack.web.config.js +8 -3
- package/template/_buckconfig +0 -6
- package/template/_gitattributes +0 -1
- package/template/agora-rn-uikit/src/Contexts/RenderContext.tsx +0 -10
- package/template/android/app/_BUCK +0 -55
- package/template/android/app/build_defs.bzl +0 -19
- package/template/bridge/rtc/webNg/LocalView.tsx +0 -20
- package/template/ios/HelloWorld/AppDelegate.m +0 -74
- package/template/src/assets/icons.ts +0 -102
- package/template/src/components/OAuth.electron.tsx +0 -40
- package/template/src/components/OAuth.native.tsx +0 -53
- package/template/src/components/OAuth.tsx +0 -29
- package/template/src/components/OAuthConfig.ts +0 -77
- package/template/src/components/StoreToken.tsx +0 -38
- package/template/src/components/chat-ui/useChatUIControl.tsx +0 -69
- package/template/src/components/meeting-info/useMeetingInfo.tsx +0 -70
- 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
- package/template/src/utils/useCreateMeeting.ts +0 -88
- package/template/src/utils/useJoinMeeting.ts +0 -132
|
@@ -23,17 +23,28 @@ import AgoraRTC, {
|
|
|
23
23
|
EncryptionMode,
|
|
24
24
|
ILocalTrack,
|
|
25
25
|
ClientRoleOptions,
|
|
26
|
+
CameraVideoTrackInitConfig,
|
|
27
|
+
MicrophoneAudioTrackInitConfig,
|
|
28
|
+
IMicrophoneAudioTrack,
|
|
26
29
|
} from 'agora-rtc-sdk-ng';
|
|
27
30
|
import type {
|
|
28
31
|
RtcEngineEvents,
|
|
29
32
|
Subscription,
|
|
30
33
|
} from 'react-native-agora/lib/typescript/src/common/RtcEvents';
|
|
34
|
+
|
|
35
|
+
import {IRtcEngine} from 'react-native-agora';
|
|
31
36
|
import {VideoProfile} from '../quality';
|
|
32
|
-
import {
|
|
33
|
-
import {role, mode} from './Types';
|
|
37
|
+
import {ChannelProfileType, ClientRoleType} from '../../../agora-rn-uikit';
|
|
38
|
+
import {role, mode, RtcEngineContext} from './Types';
|
|
34
39
|
import {LOG_ENABLED, GEO_FENCING} from '../../../config.json';
|
|
35
40
|
import {Platform} from 'react-native';
|
|
36
41
|
import isMobileOrTablet from '../../../src/utils/isMobileOrTablet';
|
|
42
|
+
import {LogSource, logger} from '../../../src/logger/AppBuilderLogger';
|
|
43
|
+
import {
|
|
44
|
+
type VideoEncoderConfigurationPreset,
|
|
45
|
+
type ScreenEncoderConfigurationPreset,
|
|
46
|
+
type VideoEncoderConfiguration,
|
|
47
|
+
} from '../../../src/app-state/useVideoQuality';
|
|
37
48
|
|
|
38
49
|
interface MediaDeviceInfo {
|
|
39
50
|
readonly deviceId: string;
|
|
@@ -46,9 +57,12 @@ type callbackType = (uid?: UID) => void;
|
|
|
46
57
|
declare global {
|
|
47
58
|
interface Window {
|
|
48
59
|
engine: RtcEngine;
|
|
60
|
+
AgoraRTC: typeof AgoraRTC;
|
|
49
61
|
}
|
|
50
62
|
}
|
|
51
63
|
|
|
64
|
+
window.AgoraRTC = AgoraRTC;
|
|
65
|
+
|
|
52
66
|
export enum AREAS {
|
|
53
67
|
/**
|
|
54
68
|
* China.
|
|
@@ -132,6 +146,19 @@ export enum RnEncryptionEnum {
|
|
|
132
146
|
* @since v3.3.1
|
|
133
147
|
*/
|
|
134
148
|
AES256GCM = 6,
|
|
149
|
+
/**
|
|
150
|
+
* 7: 128-bit GCM encryption, GCM mode.
|
|
151
|
+
*
|
|
152
|
+
* @since v3.4.5
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
AES128GCM2 = 7,
|
|
156
|
+
/**
|
|
157
|
+
* 8: 256-bit AES encryption, GCM mode.
|
|
158
|
+
*
|
|
159
|
+
* @since v3.4.5
|
|
160
|
+
*/
|
|
161
|
+
AES256GCM2 = 8,
|
|
135
162
|
}
|
|
136
163
|
|
|
137
164
|
export enum VideoStreamType {
|
|
@@ -151,11 +178,35 @@ interface RemoteStream {
|
|
|
151
178
|
audio?: IRemoteAudioTrack;
|
|
152
179
|
video?: IRemoteVideoTrack;
|
|
153
180
|
}
|
|
181
|
+
|
|
154
182
|
if ($config.GEO_FENCING) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
183
|
+
try {
|
|
184
|
+
//include area is comma seperated value
|
|
185
|
+
let includeArea = $config.GEO_FENCING_INCLUDE_AREA
|
|
186
|
+
? $config.GEO_FENCING_INCLUDE_AREA
|
|
187
|
+
: AREAS.GLOBAL;
|
|
188
|
+
|
|
189
|
+
//exclude area is single value
|
|
190
|
+
let excludeArea = $config.GEO_FENCING_EXCLUDE_AREA
|
|
191
|
+
? $config.GEO_FENCING_EXCLUDE_AREA
|
|
192
|
+
: '';
|
|
193
|
+
|
|
194
|
+
includeArea = includeArea?.split(',');
|
|
195
|
+
|
|
196
|
+
//pass excludedArea if only its provided
|
|
197
|
+
if (excludeArea) {
|
|
198
|
+
AgoraRTC.setArea({
|
|
199
|
+
areaCode: includeArea,
|
|
200
|
+
excludedArea: excludeArea,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
//otherwise we can pass area directly
|
|
204
|
+
else {
|
|
205
|
+
AgoraRTC.setArea(includeArea);
|
|
206
|
+
}
|
|
207
|
+
} catch (setAeraError) {
|
|
208
|
+
console.log('error on RTC setArea', setAeraError);
|
|
209
|
+
}
|
|
159
210
|
}
|
|
160
211
|
|
|
161
212
|
if ($config.LOG_ENABLED) {
|
|
@@ -166,65 +217,194 @@ if ($config.LOG_ENABLED) {
|
|
|
166
217
|
}
|
|
167
218
|
|
|
168
219
|
export default class RtcEngine {
|
|
220
|
+
private activeSpeakerUid: number;
|
|
169
221
|
public appId: string;
|
|
170
222
|
// public AgoraRTC: any;
|
|
171
223
|
public client: any | IAgoraRTCClient;
|
|
172
224
|
public screenClient: any | IAgoraRTCClient;
|
|
173
225
|
public eventsMap = new Map<string, callbackType>([
|
|
174
|
-
['
|
|
175
|
-
['
|
|
176
|
-
['
|
|
177
|
-
['
|
|
178
|
-
['
|
|
179
|
-
['
|
|
180
|
-
['
|
|
226
|
+
['onUserJoined', () => null],
|
|
227
|
+
['onUserOffline', () => null],
|
|
228
|
+
['onJoinChannelSuccess', () => null],
|
|
229
|
+
['onScreenshareStopped', () => null],
|
|
230
|
+
['onRemoteAudioStateChanged', () => null],
|
|
231
|
+
['onRemoteVideoStateChanged', () => null],
|
|
232
|
+
['onNetworkQuality', () => null],
|
|
233
|
+
['onActiveSpeaker', () => null],
|
|
234
|
+
['onStreamMessage', () => null],
|
|
181
235
|
]);
|
|
182
236
|
public localStream: LocalStream = {};
|
|
183
237
|
public screenStream: ScreenStream = {};
|
|
184
238
|
public remoteStreams = new Map<UID, RemoteStream>();
|
|
185
239
|
private inScreenshare: Boolean = false;
|
|
186
|
-
private videoProfile:
|
|
240
|
+
private videoProfile:
|
|
241
|
+
| VideoEncoderConfigurationPreset
|
|
242
|
+
| VideoEncoderConfiguration;
|
|
243
|
+
private screenShareProfile:
|
|
244
|
+
| ScreenEncoderConfigurationPreset
|
|
245
|
+
| VideoEncoderConfiguration;
|
|
187
246
|
private isPublished = false;
|
|
188
|
-
private isAudioEnabled =
|
|
189
|
-
private isVideoEnabled =
|
|
247
|
+
private isAudioEnabled = false;
|
|
248
|
+
private isVideoEnabled = false;
|
|
190
249
|
private isAudioPublished = false;
|
|
191
250
|
private isVideoPublished = false;
|
|
192
251
|
private isJoined = false;
|
|
193
|
-
private
|
|
252
|
+
private videoDeviceId = undefined;
|
|
253
|
+
private audioDeviceId = undefined;
|
|
194
254
|
private muteLocalVideoMutex = false;
|
|
195
255
|
private muteLocalAudioMutex = false;
|
|
196
|
-
|
|
256
|
+
private speakerDeviceId = '';
|
|
257
|
+
private usersVolumeLevel = [];
|
|
197
258
|
// Create channel profile and set it here
|
|
198
259
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
260
|
+
initialize(context: RtcEngineContext) {
|
|
261
|
+
const {appId} = context;
|
|
262
|
+
logger.log(LogSource.AgoraSDK, 'Log', 'RTC engine initialized');
|
|
202
263
|
this.appId = appId;
|
|
203
|
-
|
|
264
|
+
}
|
|
265
|
+
getLocalVideoStats() {
|
|
266
|
+
try {
|
|
267
|
+
logger.log(
|
|
268
|
+
LogSource.AgoraSDK,
|
|
269
|
+
'API',
|
|
270
|
+
'RTC [getLocalVideoStats] getting local video stats',
|
|
271
|
+
);
|
|
272
|
+
const data = this.client?.getLocalVideoStats();
|
|
273
|
+
logger.log(
|
|
274
|
+
LogSource.AgoraSDK,
|
|
275
|
+
'API',
|
|
276
|
+
'RTC [getLocalVideoStats] got local video stats successfully',
|
|
277
|
+
data,
|
|
278
|
+
);
|
|
279
|
+
return data;
|
|
280
|
+
} catch (error) {
|
|
281
|
+
return error;
|
|
282
|
+
}
|
|
204
283
|
}
|
|
205
284
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
285
|
+
getRemoteVideoStats(id: string) {
|
|
286
|
+
try {
|
|
287
|
+
logger.log(
|
|
288
|
+
LogSource.AgoraSDK,
|
|
289
|
+
'API',
|
|
290
|
+
'RTC [getRemoteVideoStats] getting remote video stats',
|
|
291
|
+
);
|
|
292
|
+
const data = this.client.getRemoteVideoStats();
|
|
293
|
+
logger.log(
|
|
294
|
+
LogSource.AgoraSDK,
|
|
295
|
+
'API',
|
|
296
|
+
'RTC [getRemoteVideoStats] got remote video stats successfully',
|
|
297
|
+
data,
|
|
298
|
+
);
|
|
299
|
+
return data && data[id] ? data[id] : null;
|
|
300
|
+
} catch (error) {
|
|
301
|
+
logger.error(
|
|
302
|
+
LogSource.AgoraSDK,
|
|
303
|
+
'API',
|
|
304
|
+
'RTC [getRemoteVideoStats] Error while getting remote video stats',
|
|
305
|
+
error,
|
|
306
|
+
);
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
210
309
|
}
|
|
211
310
|
|
|
212
|
-
async setVideoProfile(
|
|
213
|
-
|
|
311
|
+
async setVideoProfile(
|
|
312
|
+
profile: VideoEncoderConfigurationPreset | VideoEncoderConfiguration,
|
|
313
|
+
): Promise<void> {
|
|
314
|
+
try {
|
|
315
|
+
this.videoProfile = profile;
|
|
316
|
+
logger.log(
|
|
317
|
+
LogSource.AgoraSDK,
|
|
318
|
+
'API',
|
|
319
|
+
`RTC [setEncoderConfiguration] setting video profile.`,
|
|
320
|
+
profile,
|
|
321
|
+
);
|
|
322
|
+
await this.localStream?.video?.setEncoderConfiguration(profile);
|
|
323
|
+
logger.log(
|
|
324
|
+
LogSource.AgoraSDK,
|
|
325
|
+
'API',
|
|
326
|
+
`RTC [setEncoderConfiguration] video profile is set successfully`,
|
|
327
|
+
profile,
|
|
328
|
+
);
|
|
329
|
+
} catch (error) {
|
|
330
|
+
logger.error(
|
|
331
|
+
LogSource.AgoraSDK,
|
|
332
|
+
'API',
|
|
333
|
+
`RTC [setEncoderConfiguration] Error while setting video profile.`,
|
|
334
|
+
error,
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
async setScreenShareProfile(
|
|
340
|
+
profile: ScreenEncoderConfigurationPreset | VideoEncoderConfiguration,
|
|
341
|
+
): Promise<void> {
|
|
342
|
+
try {
|
|
343
|
+
this.screenShareProfile = profile;
|
|
344
|
+
logger.log(
|
|
345
|
+
LogSource.AgoraSDK,
|
|
346
|
+
'API',
|
|
347
|
+
`RTC [setEncoderConfiguration] set screen share profile.`,
|
|
348
|
+
profile,
|
|
349
|
+
);
|
|
350
|
+
await this.screenStream?.video?.setEncoderConfiguration(profile);
|
|
351
|
+
logger.log(
|
|
352
|
+
LogSource.AgoraSDK,
|
|
353
|
+
'API',
|
|
354
|
+
`RTC [setEncoderConfiguration] screen share profile is set successfully.`,
|
|
355
|
+
profile,
|
|
356
|
+
);
|
|
357
|
+
} catch (error) {
|
|
358
|
+
logger.error(
|
|
359
|
+
LogSource.AgoraSDK,
|
|
360
|
+
'API',
|
|
361
|
+
`RTC [setEncoderConfiguration] Error while setting screen share profile.`,
|
|
362
|
+
error,
|
|
363
|
+
);
|
|
364
|
+
}
|
|
214
365
|
}
|
|
215
366
|
|
|
216
367
|
async enableAudio(): Promise<void> {
|
|
368
|
+
const audioConfig: MicrophoneAudioTrackInitConfig = {
|
|
369
|
+
bypassWebAudio: Platform.OS == 'web' && isMobileOrTablet(),
|
|
370
|
+
// microphoneId: this.audioDeviceId,
|
|
371
|
+
};
|
|
217
372
|
try {
|
|
218
|
-
|
|
373
|
+
logger.log(
|
|
374
|
+
LogSource.AgoraSDK,
|
|
375
|
+
'API',
|
|
376
|
+
'RTC [createMicrophoneAudioTrack] creating audio track',
|
|
377
|
+
audioConfig,
|
|
378
|
+
);
|
|
379
|
+
let localAudio = await AgoraRTC.createMicrophoneAudioTrack(audioConfig);
|
|
380
|
+
logger.log(
|
|
381
|
+
LogSource.AgoraSDK,
|
|
382
|
+
'API',
|
|
383
|
+
'RTC [createMicrophoneAudioTrack] created audio track successfully',
|
|
384
|
+
audioConfig,
|
|
385
|
+
);
|
|
219
386
|
this.localStream.audio = localAudio;
|
|
387
|
+
this.audioDeviceId = localAudio
|
|
388
|
+
?.getMediaStreamTrack()
|
|
389
|
+
.getSettings().deviceId;
|
|
390
|
+
this.isAudioEnabled = true;
|
|
220
391
|
} catch (e) {
|
|
392
|
+
logger.error(
|
|
393
|
+
LogSource.AgoraSDK,
|
|
394
|
+
'API',
|
|
395
|
+
'RTC [createMicrophoneAudioTrack] Error while creating audio track',
|
|
396
|
+
error,
|
|
397
|
+
);
|
|
221
398
|
let audioError = e;
|
|
222
399
|
e.status = {audioError};
|
|
223
400
|
throw e;
|
|
224
401
|
}
|
|
225
402
|
}
|
|
226
403
|
|
|
227
|
-
async enableVideo(
|
|
404
|
+
async enableVideo(
|
|
405
|
+
preferredCameraId?: string,
|
|
406
|
+
preferredMicrophoneId?: string,
|
|
407
|
+
): Promise<void> {
|
|
228
408
|
/**
|
|
229
409
|
* Issue: Backgrounding the browser or app causes the audio streaming to be cut off.
|
|
230
410
|
* Impact: All browsers and apps that use WKWebView on iOS 15.x, such as Safari and Chrome.
|
|
@@ -234,31 +414,194 @@ export default class RtcEngine {
|
|
|
234
414
|
* The Web SDK directly publishes the local audio stream without processing it through WebAudio.
|
|
235
415
|
*/
|
|
236
416
|
|
|
237
|
-
const audioConfig =
|
|
238
|
-
Platform.OS == 'web' && isMobileOrTablet()
|
|
417
|
+
const audioConfig: MicrophoneAudioTrackInitConfig = {
|
|
418
|
+
bypassWebAudio: Platform.OS == 'web' && isMobileOrTablet(),
|
|
419
|
+
microphoneId: preferredMicrophoneId,
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
const videoConfig: CameraVideoTrackInitConfig = {
|
|
423
|
+
encoderConfig: this.videoProfile,
|
|
424
|
+
cameraId: preferredCameraId,
|
|
425
|
+
};
|
|
239
426
|
try {
|
|
427
|
+
logger.log(
|
|
428
|
+
LogSource.AgoraSDK,
|
|
429
|
+
'API',
|
|
430
|
+
'RTC [createMicrophoneAndCameraTracks] creating audio and video tracks',
|
|
431
|
+
{
|
|
432
|
+
audioConfig,
|
|
433
|
+
videoConfig,
|
|
434
|
+
},
|
|
435
|
+
);
|
|
240
436
|
let [localAudio, localVideo] =
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
437
|
+
// If preferred devices are not present, the createTrack call will fallover to
|
|
438
|
+
// the catch block below.
|
|
439
|
+
await AgoraRTC.createMicrophoneAndCameraTracks(
|
|
440
|
+
audioConfig,
|
|
441
|
+
videoConfig,
|
|
442
|
+
);
|
|
443
|
+
logger.log(
|
|
444
|
+
LogSource.AgoraSDK,
|
|
445
|
+
'API',
|
|
446
|
+
'RTC [createMicrophoneAndCameraTracks] audio and video tracks created successfully',
|
|
447
|
+
);
|
|
244
448
|
this.localStream.audio = localAudio;
|
|
245
449
|
this.localStream.video = localVideo;
|
|
450
|
+
this.audioDeviceId = localAudio
|
|
451
|
+
?.getMediaStreamTrack()
|
|
452
|
+
.getSettings().deviceId;
|
|
453
|
+
this.videoDeviceId = localVideo
|
|
454
|
+
?.getMediaStreamTrack()
|
|
455
|
+
.getSettings().deviceId;
|
|
456
|
+
this.isVideoEnabled = true;
|
|
457
|
+
this.isAudioEnabled = true;
|
|
246
458
|
} catch (e) {
|
|
459
|
+
logger.log(
|
|
460
|
+
LogSource.AgoraSDK,
|
|
461
|
+
'API',
|
|
462
|
+
'RTC [createMicrophoneAndCameraTracks] Error while creating audio and video tracks',
|
|
463
|
+
{
|
|
464
|
+
error: e,
|
|
465
|
+
},
|
|
466
|
+
);
|
|
247
467
|
let audioError = false;
|
|
248
468
|
let videoError = false;
|
|
249
469
|
try {
|
|
250
|
-
let localAudio
|
|
251
|
-
|
|
470
|
+
let localAudio: IMicrophoneAudioTrack;
|
|
471
|
+
logger.log(
|
|
472
|
+
LogSource.AgoraSDK,
|
|
473
|
+
'API',
|
|
474
|
+
'RTC [createMicrophoneAudioTrack] creating audio track ',
|
|
475
|
+
audioConfig,
|
|
476
|
+
);
|
|
477
|
+
try {
|
|
478
|
+
localAudio = await AgoraRTC.createMicrophoneAudioTrack(audioConfig);
|
|
479
|
+
logger.log(
|
|
480
|
+
LogSource.AgoraSDK,
|
|
481
|
+
'API',
|
|
482
|
+
'RTC [createMicrophoneAudioTrack] audio track created',
|
|
483
|
+
);
|
|
484
|
+
} catch (eAudio) {
|
|
485
|
+
logger.log(
|
|
486
|
+
LogSource.AgoraSDK,
|
|
487
|
+
'API',
|
|
488
|
+
'RTC [createMicrophoneAudioTrack] Error while creating audio tracks',
|
|
489
|
+
eAudio,
|
|
490
|
+
);
|
|
491
|
+
logger.log(
|
|
492
|
+
LogSource.AgoraSDK,
|
|
493
|
+
'Log',
|
|
494
|
+
'RTC [createMicrophoneAudioTrack] Setting microphoneId as empty and again creating audio track',
|
|
495
|
+
);
|
|
496
|
+
videoConfig.microphoneId = '';
|
|
497
|
+
localAudio = await AgoraRTC.createMicrophoneAudioTrack(audioConfig);
|
|
498
|
+
logger.log(
|
|
499
|
+
LogSource.AgoraSDK,
|
|
500
|
+
'API',
|
|
501
|
+
'RTC [createMicrophoneAudioTrack] audio track created successfully',
|
|
502
|
+
);
|
|
503
|
+
}
|
|
252
504
|
this.localStream.audio = localAudio;
|
|
505
|
+
this.audioDeviceId = localAudio
|
|
506
|
+
?.getMediaStreamTrack()
|
|
507
|
+
.getSettings().deviceId;
|
|
508
|
+
this.isAudioEnabled = true;
|
|
253
509
|
} catch (error) {
|
|
510
|
+
logger.error(
|
|
511
|
+
LogSource.AgoraSDK,
|
|
512
|
+
'API',
|
|
513
|
+
'RTC [createMicrophoneAudioTrack] Error while creating audio track',
|
|
514
|
+
error,
|
|
515
|
+
);
|
|
254
516
|
audioError = error;
|
|
255
517
|
}
|
|
518
|
+
|
|
256
519
|
try {
|
|
257
|
-
let localVideo
|
|
258
|
-
|
|
259
|
-
|
|
520
|
+
let localVideo: ICameraVideoTrack;
|
|
521
|
+
try {
|
|
522
|
+
logger.log(
|
|
523
|
+
LogSource.AgoraSDK,
|
|
524
|
+
'API',
|
|
525
|
+
'RTC [createCameraVideoTrack] creating video track',
|
|
526
|
+
videoConfig,
|
|
527
|
+
);
|
|
528
|
+
localVideo = await AgoraRTC.createCameraVideoTrack(videoConfig);
|
|
529
|
+
logger.log(
|
|
530
|
+
LogSource.AgoraSDK,
|
|
531
|
+
'API',
|
|
532
|
+
'RTC [createCameraVideoTrack] video track created successfully',
|
|
533
|
+
);
|
|
534
|
+
} catch (eVideo) {
|
|
535
|
+
logger.debug(
|
|
536
|
+
LogSource.AgoraSDK,
|
|
537
|
+
'API',
|
|
538
|
+
'RTC [createCameraVideoTrack] Error while creating video tracks',
|
|
539
|
+
eVideo,
|
|
540
|
+
);
|
|
541
|
+
logger.log(
|
|
542
|
+
LogSource.AgoraSDK,
|
|
543
|
+
'Log',
|
|
544
|
+
'RTC [createCameraVideoTrack] Setting cameraId as empty and again creating video track',
|
|
545
|
+
);
|
|
546
|
+
videoConfig.cameraId = '';
|
|
547
|
+
try {
|
|
548
|
+
localVideo = await AgoraRTC.createCameraVideoTrack(videoConfig);
|
|
549
|
+
logger.log(LogSource.AgoraSDK, 'API', 'RTC video track created');
|
|
550
|
+
} catch (error) {
|
|
551
|
+
logger.debug(
|
|
552
|
+
LogSource.AgoraSDK,
|
|
553
|
+
'API',
|
|
554
|
+
'RTC [createCameraVideoTrack] Error while creating video track',
|
|
555
|
+
error,
|
|
556
|
+
);
|
|
557
|
+
logger.log(
|
|
558
|
+
LogSource.AgoraSDK,
|
|
559
|
+
'Log',
|
|
560
|
+
'RTC [RTCEngineBridge]: Provided cameraId and default camera failed, Trying other available devices',
|
|
561
|
+
);
|
|
562
|
+
const devices = await navigator.mediaDevices.enumerateDevices();
|
|
563
|
+
logger.log(
|
|
564
|
+
LogSource.AgoraSDK,
|
|
565
|
+
'Log',
|
|
566
|
+
'RTC [enumerateDevices] media devices available',
|
|
567
|
+
devices,
|
|
568
|
+
);
|
|
569
|
+
for (let device of devices) {
|
|
570
|
+
if (device.kind === 'videoinput') {
|
|
571
|
+
videoConfig.cameraId = device.deviceId;
|
|
572
|
+
try {
|
|
573
|
+
localVideo = await AgoraRTC.createCameraVideoTrack(
|
|
574
|
+
videoConfig,
|
|
575
|
+
);
|
|
576
|
+
break;
|
|
577
|
+
} catch (eVideoDevice) {
|
|
578
|
+
videoError = eVideoDevice;
|
|
579
|
+
logger.log(
|
|
580
|
+
LogSource.AgoraSDK,
|
|
581
|
+
'Log',
|
|
582
|
+
'RTC Camera not available with deviceId',
|
|
583
|
+
{
|
|
584
|
+
device,
|
|
585
|
+
reason: eVideoDevice,
|
|
586
|
+
},
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
260
593
|
this.localStream.video = localVideo;
|
|
594
|
+
this.videoDeviceId = localVideo
|
|
595
|
+
?.getMediaStreamTrack()
|
|
596
|
+
.getSettings().deviceId;
|
|
597
|
+
this.isVideoEnabled = true;
|
|
261
598
|
} catch (error) {
|
|
599
|
+
logger.error(
|
|
600
|
+
LogSource.AgoraSDK,
|
|
601
|
+
'API',
|
|
602
|
+
'RTC [createCameraVideoTrack] Error while creating video track',
|
|
603
|
+
error,
|
|
604
|
+
);
|
|
262
605
|
videoError = error;
|
|
263
606
|
}
|
|
264
607
|
e.status = {audioError, videoError};
|
|
@@ -271,6 +614,21 @@ export default class RtcEngine {
|
|
|
271
614
|
}
|
|
272
615
|
}
|
|
273
616
|
|
|
617
|
+
async enableAudioVolumeIndication(interval, smooth, isLocal) {
|
|
618
|
+
AgoraRTC.setParameter('AUDIO_VOLUME_INDICATION_INTERVAL', interval);
|
|
619
|
+
logger.log(
|
|
620
|
+
LogSource.AgoraSDK,
|
|
621
|
+
'API',
|
|
622
|
+
`RTC [setParameter] parameter AUDIO_VOLUME_INDICATION_INTERVAL set to interval ${interval}`,
|
|
623
|
+
);
|
|
624
|
+
this.client.enableAudioVolumeIndicator();
|
|
625
|
+
logger.log(
|
|
626
|
+
LogSource.AgoraSDK,
|
|
627
|
+
'API',
|
|
628
|
+
'RTC [enableAudioVolumeIndicator] enabled to report the local and remote users who are speaking and their volumes',
|
|
629
|
+
);
|
|
630
|
+
}
|
|
631
|
+
|
|
274
632
|
async publish() {
|
|
275
633
|
if (this.localStream.audio || this.localStream.video) {
|
|
276
634
|
try {
|
|
@@ -283,7 +641,17 @@ export default class RtcEngine {
|
|
|
283
641
|
tracks.push(this.localStream.video);
|
|
284
642
|
|
|
285
643
|
if (tracks.length > 0) {
|
|
644
|
+
logger.log(
|
|
645
|
+
LogSource.AgoraSDK,
|
|
646
|
+
'API',
|
|
647
|
+
'RTC [publish] trying to publish tracks',
|
|
648
|
+
);
|
|
286
649
|
await this.client.publish(tracks);
|
|
650
|
+
logger.log(
|
|
651
|
+
LogSource.AgoraSDK,
|
|
652
|
+
'API',
|
|
653
|
+
'RTC [publish] tracks done successfully',
|
|
654
|
+
);
|
|
287
655
|
if (tracks[0].trackMediaType === 'audio') {
|
|
288
656
|
this.isAudioPublished = true;
|
|
289
657
|
} else if (tracks[0].trackMediaType === 'video') {
|
|
@@ -298,10 +666,18 @@ export default class RtcEngine {
|
|
|
298
666
|
|
|
299
667
|
if (this.isPublished === false) {
|
|
300
668
|
this.isPublished = true;
|
|
301
|
-
(this.eventsMap.get('
|
|
669
|
+
(this.eventsMap.get('onJoinChannelSuccess') as callbackType)();
|
|
302
670
|
}
|
|
303
671
|
}
|
|
304
672
|
} catch (e) {
|
|
673
|
+
logger.error(
|
|
674
|
+
LogSource.AgoraSDK,
|
|
675
|
+
'API',
|
|
676
|
+
'RTC [publish] Error publish tracks failed',
|
|
677
|
+
{
|
|
678
|
+
error: e,
|
|
679
|
+
},
|
|
680
|
+
);
|
|
305
681
|
console.error(e, this.localStream);
|
|
306
682
|
this.isPublished = false;
|
|
307
683
|
}
|
|
@@ -311,19 +687,22 @@ export default class RtcEngine {
|
|
|
311
687
|
async joinChannel(
|
|
312
688
|
token: string,
|
|
313
689
|
channelName: string,
|
|
314
|
-
optionalInfo: string,
|
|
315
690
|
optionalUid: number,
|
|
691
|
+
_optionalInfo: {},
|
|
316
692
|
): Promise<void> {
|
|
317
693
|
// TODO create agora client here
|
|
318
|
-
this.client.on('user-joined',
|
|
319
|
-
(
|
|
320
|
-
(this.eventsMap.get('
|
|
694
|
+
this.client.on('user-joined', user => {
|
|
695
|
+
logger.log(LogSource.AgoraSDK, 'Event', 'RTC [user-joined]', user);
|
|
696
|
+
(this.eventsMap.get('onUserJoined') as callbackType)({}, user.uid);
|
|
697
|
+
(this.eventsMap.get('onRemoteVideoStateChanged') as callbackType)(
|
|
698
|
+
{},
|
|
321
699
|
user.uid,
|
|
322
700
|
0,
|
|
323
701
|
0,
|
|
324
702
|
0,
|
|
325
703
|
);
|
|
326
|
-
(this.eventsMap.get('
|
|
704
|
+
(this.eventsMap.get('onRemoteAudioStateChanged') as callbackType)(
|
|
705
|
+
{},
|
|
327
706
|
user.uid,
|
|
328
707
|
0,
|
|
329
708
|
0,
|
|
@@ -331,18 +710,27 @@ export default class RtcEngine {
|
|
|
331
710
|
);
|
|
332
711
|
});
|
|
333
712
|
|
|
334
|
-
this.client.on('user-left',
|
|
713
|
+
this.client.on('user-left', user => {
|
|
714
|
+
logger.log(LogSource.AgoraSDK, 'Event', 'RTC [user-left]', user);
|
|
335
715
|
const uid = user.uid;
|
|
336
716
|
if (this.remoteStreams.has(uid)) {
|
|
337
717
|
this.remoteStreams.delete(uid);
|
|
338
718
|
}
|
|
339
|
-
(this.eventsMap.get('
|
|
719
|
+
(this.eventsMap.get('onUserOffline') as callbackType)({}, uid);
|
|
340
720
|
// (this.eventsMap.get('UserJoined') as callbackType)(uid);
|
|
341
721
|
});
|
|
342
722
|
this.client.on('user-published', async (user, mediaType) => {
|
|
343
723
|
// Initiate the subscription
|
|
724
|
+
logger.log(
|
|
725
|
+
LogSource.AgoraSDK,
|
|
726
|
+
'Event',
|
|
727
|
+
'RTC [user-published]',
|
|
728
|
+
user,
|
|
729
|
+
mediaType,
|
|
730
|
+
);
|
|
344
731
|
if (this.inScreenshare && user.uid === this.screenClient.uid) {
|
|
345
|
-
(this.eventsMap.get('
|
|
732
|
+
(this.eventsMap.get('onRemoteVideoStateChanged') as callbackType)(
|
|
733
|
+
{},
|
|
346
734
|
user.uid,
|
|
347
735
|
2,
|
|
348
736
|
0,
|
|
@@ -350,6 +738,13 @@ export default class RtcEngine {
|
|
|
350
738
|
);
|
|
351
739
|
} else {
|
|
352
740
|
await this.client.subscribe(user, mediaType);
|
|
741
|
+
logger.log(
|
|
742
|
+
LogSource.AgoraSDK,
|
|
743
|
+
'API',
|
|
744
|
+
'RTC [subscribe] to track successfully done',
|
|
745
|
+
user,
|
|
746
|
+
mediaType,
|
|
747
|
+
);
|
|
353
748
|
}
|
|
354
749
|
// If the subscribed track is an audio track
|
|
355
750
|
if (mediaType === 'audio') {
|
|
@@ -360,7 +755,14 @@ export default class RtcEngine {
|
|
|
360
755
|
...this.remoteStreams.get(user.uid),
|
|
361
756
|
audio: audioTrack,
|
|
362
757
|
});
|
|
363
|
-
(this.
|
|
758
|
+
if (this.speakerDeviceId) {
|
|
759
|
+
// setting sepeaker for all remote stream (newly joining user)
|
|
760
|
+
this.remoteStreams
|
|
761
|
+
.get(user.uid)
|
|
762
|
+
?.audio?.setPlaybackDevice(this.speakerDeviceId);
|
|
763
|
+
}
|
|
764
|
+
(this.eventsMap.get('onRemoteAudioStateChanged') as callbackType)(
|
|
765
|
+
{},
|
|
364
766
|
user.uid,
|
|
365
767
|
2,
|
|
366
768
|
0,
|
|
@@ -374,7 +776,8 @@ export default class RtcEngine {
|
|
|
374
776
|
...this.remoteStreams.get(user.uid),
|
|
375
777
|
video: videoTrack,
|
|
376
778
|
});
|
|
377
|
-
(this.eventsMap.get('
|
|
779
|
+
(this.eventsMap.get('onRemoteVideoStateChanged') as callbackType)(
|
|
780
|
+
{},
|
|
378
781
|
user.uid,
|
|
379
782
|
2,
|
|
380
783
|
0,
|
|
@@ -383,10 +786,18 @@ export default class RtcEngine {
|
|
|
383
786
|
}
|
|
384
787
|
});
|
|
385
788
|
this.client.on('user-unpublished', async (user, mediaType) => {
|
|
789
|
+
logger.log(
|
|
790
|
+
LogSource.AgoraSDK,
|
|
791
|
+
'Event',
|
|
792
|
+
'RTC [user-unpublished]',
|
|
793
|
+
user,
|
|
794
|
+
mediaType,
|
|
795
|
+
);
|
|
386
796
|
if (mediaType === 'audio') {
|
|
387
797
|
const {audio, ...rest} = this.remoteStreams.get(user.uid);
|
|
388
798
|
this.remoteStreams.set(user.uid, rest);
|
|
389
|
-
(this.eventsMap.get('
|
|
799
|
+
(this.eventsMap.get('onRemoteAudioStateChanged') as callbackType)(
|
|
800
|
+
{},
|
|
390
801
|
user.uid,
|
|
391
802
|
0,
|
|
392
803
|
0,
|
|
@@ -395,7 +806,8 @@ export default class RtcEngine {
|
|
|
395
806
|
} else {
|
|
396
807
|
const {video, ...rest} = this.remoteStreams.get(user.uid);
|
|
397
808
|
this.remoteStreams.set(user.uid, rest);
|
|
398
|
-
(this.eventsMap.get('
|
|
809
|
+
(this.eventsMap.get('onRemoteVideoStateChanged') as callbackType)(
|
|
810
|
+
{},
|
|
399
811
|
user.uid,
|
|
400
812
|
0,
|
|
401
813
|
0,
|
|
@@ -404,56 +816,140 @@ export default class RtcEngine {
|
|
|
404
816
|
}
|
|
405
817
|
});
|
|
406
818
|
|
|
819
|
+
this.client.on('volume-indicator', volumes => {
|
|
820
|
+
this.usersVolumeLevel = volumes;
|
|
821
|
+
/**
|
|
822
|
+
* old active speaker logic
|
|
823
|
+
const highestvolumeObj = volumes.reduce(
|
|
824
|
+
(highestVolume, volume, index) => {
|
|
825
|
+
if (highestVolume === null) {
|
|
826
|
+
return volume;
|
|
827
|
+
} else {
|
|
828
|
+
if (volume.level > highestVolume.level) {
|
|
829
|
+
return volume;
|
|
830
|
+
}
|
|
831
|
+
return highestVolume;
|
|
832
|
+
}
|
|
833
|
+
//console.log(`${index} UID ${volume.uid} Level ${volume.level}`);
|
|
834
|
+
},
|
|
835
|
+
null,
|
|
836
|
+
);
|
|
837
|
+
const activeSpeakerUid =
|
|
838
|
+
highestvolumeObj && highestvolumeObj?.level > 0 && highestvolumeObj?.uid
|
|
839
|
+
? highestvolumeObj.uid
|
|
840
|
+
: undefined;
|
|
841
|
+
|
|
842
|
+
//To avoid infinite calling dispatch checking if condition.
|
|
843
|
+
if (this.activeSpeakerUid !== activeSpeakerUid) {
|
|
844
|
+
const activeSpeakerCallBack = this.eventsMap.get(
|
|
845
|
+
'ActiveSpeaker',
|
|
846
|
+
) as callbackType;
|
|
847
|
+
activeSpeakerCallBack(activeSpeakerUid);
|
|
848
|
+
this.activeSpeakerUid = activeSpeakerUid;
|
|
849
|
+
}
|
|
850
|
+
*/
|
|
851
|
+
});
|
|
852
|
+
|
|
407
853
|
// this.client.on('stream-fallback', (evt))
|
|
408
854
|
this.client.on('stream-type-changed', function (uid, streamType) {
|
|
409
|
-
|
|
855
|
+
logger.debug(
|
|
856
|
+
LogSource.AgoraSDK,
|
|
857
|
+
'Event',
|
|
858
|
+
'RTC [stream-type-changed]',
|
|
859
|
+
uid,
|
|
860
|
+
streamType,
|
|
861
|
+
);
|
|
410
862
|
});
|
|
411
863
|
|
|
412
864
|
this.client.on(
|
|
413
865
|
'network-quality',
|
|
414
866
|
async ({downlinkNetworkQuality, uplinkNetworkQuality}) => {
|
|
415
867
|
const networkQualityIndicatorCallback = this.eventsMap.get(
|
|
416
|
-
'
|
|
868
|
+
'onNetworkQuality',
|
|
417
869
|
) as callbackType;
|
|
418
870
|
|
|
419
871
|
networkQualityIndicatorCallback(
|
|
872
|
+
{},
|
|
420
873
|
0,
|
|
421
|
-
downlinkNetworkQuality,
|
|
422
874
|
uplinkNetworkQuality,
|
|
875
|
+
downlinkNetworkQuality,
|
|
423
876
|
);
|
|
424
877
|
|
|
425
878
|
const remoteUserNetworkQualities =
|
|
426
879
|
this.client.getRemoteNetworkQuality();
|
|
427
880
|
|
|
428
|
-
Object.keys(remoteUserNetworkQualities).forEach(
|
|
881
|
+
Object.keys(remoteUserNetworkQualities).forEach(uid => {
|
|
429
882
|
networkQualityIndicatorCallback(
|
|
883
|
+
{},
|
|
430
884
|
uid,
|
|
431
|
-
remoteUserNetworkQualities[uid].downlinkNetworkQuality,
|
|
432
885
|
remoteUserNetworkQualities[uid].uplinkNetworkQuality,
|
|
886
|
+
remoteUserNetworkQualities[uid].downlinkNetworkQuality,
|
|
433
887
|
);
|
|
434
888
|
});
|
|
435
889
|
},
|
|
436
890
|
);
|
|
437
891
|
|
|
892
|
+
/* Recieve Captions */
|
|
893
|
+
this.client.on('stream-message', (uid: UID, payload: UInt8Array) => {
|
|
894
|
+
logger.debug(
|
|
895
|
+
LogSource.AgoraSDK,
|
|
896
|
+
'Event',
|
|
897
|
+
'RTC [stream-message](stt-web: onStreamMessageCallback)',
|
|
898
|
+
uid,
|
|
899
|
+
payload,
|
|
900
|
+
);
|
|
901
|
+
(this.eventsMap.get('onStreamMessage') as callbackType)(uid, payload);
|
|
902
|
+
});
|
|
903
|
+
|
|
904
|
+
logger.log(LogSource.AgoraSDK, 'API', 'RTC [join] trying to join channel', {
|
|
905
|
+
appId: this.appId,
|
|
906
|
+
channelName,
|
|
907
|
+
token,
|
|
908
|
+
optionalUid,
|
|
909
|
+
});
|
|
438
910
|
await this.client.join(
|
|
439
911
|
this.appId,
|
|
440
912
|
channelName,
|
|
441
913
|
token || null,
|
|
442
914
|
optionalUid || null,
|
|
443
915
|
);
|
|
916
|
+
logger.log(
|
|
917
|
+
LogSource.AgoraSDK,
|
|
918
|
+
'API',
|
|
919
|
+
'RTC [join] channel joined successfully',
|
|
920
|
+
);
|
|
444
921
|
this.isJoined = true;
|
|
445
922
|
|
|
923
|
+
logger.log(
|
|
924
|
+
LogSource.AgoraSDK,
|
|
925
|
+
'Log',
|
|
926
|
+
'RTC [publish] start publishing in the channel',
|
|
927
|
+
);
|
|
446
928
|
await this.publish();
|
|
447
929
|
console.log('enabling screen sleep');
|
|
448
930
|
}
|
|
449
931
|
|
|
932
|
+
getUsersVolumeLevel() {
|
|
933
|
+
return this.usersVolumeLevel;
|
|
934
|
+
}
|
|
935
|
+
|
|
450
936
|
async leaveChannel(): Promise<void> {
|
|
451
937
|
this.client.leave();
|
|
938
|
+
logger.log(
|
|
939
|
+
LogSource.AgoraSDK,
|
|
940
|
+
'API',
|
|
941
|
+
'RTC [leave] client has left the channel successfully',
|
|
942
|
+
);
|
|
452
943
|
this.remoteStreams.forEach((stream, uid, map) => {
|
|
453
944
|
stream.video?.close();
|
|
454
945
|
stream.audio?.close();
|
|
455
946
|
});
|
|
456
947
|
this.remoteStreams.clear();
|
|
948
|
+
logger.log(
|
|
949
|
+
LogSource.AgoraSDK,
|
|
950
|
+
'Log',
|
|
951
|
+
'RTC closed all remote streams successfully',
|
|
952
|
+
);
|
|
457
953
|
console.log('disabling screen sleep');
|
|
458
954
|
}
|
|
459
955
|
|
|
@@ -462,16 +958,19 @@ export default class RtcEngine {
|
|
|
462
958
|
listener: RtcEngineEvents[EventType],
|
|
463
959
|
): Subscription {
|
|
464
960
|
if (
|
|
465
|
-
event === '
|
|
466
|
-
event === '
|
|
467
|
-
event === '
|
|
468
|
-
event === '
|
|
469
|
-
event === '
|
|
470
|
-
event === '
|
|
471
|
-
event === '
|
|
961
|
+
event === 'onUserJoined' ||
|
|
962
|
+
event === 'onUserOffline' ||
|
|
963
|
+
event === 'onJoinChannelSuccess' ||
|
|
964
|
+
event === 'onScreenshareStopped' ||
|
|
965
|
+
event === 'onRemoteAudioStateChanged' ||
|
|
966
|
+
event === 'onRemoteVideoStateChanged' ||
|
|
967
|
+
event === 'onNetworkQuality' ||
|
|
968
|
+
event === 'onActiveSpeaker' ||
|
|
969
|
+
event === 'onStreamMessage'
|
|
472
970
|
) {
|
|
473
971
|
this.eventsMap.set(event, listener as callbackType);
|
|
474
972
|
}
|
|
973
|
+
|
|
475
974
|
return {
|
|
476
975
|
remove: () => {
|
|
477
976
|
console.log(
|
|
@@ -493,12 +992,34 @@ export default class RtcEngine {
|
|
|
493
992
|
* The camera light stays on for video
|
|
494
993
|
* It takes less time for the audio or video to resume.
|
|
495
994
|
*/
|
|
995
|
+
logger.log(
|
|
996
|
+
LogSource.AgoraSDK,
|
|
997
|
+
'Log',
|
|
998
|
+
`RTC [setMuted] trying to ${
|
|
999
|
+
muted ? 'mute' : 'unmute'
|
|
1000
|
+
} local audio stream`,
|
|
1001
|
+
);
|
|
1002
|
+
logger.log(
|
|
1003
|
+
LogSource.AgoraSDK,
|
|
1004
|
+
'API',
|
|
1005
|
+
`RTC [setMuted] on audio track with value - ${muted}`,
|
|
1006
|
+
);
|
|
496
1007
|
await this.localStream.audio?.setMuted(muted);
|
|
1008
|
+
logger.log(
|
|
1009
|
+
LogSource.AgoraSDK,
|
|
1010
|
+
'API',
|
|
1011
|
+
'RTC [setMuted] on audio track successfully done',
|
|
1012
|
+
);
|
|
497
1013
|
// Release the lock once done
|
|
498
1014
|
this.muteLocalAudioMutex = false;
|
|
499
1015
|
this.isAudioEnabled = !muted;
|
|
500
1016
|
// Unpublish only after when the user has joined the call
|
|
501
1017
|
if (!muted && !this.isAudioPublished && this.isJoined) {
|
|
1018
|
+
logger.log(
|
|
1019
|
+
LogSource.AgoraSDK,
|
|
1020
|
+
'Log',
|
|
1021
|
+
'RTC [publish] trying to publish audio track',
|
|
1022
|
+
);
|
|
502
1023
|
await this.publish();
|
|
503
1024
|
}
|
|
504
1025
|
}
|
|
@@ -506,9 +1027,11 @@ export default class RtcEngine {
|
|
|
506
1027
|
if (didProcureMutexLock) {
|
|
507
1028
|
this.muteLocalAudioMutex = false;
|
|
508
1029
|
}
|
|
509
|
-
|
|
1030
|
+
logger.error(
|
|
1031
|
+
LogSource.AgoraSDK,
|
|
1032
|
+
'Log',
|
|
1033
|
+
'RTC [setMuted] Error Be sure to invoke the enableVideo method before calling setMuted method.',
|
|
510
1034
|
e,
|
|
511
|
-
'\n Be sure to invoke the enableVideo method before using this method.',
|
|
512
1035
|
);
|
|
513
1036
|
}
|
|
514
1037
|
}
|
|
@@ -525,13 +1048,35 @@ export default class RtcEngine {
|
|
|
525
1048
|
* The indicator light of the camera turns off and stays off.
|
|
526
1049
|
* It takes more time for the audio or video to resume.
|
|
527
1050
|
*/
|
|
1051
|
+
logger.log(
|
|
1052
|
+
LogSource.AgoraSDK,
|
|
1053
|
+
'Log',
|
|
1054
|
+
`RTC [setEnabled] trying to ${
|
|
1055
|
+
muted ? 'mute' : 'unmute'
|
|
1056
|
+
} local video stream`,
|
|
1057
|
+
);
|
|
1058
|
+
logger.log(
|
|
1059
|
+
LogSource.AgoraSDK,
|
|
1060
|
+
'API',
|
|
1061
|
+
`RTC [setEnabled] on video track with value - ${!muted}`,
|
|
1062
|
+
);
|
|
528
1063
|
await this.localStream.video?.setEnabled(!muted);
|
|
1064
|
+
logger.log(
|
|
1065
|
+
LogSource.AgoraSDK,
|
|
1066
|
+
'API',
|
|
1067
|
+
'RTC [setEnabled] on video track done successfully',
|
|
1068
|
+
);
|
|
529
1069
|
// Release the lock once done
|
|
530
1070
|
this.muteLocalVideoMutex = false;
|
|
531
1071
|
|
|
532
1072
|
this.isVideoEnabled = !muted;
|
|
533
1073
|
// Unpublish only after when the user has joined the call
|
|
534
1074
|
if (!muted && !this.isVideoPublished && this.isJoined) {
|
|
1075
|
+
logger.log(
|
|
1076
|
+
LogSource.AgoraSDK,
|
|
1077
|
+
'Log',
|
|
1078
|
+
'RTC [publish] publish video track',
|
|
1079
|
+
);
|
|
535
1080
|
await this.publish();
|
|
536
1081
|
}
|
|
537
1082
|
}
|
|
@@ -541,25 +1086,70 @@ export default class RtcEngine {
|
|
|
541
1086
|
if (didProcureMutexLock) {
|
|
542
1087
|
this.muteLocalVideoMutex = false;
|
|
543
1088
|
}
|
|
544
|
-
|
|
1089
|
+
logger.error(
|
|
1090
|
+
LogSource.AgoraSDK,
|
|
1091
|
+
'Log',
|
|
1092
|
+
'RTC [setEnabled] Error Be sure to invoke the enableVideo method before calling setEnabled method.',
|
|
545
1093
|
e,
|
|
546
|
-
'\n Be sure to invoke the enableVideo method before using this method.',
|
|
547
1094
|
);
|
|
548
1095
|
}
|
|
549
1096
|
}
|
|
550
1097
|
|
|
551
1098
|
async muteRemoteAudioStream(uid: number, muted: boolean): Promise<void> {
|
|
552
1099
|
try {
|
|
1100
|
+
logger.log(
|
|
1101
|
+
LogSource.AgoraSDK,
|
|
1102
|
+
'API',
|
|
1103
|
+
`RTC [setEnabled] trying to ${
|
|
1104
|
+
muted ? 'mute' : 'unmute'
|
|
1105
|
+
} remote audio stream of user ${uid}`,
|
|
1106
|
+
);
|
|
553
1107
|
this.remoteStreams.get(uid)?.audio?.setEnabled(!muted);
|
|
1108
|
+
logger.log(
|
|
1109
|
+
LogSource.AgoraSDK,
|
|
1110
|
+
'API',
|
|
1111
|
+
`RTC [setEnabled] ${
|
|
1112
|
+
muted ? 'muted' : 'unmuted'
|
|
1113
|
+
} remote audio stream of user ${uid} done successfully`,
|
|
1114
|
+
);
|
|
554
1115
|
} catch (e) {
|
|
555
|
-
|
|
1116
|
+
logger.error(
|
|
1117
|
+
LogSource.AgoraSDK,
|
|
1118
|
+
'API',
|
|
1119
|
+
`RTC [setEnabled] Error: while ${
|
|
1120
|
+
muted ? 'muting' : 'unmuting'
|
|
1121
|
+
} remote audio stream of user ${uid}`,
|
|
1122
|
+
e,
|
|
1123
|
+
);
|
|
556
1124
|
}
|
|
557
1125
|
}
|
|
558
1126
|
|
|
559
1127
|
async muteRemoteVideoStream(uid: number, muted: boolean): Promise<void> {
|
|
560
1128
|
try {
|
|
1129
|
+
logger.log(
|
|
1130
|
+
LogSource.AgoraSDK,
|
|
1131
|
+
'API',
|
|
1132
|
+
`RTC [setEnabled] trying to ${
|
|
1133
|
+
muted ? 'mute' : 'unmute'
|
|
1134
|
+
} remote video stream of user ${uid}`,
|
|
1135
|
+
);
|
|
561
1136
|
this.remoteStreams.get(uid)?.video?.setEnabled(!muted);
|
|
1137
|
+
logger.log(
|
|
1138
|
+
LogSource.AgoraSDK,
|
|
1139
|
+
'API',
|
|
1140
|
+
`RTC [setEnabled] ${
|
|
1141
|
+
muted ? 'muted' : 'unmuted'
|
|
1142
|
+
} remote video stream of user ${uid} successfully`,
|
|
1143
|
+
);
|
|
562
1144
|
} catch (e) {
|
|
1145
|
+
logger.error(
|
|
1146
|
+
LogSource.AgoraSDK,
|
|
1147
|
+
'API',
|
|
1148
|
+
`RTC [setEnabled] Error while ${
|
|
1149
|
+
muted ? 'muting' : 'unmuting'
|
|
1150
|
+
} remote video stream of user ${uid}`,
|
|
1151
|
+
e,
|
|
1152
|
+
);
|
|
563
1153
|
console.error(e);
|
|
564
1154
|
}
|
|
565
1155
|
}
|
|
@@ -572,77 +1162,207 @@ export default class RtcEngine {
|
|
|
572
1162
|
return devices;
|
|
573
1163
|
}
|
|
574
1164
|
|
|
575
|
-
async setChannelProfile(profile:
|
|
1165
|
+
async setChannelProfile(profile: ChannelProfileType): Promise<void> {
|
|
576
1166
|
try {
|
|
1167
|
+
logger.log(
|
|
1168
|
+
LogSource.AgoraSDK,
|
|
1169
|
+
'API',
|
|
1170
|
+
`RTC [createClient] creating user and screen client with profile ${profile}`,
|
|
1171
|
+
);
|
|
577
1172
|
this.client = AgoraRTC.createClient({
|
|
578
|
-
codec: '
|
|
1173
|
+
codec: 'vp9',
|
|
579
1174
|
mode:
|
|
580
|
-
profile ===
|
|
1175
|
+
profile === ChannelProfileType.ChannelProfileLiveBroadcasting
|
|
1176
|
+
? mode.live
|
|
1177
|
+
: mode.rtc,
|
|
581
1178
|
});
|
|
582
1179
|
this.screenClient = AgoraRTC.createClient({
|
|
583
|
-
codec: '
|
|
1180
|
+
codec: 'vp9',
|
|
584
1181
|
mode:
|
|
585
|
-
profile ===
|
|
1182
|
+
profile === ChannelProfileType.ChannelProfileLiveBroadcasting
|
|
1183
|
+
? mode.live
|
|
1184
|
+
: mode.rtc,
|
|
586
1185
|
});
|
|
1186
|
+
logger.log(
|
|
1187
|
+
LogSource.AgoraSDK,
|
|
1188
|
+
'API',
|
|
1189
|
+
`RTC [createClient] user and screen client with profile ${profile} created successfully`,
|
|
1190
|
+
);
|
|
587
1191
|
} catch (e) {
|
|
1192
|
+
logger.error(
|
|
1193
|
+
LogSource.AgoraSDK,
|
|
1194
|
+
'API',
|
|
1195
|
+
`RTC [createClient] Error while creating user and screen client with profile ${profile}`,
|
|
1196
|
+
e,
|
|
1197
|
+
);
|
|
588
1198
|
throw e;
|
|
589
1199
|
}
|
|
590
1200
|
}
|
|
591
1201
|
|
|
592
1202
|
async setClientRole(
|
|
593
|
-
clientRole:
|
|
1203
|
+
clientRole: ClientRoleType,
|
|
594
1204
|
options?: ClientRoleOptions,
|
|
595
1205
|
): Promise<void> {
|
|
596
1206
|
try {
|
|
597
|
-
|
|
1207
|
+
logger.log(
|
|
1208
|
+
LogSource.AgoraSDK,
|
|
1209
|
+
'API',
|
|
1210
|
+
`RTC [setClientRole] for user and screen client with role ${
|
|
1211
|
+
clientRole == ClientRoleType.ClientRoleAudience
|
|
1212
|
+
? 'audience'
|
|
1213
|
+
: 'broadcaster'
|
|
1214
|
+
}`,
|
|
1215
|
+
);
|
|
1216
|
+
if (clientRole == ClientRoleType.ClientRoleAudience) {
|
|
598
1217
|
if (this.isJoined) {
|
|
599
1218
|
// Unpublish the streams when role is changed to Audience
|
|
1219
|
+
logger.log(
|
|
1220
|
+
LogSource.AgoraSDK,
|
|
1221
|
+
'Log',
|
|
1222
|
+
'RTC user is already joined, and role is to be changed to audience so we need to unpublish the streams',
|
|
1223
|
+
);
|
|
1224
|
+
logger.log(
|
|
1225
|
+
LogSource.AgoraSDK,
|
|
1226
|
+
'API',
|
|
1227
|
+
'RTC [unpublish] unpublish in the channel',
|
|
1228
|
+
);
|
|
600
1229
|
await this.client.unpublish();
|
|
1230
|
+
logger.log(
|
|
1231
|
+
LogSource.AgoraSDK,
|
|
1232
|
+
'API',
|
|
1233
|
+
'RTC [unpublish] unpublish in the channel done successfully',
|
|
1234
|
+
);
|
|
601
1235
|
this.isAudioPublished = false;
|
|
602
1236
|
this.isVideoPublished = false;
|
|
603
1237
|
this.isPublished = false;
|
|
604
1238
|
}
|
|
605
1239
|
await this.client.setClientRole(role.audience, options);
|
|
606
1240
|
await this.screenClient.setClientRole(role.audience, options);
|
|
607
|
-
} else if (clientRole ==
|
|
1241
|
+
} else if (clientRole == ClientRoleType.ClientRoleBroadcaster) {
|
|
608
1242
|
await this.client.setClientRole(role.host);
|
|
609
1243
|
await this.screenClient.setClientRole(role.host);
|
|
610
1244
|
}
|
|
1245
|
+
logger.log(
|
|
1246
|
+
LogSource.AgoraSDK,
|
|
1247
|
+
'API',
|
|
1248
|
+
`RTC [setClientRole] for user and screen client with role ${
|
|
1249
|
+
clientRole == ClientRoleType.ClientRoleAudience
|
|
1250
|
+
? 'audience'
|
|
1251
|
+
: 'broadcaster'
|
|
1252
|
+
} done successfully`,
|
|
1253
|
+
);
|
|
611
1254
|
} catch (e) {
|
|
1255
|
+
logger.error(
|
|
1256
|
+
LogSource.AgoraSDK,
|
|
1257
|
+
'API',
|
|
1258
|
+
`RTC [setClientRole] Error while doing setClientRole for user and screen client with role ${
|
|
1259
|
+
clientRole == ClientRoleType.ClientRoleAudience
|
|
1260
|
+
? 'audience'
|
|
1261
|
+
: 'broadcaster'
|
|
1262
|
+
}`,
|
|
1263
|
+
e,
|
|
1264
|
+
);
|
|
612
1265
|
throw e;
|
|
613
1266
|
}
|
|
614
1267
|
}
|
|
615
1268
|
|
|
616
1269
|
async changeCamera(cameraId, callback, error): Promise<void> {
|
|
617
1270
|
try {
|
|
1271
|
+
logger.log(
|
|
1272
|
+
LogSource.AgoraSDK,
|
|
1273
|
+
'API',
|
|
1274
|
+
`RTC [setDevice] trying to change camera to ${cameraId}`,
|
|
1275
|
+
);
|
|
618
1276
|
await this.localStream.video?.setDevice(cameraId);
|
|
619
|
-
|
|
1277
|
+
logger.log(
|
|
1278
|
+
LogSource.AgoraSDK,
|
|
1279
|
+
'API',
|
|
1280
|
+
'RTC [setDevice] camera set done successfully',
|
|
1281
|
+
);
|
|
1282
|
+
this.videoDeviceId = cameraId;
|
|
620
1283
|
callback(cameraId);
|
|
621
1284
|
} catch (e) {
|
|
1285
|
+
logger.error(
|
|
1286
|
+
LogSource.AgoraSDK,
|
|
1287
|
+
'API',
|
|
1288
|
+
'RTC [setDevice] Error setting camera',
|
|
1289
|
+
e,
|
|
1290
|
+
);
|
|
622
1291
|
error(e);
|
|
623
1292
|
}
|
|
624
1293
|
}
|
|
625
1294
|
|
|
626
1295
|
async switchCamera(): Promise<void> {
|
|
627
1296
|
try {
|
|
1297
|
+
logger.log(
|
|
1298
|
+
LogSource.AgoraSDK,
|
|
1299
|
+
'Log',
|
|
1300
|
+
'RTC switching camera on mobile web',
|
|
1301
|
+
);
|
|
628
1302
|
const devices = await AgoraRTC.getDevices(true);
|
|
629
1303
|
for (let i = 0; i < devices.length; i++) {
|
|
630
1304
|
let d = devices[i];
|
|
631
|
-
if (d.kind === 'videoinput' && d.deviceId !== this.
|
|
1305
|
+
if (d.kind === 'videoinput' && d.deviceId !== this.videoDeviceId) {
|
|
1306
|
+
logger.log(
|
|
1307
|
+
LogSource.AgoraSDK,
|
|
1308
|
+
'API',
|
|
1309
|
+
`RTC [setDevice]: trying to change camera to ${d.deviceId}`,
|
|
1310
|
+
);
|
|
632
1311
|
await this.localStream.video?.setDevice(d.deviceId);
|
|
633
|
-
|
|
1312
|
+
logger.log(
|
|
1313
|
+
LogSource.AgoraSDK,
|
|
1314
|
+
'API',
|
|
1315
|
+
'RTC [setDevice]: camera set successfully',
|
|
1316
|
+
);
|
|
1317
|
+
this.videoDeviceId = d.deviceId;
|
|
634
1318
|
break;
|
|
635
1319
|
}
|
|
636
1320
|
}
|
|
637
1321
|
} catch (e) {
|
|
1322
|
+
logger.error(
|
|
1323
|
+
LogSource.AgoraSDK,
|
|
1324
|
+
'Log',
|
|
1325
|
+
'RTC Error switching camera on mobile web',
|
|
1326
|
+
e,
|
|
1327
|
+
);
|
|
638
1328
|
throw e;
|
|
639
1329
|
}
|
|
640
1330
|
}
|
|
641
1331
|
|
|
642
1332
|
async changeMic(micId, callback, error) {
|
|
643
1333
|
try {
|
|
1334
|
+
logger.log(
|
|
1335
|
+
LogSource.AgoraSDK,
|
|
1336
|
+
'API',
|
|
1337
|
+
`RTC [setDevice]: trying to change microphone to ${micId}`,
|
|
1338
|
+
);
|
|
644
1339
|
await this.localStream.audio?.setDevice(micId);
|
|
1340
|
+
logger.log(
|
|
1341
|
+
LogSource.AgoraSDK,
|
|
1342
|
+
'API',
|
|
1343
|
+
'RTC [setDevice]: microphone set successfully',
|
|
1344
|
+
);
|
|
1345
|
+
this.audioDeviceId = micId;
|
|
645
1346
|
callback(micId);
|
|
1347
|
+
} catch (e) {
|
|
1348
|
+
logger.error(
|
|
1349
|
+
LogSource.AgoraSDK,
|
|
1350
|
+
'API',
|
|
1351
|
+
'RTC [setDevice]: Error setting microphone',
|
|
1352
|
+
e,
|
|
1353
|
+
);
|
|
1354
|
+
error(e);
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
async changeSpeaker(speakerId, callback, error) {
|
|
1359
|
+
try {
|
|
1360
|
+
// setting sepeaker for all remote stream (previously joined users)
|
|
1361
|
+
this.remoteStreams?.forEach((stream, uid, map) => {
|
|
1362
|
+
stream?.audio?.setPlaybackDevice(speakerId);
|
|
1363
|
+
});
|
|
1364
|
+
this.speakerDeviceId = speakerId;
|
|
1365
|
+
callback(speakerId);
|
|
646
1366
|
} catch (e) {
|
|
647
1367
|
error(e);
|
|
648
1368
|
}
|
|
@@ -669,7 +1389,7 @@ export default class RtcEngine {
|
|
|
669
1389
|
|
|
670
1390
|
// Bug in implementation !!!
|
|
671
1391
|
async setRemoteSubscribeFallbackOption(option: 0 | 1 | 2) {
|
|
672
|
-
this.streams.forEach(
|
|
1392
|
+
this.streams.forEach(stream => {
|
|
673
1393
|
this.client.setStreamFallbackOption(stream, option);
|
|
674
1394
|
});
|
|
675
1395
|
Promise.resolve();
|
|
@@ -694,6 +1414,17 @@ export default class RtcEngine {
|
|
|
694
1414
|
break;
|
|
695
1415
|
case RnEncryptionEnum.SM4128ECB:
|
|
696
1416
|
mode = 'sm4-128-ecb';
|
|
1417
|
+
break;
|
|
1418
|
+
case RnEncryptionEnum.AES256GCM:
|
|
1419
|
+
mode = 'aes-256-gcm';
|
|
1420
|
+
break;
|
|
1421
|
+
case RnEncryptionEnum.AES128GCM2:
|
|
1422
|
+
mode = 'aes-128-gcm2';
|
|
1423
|
+
break;
|
|
1424
|
+
case RnEncryptionEnum.AES256GCM2:
|
|
1425
|
+
mode = 'aes-256-gcm2';
|
|
1426
|
+
break;
|
|
1427
|
+
|
|
697
1428
|
default:
|
|
698
1429
|
mode = 'none';
|
|
699
1430
|
}
|
|
@@ -708,16 +1439,48 @@ export default class RtcEngine {
|
|
|
708
1439
|
config: {
|
|
709
1440
|
encryptionMode: RnEncryptionEnum;
|
|
710
1441
|
encryptionKey: string;
|
|
1442
|
+
encryptionKdfSalt: string;
|
|
711
1443
|
},
|
|
712
1444
|
): Promise<void> {
|
|
713
1445
|
let mode: EncryptionMode;
|
|
714
1446
|
mode = this.getEncryptionMode(enabled, config?.encryptionMode);
|
|
715
1447
|
try {
|
|
1448
|
+
logger.log(
|
|
1449
|
+
LogSource.AgoraSDK,
|
|
1450
|
+
'API',
|
|
1451
|
+
'RTC [setEncryptionConfig] trying to set encryption config on user and screen client',
|
|
1452
|
+
{
|
|
1453
|
+
mode,
|
|
1454
|
+
},
|
|
1455
|
+
);
|
|
716
1456
|
await Promise.all([
|
|
717
|
-
this.client.setEncryptionConfig(
|
|
718
|
-
|
|
1457
|
+
this.client.setEncryptionConfig(
|
|
1458
|
+
mode,
|
|
1459
|
+
config.encryptionKey,
|
|
1460
|
+
config.encryptionKdfSalt,
|
|
1461
|
+
true, // encryptDataStream
|
|
1462
|
+
),
|
|
1463
|
+
this.screenClient.setEncryptionConfig(
|
|
1464
|
+
mode,
|
|
1465
|
+
config.encryptionKey,
|
|
1466
|
+
config.encryptionKdfSalt,
|
|
1467
|
+
true, // encryptDataStream
|
|
1468
|
+
),
|
|
719
1469
|
]);
|
|
1470
|
+
logger.log(
|
|
1471
|
+
LogSource.AgoraSDK,
|
|
1472
|
+
'API',
|
|
1473
|
+
'RTC [setEncryptionConfig] set encryption config on user and screen client done successfully',
|
|
1474
|
+
);
|
|
720
1475
|
} catch (e) {
|
|
1476
|
+
logger.log(
|
|
1477
|
+
LogSource.AgoraSDK,
|
|
1478
|
+
'API',
|
|
1479
|
+
'RTC [setEncryptionConfig] Error while setting encryption config on user and screen client',
|
|
1480
|
+
{
|
|
1481
|
+
error: e,
|
|
1482
|
+
},
|
|
1483
|
+
);
|
|
721
1484
|
throw e;
|
|
722
1485
|
}
|
|
723
1486
|
}
|
|
@@ -742,13 +1505,18 @@ export default class RtcEngine {
|
|
|
742
1505
|
console.error('Please use enableEncryption instead');
|
|
743
1506
|
}
|
|
744
1507
|
|
|
745
|
-
async
|
|
1508
|
+
// async removeAllListeners<EventType extends keyof RtcEngineEvents>(event: EventType) {
|
|
1509
|
+
// this.client.removeAllListeners(eventName);
|
|
1510
|
+
// }
|
|
1511
|
+
|
|
1512
|
+
async release(): Promise<void> {
|
|
746
1513
|
if (this.inScreenshare) {
|
|
747
|
-
(this.eventsMap.get('
|
|
1514
|
+
(this.eventsMap.get('onUserOffline') as callbackType)(
|
|
1515
|
+
{},
|
|
748
1516
|
this.screenClient.uid,
|
|
749
1517
|
);
|
|
750
1518
|
this.screenClient.leave();
|
|
751
|
-
(this.eventsMap.get('
|
|
1519
|
+
(this.eventsMap.get('onScreenshareStopped') as callbackType)();
|
|
752
1520
|
}
|
|
753
1521
|
this.eventsMap.forEach((callback, event, map) => {
|
|
754
1522
|
this.client.off(event, callback);
|
|
@@ -767,6 +1535,11 @@ export default class RtcEngine {
|
|
|
767
1535
|
this.screenStream.audio?.close();
|
|
768
1536
|
this.screenStream.video?.close();
|
|
769
1537
|
this.screenStream = {};
|
|
1538
|
+
logger.log(
|
|
1539
|
+
LogSource.AgoraSDK,
|
|
1540
|
+
'Log',
|
|
1541
|
+
'RTC destroy called. Clearing all events and closing all streams',
|
|
1542
|
+
);
|
|
770
1543
|
}
|
|
771
1544
|
|
|
772
1545
|
async setRemoteVideoStreamType(
|
|
@@ -799,14 +1572,24 @@ export default class RtcEngine {
|
|
|
799
1572
|
encryption: {
|
|
800
1573
|
screenKey: string;
|
|
801
1574
|
mode: RnEncryptionEnum;
|
|
1575
|
+
salt: string;
|
|
1576
|
+
},
|
|
1577
|
+
screenShareConfig: ScreenVideoTrackInitConfig = {
|
|
1578
|
+
encoderConfig: this.screenShareProfile,
|
|
802
1579
|
},
|
|
803
|
-
config: ScreenVideoTrackInitConfig = {},
|
|
804
1580
|
audio: 'enable' | 'disable' | 'auto' = 'auto',
|
|
805
1581
|
): Promise<void> {
|
|
1582
|
+
const config: ScreenVideoTrackInitConfig = {
|
|
1583
|
+
...screenShareConfig,
|
|
1584
|
+
encoderConfig: this.screenShareProfile,
|
|
1585
|
+
};
|
|
806
1586
|
if (!this.inScreenshare) {
|
|
807
1587
|
try {
|
|
808
|
-
|
|
809
|
-
|
|
1588
|
+
logger.debug(
|
|
1589
|
+
LogSource.AgoraSDK,
|
|
1590
|
+
'Log',
|
|
1591
|
+
'RTC start screenshare, creating screen stream',
|
|
1592
|
+
);
|
|
810
1593
|
if (encryption && encryption.screenKey && encryption.mode) {
|
|
811
1594
|
let mode: EncryptionMode;
|
|
812
1595
|
mode = this.getEncryptionMode(true, encryption?.mode);
|
|
@@ -816,19 +1599,47 @@ export default class RtcEngine {
|
|
|
816
1599
|
* and joins again the encryption needs to be
|
|
817
1600
|
* set again
|
|
818
1601
|
*/
|
|
1602
|
+
logger.log(
|
|
1603
|
+
LogSource.AgoraSDK,
|
|
1604
|
+
'Log',
|
|
1605
|
+
'RTC [setEncryptionConfig] setting encryption again on screen client',
|
|
1606
|
+
);
|
|
819
1607
|
await this.screenClient.setEncryptionConfig(
|
|
820
1608
|
mode,
|
|
821
1609
|
encryption.screenKey,
|
|
1610
|
+
encryption.salt,
|
|
1611
|
+
true, // encryptDataStream
|
|
822
1612
|
);
|
|
823
1613
|
} catch (e) {
|
|
824
|
-
|
|
1614
|
+
logger.error(
|
|
1615
|
+
LogSource.AgoraSDK,
|
|
1616
|
+
'Log',
|
|
1617
|
+
'RTC [setEncryptionConfig] Error setting encryption for screenshare failed',
|
|
1618
|
+
e,
|
|
1619
|
+
);
|
|
825
1620
|
}
|
|
826
1621
|
}
|
|
827
1622
|
|
|
1623
|
+
logger.log(
|
|
1624
|
+
LogSource.AgoraSDK,
|
|
1625
|
+
'API',
|
|
1626
|
+
'RTC [createScreenVideoTrack] Trying to create screenshare tracks',
|
|
1627
|
+
{
|
|
1628
|
+
config,
|
|
1629
|
+
},
|
|
1630
|
+
);
|
|
828
1631
|
const screenTracks = await AgoraRTC.createScreenVideoTrack(
|
|
829
1632
|
config,
|
|
830
1633
|
audio,
|
|
831
1634
|
);
|
|
1635
|
+
logger.log(
|
|
1636
|
+
LogSource.AgoraSDK,
|
|
1637
|
+
'API',
|
|
1638
|
+
'RTC [createScreenVideoTrack] screenshare tracks created successfully',
|
|
1639
|
+
{
|
|
1640
|
+
tracks: screenTracks,
|
|
1641
|
+
},
|
|
1642
|
+
);
|
|
832
1643
|
if (this.isSingleTrack(screenTracks)) {
|
|
833
1644
|
this.screenStream.video = screenTracks;
|
|
834
1645
|
} else {
|
|
@@ -836,26 +1647,56 @@ export default class RtcEngine {
|
|
|
836
1647
|
this.screenStream.audio = screenTracks[1];
|
|
837
1648
|
}
|
|
838
1649
|
} catch (e) {
|
|
839
|
-
|
|
1650
|
+
logger.error(
|
|
1651
|
+
LogSource.AgoraSDK,
|
|
1652
|
+
'API',
|
|
1653
|
+
'RTC [createScreenVideoTrack] Error while creating screenshare tracks',
|
|
1654
|
+
e,
|
|
1655
|
+
);
|
|
840
1656
|
throw e;
|
|
841
1657
|
}
|
|
842
1658
|
|
|
1659
|
+
logger.log(
|
|
1660
|
+
LogSource.AgoraSDK,
|
|
1661
|
+
'API',
|
|
1662
|
+
'RTC [join] joining channel of screenclient',
|
|
1663
|
+
{
|
|
1664
|
+
appId: this.appId,
|
|
1665
|
+
channelName,
|
|
1666
|
+
token,
|
|
1667
|
+
optionalUid,
|
|
1668
|
+
},
|
|
1669
|
+
);
|
|
843
1670
|
await this.screenClient.join(
|
|
844
1671
|
this.appId,
|
|
845
1672
|
channelName,
|
|
846
1673
|
token || null,
|
|
847
1674
|
optionalUid || null,
|
|
848
1675
|
);
|
|
849
|
-
|
|
1676
|
+
logger.log(
|
|
1677
|
+
LogSource.AgoraSDK,
|
|
1678
|
+
'API',
|
|
1679
|
+
'RTC [join] joined channel successfully',
|
|
1680
|
+
);
|
|
850
1681
|
this.inScreenshare = true;
|
|
1682
|
+
logger.log(
|
|
1683
|
+
LogSource.AgoraSDK,
|
|
1684
|
+
'API',
|
|
1685
|
+
'RTC [publish] trying to publish screen tracks',
|
|
1686
|
+
);
|
|
851
1687
|
await this.screenClient.publish(
|
|
852
1688
|
this.screenStream.audio
|
|
853
1689
|
? [this.screenStream.video, this.screenStream.audio]
|
|
854
1690
|
: this.screenStream.video,
|
|
855
1691
|
);
|
|
856
|
-
|
|
1692
|
+
logger.log(
|
|
1693
|
+
LogSource.AgoraSDK,
|
|
1694
|
+
'API',
|
|
1695
|
+
'RTC [publish] screenshare tracks published successfully',
|
|
1696
|
+
);
|
|
857
1697
|
this.screenStream.video.on('track-ended', () => {
|
|
858
|
-
(this.eventsMap.get('
|
|
1698
|
+
(this.eventsMap.get('onUserOffline') as callbackType)(
|
|
1699
|
+
{},
|
|
859
1700
|
this.screenClient.uid,
|
|
860
1701
|
);
|
|
861
1702
|
|
|
@@ -865,15 +1706,16 @@ export default class RtcEngine {
|
|
|
865
1706
|
this.screenStream.video?.close();
|
|
866
1707
|
this.screenStream = {};
|
|
867
1708
|
|
|
868
|
-
(this.eventsMap.get('
|
|
1709
|
+
(this.eventsMap.get('onScreenshareStopped') as callbackType)();
|
|
869
1710
|
this.inScreenshare = false;
|
|
870
1711
|
});
|
|
871
1712
|
} else {
|
|
872
|
-
(this.eventsMap.get('
|
|
1713
|
+
(this.eventsMap.get('onUserOffline') as callbackType)(
|
|
1714
|
+
{},
|
|
873
1715
|
this.screenClient.uid,
|
|
874
1716
|
);
|
|
875
1717
|
this.screenClient.leave();
|
|
876
|
-
(this.eventsMap.get('
|
|
1718
|
+
(this.eventsMap.get('onScreenshareStopped') as callbackType)();
|
|
877
1719
|
try {
|
|
878
1720
|
this.screenStream.audio?.close();
|
|
879
1721
|
this.screenStream.video?.close();
|