@100mslive/react-native-room-kit 1.1.7 → 1.1.9-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/HMSInstanceSetup.js +11 -5
- package/lib/commonjs/HMSInstanceSetup.js.map +1 -1
- package/lib/commonjs/HMSRoomSetup.js +8 -0
- package/lib/commonjs/HMSRoomSetup.js.map +1 -1
- package/lib/commonjs/Icons/AddImage/assets/add-image.png +0 -0
- package/lib/commonjs/Icons/AddImage/assets/add-image@2x.png +0 -0
- package/lib/commonjs/Icons/AddImage/assets/add-image@3x.png +0 -0
- package/lib/commonjs/Icons/AddImage/index.js +33 -0
- package/lib/commonjs/Icons/AddImage/index.js.map +1 -0
- package/lib/commonjs/Icons/BlurPeople/assets/blur-people.png +0 -0
- package/lib/commonjs/Icons/BlurPeople/assets/blur-people@2x.png +0 -0
- package/lib/commonjs/Icons/BlurPeople/assets/blur-people@3x.png +0 -0
- package/lib/commonjs/Icons/BlurPeople/index.js +33 -0
- package/lib/commonjs/Icons/BlurPeople/index.js.map +1 -0
- package/lib/commonjs/Icons/CrossCircle/assets/cross-circle-large.png +0 -0
- package/lib/commonjs/Icons/CrossCircle/assets/cross-circle-large@2x.png +0 -0
- package/lib/commonjs/Icons/CrossCircle/assets/cross-circle-large@3x.png +0 -0
- package/lib/commonjs/Icons/CrossCircle/index.js +7 -2
- package/lib/commonjs/Icons/CrossCircle/index.js.map +1 -1
- package/lib/commonjs/Icons/Pencil/assets/pencil-board.png +0 -0
- package/lib/commonjs/Icons/Pencil/assets/pencil-board@2x.png +0 -0
- package/lib/commonjs/Icons/Pencil/assets/pencil-board@3x.png +0 -0
- package/lib/commonjs/Icons/Pencil/index.js +2 -1
- package/lib/commonjs/Icons/Pencil/index.js.map +1 -1
- package/lib/commonjs/Icons/VirtualBackground/assets/virtual-background.png +0 -0
- package/lib/commonjs/Icons/VirtualBackground/assets/virtual-background@2x.png +0 -0
- package/lib/commonjs/Icons/VirtualBackground/assets/virtual-background@3x.png +0 -0
- package/lib/commonjs/Icons/VirtualBackground/index.js +33 -0
- package/lib/commonjs/Icons/VirtualBackground/index.js.map +1 -0
- package/lib/commonjs/Icons/index.js +33 -0
- package/lib/commonjs/Icons/index.js.map +1 -1
- package/lib/commonjs/components/Chat/ChatMessage.js +13 -1
- package/lib/commonjs/components/Chat/ChatMessage.js.map +1 -1
- package/lib/commonjs/components/DisplayView.js +2 -1
- package/lib/commonjs/components/DisplayView.js.map +1 -1
- package/lib/commonjs/components/Footer.js +1 -1
- package/lib/commonjs/components/Footer.js.map +1 -1
- package/lib/commonjs/components/FullScreenWhiteboard.js +58 -0
- package/lib/commonjs/components/FullScreenWhiteboard.js.map +1 -0
- package/lib/commonjs/components/GridView.js +6 -4
- package/lib/commonjs/components/GridView.js.map +1 -1
- package/lib/commonjs/components/HLSChatView.js +7 -2
- package/lib/commonjs/components/HLSChatView.js.map +1 -1
- package/lib/commonjs/components/HLSDescriptionPane.js +3 -29
- package/lib/commonjs/components/HLSDescriptionPane.js.map +1 -1
- package/lib/commonjs/components/HLSPlayerContainer.js +4 -1
- package/lib/commonjs/components/HLSPlayerContainer.js.map +1 -1
- package/lib/commonjs/components/HMSHLSMessage.js +14 -1
- package/lib/commonjs/components/HMSHLSMessage.js.map +1 -1
- package/lib/commonjs/components/HMSManageCameraRotation.js +11 -4
- package/lib/commonjs/components/HMSManageCameraRotation.js.map +1 -1
- package/lib/commonjs/components/HMSManageLocalVideo.js +11 -4
- package/lib/commonjs/components/HMSManageLocalVideo.js.map +1 -1
- package/lib/commonjs/components/HMSManageVirtualBackground.js +55 -0
- package/lib/commonjs/components/HMSManageVirtualBackground.js.map +1 -0
- package/lib/commonjs/components/HMSOverlayMessageView.js +14 -1
- package/lib/commonjs/components/HMSOverlayMessageView.js.map +1 -1
- package/lib/commonjs/components/HMSRoomOptions.js +2 -1
- package/lib/commonjs/components/HMSRoomOptions.js.map +1 -1
- package/lib/commonjs/components/MeetingScreenContent.js +22 -2
- package/lib/commonjs/components/MeetingScreenContent.js.map +1 -1
- package/lib/commonjs/components/Preview.js +8 -3
- package/lib/commonjs/components/Preview.js.map +1 -1
- package/lib/commonjs/components/RoomSettingsModalContent.js +91 -6
- package/lib/commonjs/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/commonjs/components/TilesContainer.js +4 -4
- package/lib/commonjs/components/TilesContainer.js.map +1 -1
- package/lib/commonjs/components/VirtualBackgroundBottomSheet.js +52 -0
- package/lib/commonjs/components/VirtualBackgroundBottomSheet.js.map +1 -0
- package/lib/commonjs/components/VirtualBackgroundModalContent.js +364 -0
- package/lib/commonjs/components/VirtualBackgroundModalContent.js.map +1 -0
- package/lib/commonjs/components/WebrtcView.js +2 -2
- package/lib/commonjs/components/WebrtcView.js.map +1 -1
- package/lib/commonjs/components/Whiteboard.js +72 -0
- package/lib/commonjs/components/Whiteboard.js.map +1 -0
- package/lib/commonjs/components/WhiteboardContainer.js +35 -0
- package/lib/commonjs/components/WhiteboardContainer.js.map +1 -0
- package/lib/commonjs/components/WhiteboardFullScreenButton.js +42 -0
- package/lib/commonjs/components/WhiteboardFullScreenButton.js.map +1 -0
- package/lib/commonjs/hooks-util.js +36 -6
- package/lib/commonjs/hooks-util.js.map +1 -1
- package/lib/commonjs/modules/imagePickerWrapper.js +19 -0
- package/lib/commonjs/modules/imagePickerWrapper.js.map +1 -0
- package/lib/commonjs/modules/videoPluginWrapper.js +13 -0
- package/lib/commonjs/modules/videoPluginWrapper.js.map +1 -0
- package/lib/commonjs/redux/actionTypes.js +6 -0
- package/lib/commonjs/redux/actionTypes.js.map +1 -1
- package/lib/commonjs/redux/actions/index.js +27 -3
- package/lib/commonjs/redux/actions/index.js.map +1 -1
- package/lib/commonjs/redux/reducers/appState.js +17 -1
- package/lib/commonjs/redux/reducers/appState.js.map +1 -1
- package/lib/commonjs/redux/reducers/hmsStates.js +13 -1
- package/lib/commonjs/redux/reducers/hmsStates.js.map +1 -1
- package/lib/commonjs/utils/functions.js +33 -1
- package/lib/commonjs/utils/functions.js.map +1 -1
- package/lib/commonjs/utils/types.js +1 -0
- package/lib/commonjs/utils/types.js.map +1 -1
- package/lib/module/HMSInstanceSetup.js +12 -6
- package/lib/module/HMSInstanceSetup.js.map +1 -1
- package/lib/module/HMSRoomSetup.js +10 -2
- package/lib/module/HMSRoomSetup.js.map +1 -1
- package/lib/module/Icons/AddImage/assets/add-image.png +0 -0
- package/lib/module/Icons/AddImage/assets/add-image@2x.png +0 -0
- package/lib/module/Icons/AddImage/assets/add-image@3x.png +0 -0
- package/lib/module/Icons/AddImage/index.js +25 -0
- package/lib/module/Icons/AddImage/index.js.map +1 -0
- package/lib/module/Icons/BlurPeople/assets/blur-people.png +0 -0
- package/lib/module/Icons/BlurPeople/assets/blur-people@2x.png +0 -0
- package/lib/module/Icons/BlurPeople/assets/blur-people@3x.png +0 -0
- package/lib/module/Icons/BlurPeople/index.js +25 -0
- package/lib/module/Icons/BlurPeople/index.js.map +1 -0
- package/lib/module/Icons/CrossCircle/assets/cross-circle-large.png +0 -0
- package/lib/module/Icons/CrossCircle/assets/cross-circle-large@2x.png +0 -0
- package/lib/module/Icons/CrossCircle/assets/cross-circle-large@3x.png +0 -0
- package/lib/module/Icons/CrossCircle/index.js +7 -2
- package/lib/module/Icons/CrossCircle/index.js.map +1 -1
- package/lib/module/Icons/Pencil/assets/pencil-board.png +0 -0
- package/lib/module/Icons/Pencil/assets/pencil-board@2x.png +0 -0
- package/lib/module/Icons/Pencil/assets/pencil-board@3x.png +0 -0
- package/lib/module/Icons/Pencil/index.js +2 -1
- package/lib/module/Icons/Pencil/index.js.map +1 -1
- package/lib/module/Icons/VirtualBackground/assets/virtual-background.png +0 -0
- package/lib/module/Icons/VirtualBackground/assets/virtual-background@2x.png +0 -0
- package/lib/module/Icons/VirtualBackground/assets/virtual-background@3x.png +0 -0
- package/lib/module/Icons/VirtualBackground/index.js +25 -0
- package/lib/module/Icons/VirtualBackground/index.js.map +1 -0
- package/lib/module/Icons/index.js +3 -0
- package/lib/module/Icons/index.js.map +1 -1
- package/lib/module/components/Chat/ChatMessage.js +15 -3
- package/lib/module/components/Chat/ChatMessage.js.map +1 -1
- package/lib/module/components/DisplayView.js +2 -1
- package/lib/module/components/DisplayView.js.map +1 -1
- package/lib/module/components/Footer.js +1 -1
- package/lib/module/components/Footer.js.map +1 -1
- package/lib/module/components/FullScreenWhiteboard.js +48 -0
- package/lib/module/components/FullScreenWhiteboard.js.map +1 -0
- package/lib/module/components/GridView.js +6 -4
- package/lib/module/components/GridView.js.map +1 -1
- package/lib/module/components/HLSChatView.js +7 -2
- package/lib/module/components/HLSChatView.js.map +1 -1
- package/lib/module/components/HLSDescriptionPane.js +2 -28
- package/lib/module/components/HLSDescriptionPane.js.map +1 -1
- package/lib/module/components/HLSPlayerContainer.js +4 -1
- package/lib/module/components/HLSPlayerContainer.js.map +1 -1
- package/lib/module/components/HMSHLSMessage.js +15 -2
- package/lib/module/components/HMSHLSMessage.js.map +1 -1
- package/lib/module/components/HMSManageCameraRotation.js +11 -4
- package/lib/module/components/HMSManageCameraRotation.js.map +1 -1
- package/lib/module/components/HMSManageLocalVideo.js +11 -4
- package/lib/module/components/HMSManageLocalVideo.js.map +1 -1
- package/lib/module/components/HMSManageVirtualBackground.js +46 -0
- package/lib/module/components/HMSManageVirtualBackground.js.map +1 -0
- package/lib/module/components/HMSOverlayMessageView.js +15 -2
- package/lib/module/components/HMSOverlayMessageView.js.map +1 -1
- package/lib/module/components/HMSRoomOptions.js +2 -1
- package/lib/module/components/HMSRoomOptions.js.map +1 -1
- package/lib/module/components/MeetingScreenContent.js +23 -3
- package/lib/module/components/MeetingScreenContent.js.map +1 -1
- package/lib/module/components/Preview.js +8 -3
- package/lib/module/components/Preview.js.map +1 -1
- package/lib/module/components/RoomSettingsModalContent.js +94 -9
- package/lib/module/components/RoomSettingsModalContent.js.map +1 -1
- package/lib/module/components/TilesContainer.js +4 -4
- package/lib/module/components/TilesContainer.js.map +1 -1
- package/lib/module/components/VirtualBackgroundBottomSheet.js +43 -0
- package/lib/module/components/VirtualBackgroundBottomSheet.js.map +1 -0
- package/lib/module/components/VirtualBackgroundModalContent.js +355 -0
- package/lib/module/components/VirtualBackgroundModalContent.js.map +1 -0
- package/lib/module/components/WebrtcView.js +2 -2
- package/lib/module/components/WebrtcView.js.map +1 -1
- package/lib/module/components/Whiteboard.js +64 -0
- package/lib/module/components/Whiteboard.js.map +1 -0
- package/lib/module/components/WhiteboardContainer.js +27 -0
- package/lib/module/components/WhiteboardContainer.js.map +1 -0
- package/lib/module/components/WhiteboardFullScreenButton.js +33 -0
- package/lib/module/components/WhiteboardFullScreenButton.js.map +1 -0
- package/lib/module/hooks-util.js +36 -6
- package/lib/module/hooks-util.js.map +1 -1
- package/lib/module/modules/imagePickerWrapper.js +14 -0
- package/lib/module/modules/imagePickerWrapper.js.map +1 -0
- package/lib/module/modules/videoPluginWrapper.js +8 -0
- package/lib/module/modules/videoPluginWrapper.js.map +1 -0
- package/lib/module/redux/actionTypes.js +6 -0
- package/lib/module/redux/actionTypes.js.map +1 -1
- package/lib/module/redux/actions/index.js +20 -0
- package/lib/module/redux/actions/index.js.map +1 -1
- package/lib/module/redux/reducers/appState.js +17 -1
- package/lib/module/redux/reducers/appState.js.map +1 -1
- package/lib/module/redux/reducers/hmsStates.js +13 -1
- package/lib/module/redux/reducers/hmsStates.js.map +1 -1
- package/lib/module/utils/functions.js +29 -1
- package/lib/module/utils/functions.js.map +1 -1
- package/lib/module/utils/types.js +1 -0
- package/lib/module/utils/types.js.map +1 -1
- package/lib/typescript/HMSInstanceSetup.d.ts.map +1 -1
- package/lib/typescript/HMSRoomSetup.d.ts.map +1 -1
- package/lib/typescript/Icons/AddImage/index.d.ts +7 -0
- package/lib/typescript/Icons/AddImage/index.d.ts.map +1 -0
- package/lib/typescript/Icons/BlurPeople/index.d.ts +7 -0
- package/lib/typescript/Icons/BlurPeople/index.d.ts.map +1 -0
- package/lib/typescript/Icons/CrossCircle/index.d.ts +1 -0
- package/lib/typescript/Icons/CrossCircle/index.d.ts.map +1 -1
- package/lib/typescript/Icons/Pencil/index.d.ts +1 -0
- package/lib/typescript/Icons/Pencil/index.d.ts.map +1 -1
- package/lib/typescript/Icons/VirtualBackground/index.d.ts +7 -0
- package/lib/typescript/Icons/VirtualBackground/index.d.ts.map +1 -0
- package/lib/typescript/Icons/index.d.ts +3 -0
- package/lib/typescript/Icons/index.d.ts.map +1 -1
- package/lib/typescript/components/Chat/ChatMessage.d.ts.map +1 -1
- package/lib/typescript/components/DisplayView.d.ts.map +1 -1
- package/lib/typescript/components/Footer.d.ts.map +1 -1
- package/lib/typescript/components/FullScreenWhiteboard.d.ts +3 -0
- package/lib/typescript/components/FullScreenWhiteboard.d.ts.map +1 -0
- package/lib/typescript/components/GridView.d.ts.map +1 -1
- package/lib/typescript/components/HLSChatView.d.ts.map +1 -1
- package/lib/typescript/components/HLSDescriptionPane.d.ts.map +1 -1
- package/lib/typescript/components/HLSPlayerContainer.d.ts.map +1 -1
- package/lib/typescript/components/HMSHLSMessage.d.ts.map +1 -1
- package/lib/typescript/components/HMSManageCameraRotation.d.ts +8 -1
- package/lib/typescript/components/HMSManageCameraRotation.d.ts.map +1 -1
- package/lib/typescript/components/HMSManageLocalVideo.d.ts +8 -1
- package/lib/typescript/components/HMSManageLocalVideo.d.ts.map +1 -1
- package/lib/typescript/components/HMSManageVirtualBackground.d.ts +8 -0
- package/lib/typescript/components/HMSManageVirtualBackground.d.ts.map +1 -0
- package/lib/typescript/components/HMSOverlayMessageView.d.ts.map +1 -1
- package/lib/typescript/components/HMSRoomOptions.d.ts.map +1 -1
- package/lib/typescript/components/MeetingScreenContent.d.ts.map +1 -1
- package/lib/typescript/components/Preview.d.ts.map +1 -1
- package/lib/typescript/components/RoomSettingsModalContent.d.ts.map +1 -1
- package/lib/typescript/components/TilesContainer.d.ts.map +1 -1
- package/lib/typescript/components/VirtualBackgroundBottomSheet.d.ts +3 -0
- package/lib/typescript/components/VirtualBackgroundBottomSheet.d.ts.map +1 -0
- package/lib/typescript/components/VirtualBackgroundModalContent.d.ts +6 -0
- package/lib/typescript/components/VirtualBackgroundModalContent.d.ts.map +1 -0
- package/lib/typescript/components/WebrtcView.d.ts.map +1 -1
- package/lib/typescript/components/Whiteboard.d.ts +6 -0
- package/lib/typescript/components/Whiteboard.d.ts.map +1 -0
- package/lib/typescript/components/WhiteboardContainer.d.ts +6 -0
- package/lib/typescript/components/WhiteboardContainer.d.ts.map +1 -0
- package/lib/typescript/components/WhiteboardFullScreenButton.d.ts +5 -0
- package/lib/typescript/components/WhiteboardFullScreenButton.d.ts.map +1 -0
- package/lib/typescript/hooks-util.d.ts.map +1 -1
- package/lib/typescript/modules/imagePickerWrapper.d.ts +6 -0
- package/lib/typescript/modules/imagePickerWrapper.d.ts.map +1 -0
- package/lib/typescript/modules/videoPluginWrapper.d.ts +19 -0
- package/lib/typescript/modules/videoPluginWrapper.d.ts.map +1 -0
- package/lib/typescript/redux/actionTypes.d.ts +4 -0
- package/lib/typescript/redux/actionTypes.d.ts.map +1 -1
- package/lib/typescript/redux/actions/index.d.ts +22 -1
- package/lib/typescript/redux/actions/index.d.ts.map +1 -1
- package/lib/typescript/redux/index.d.ts +4 -0
- package/lib/typescript/redux/index.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/appState.d.ts +2 -0
- package/lib/typescript/redux/reducers/appState.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/hmsStates.d.ts +13 -2
- package/lib/typescript/redux/reducers/hmsStates.d.ts.map +1 -1
- package/lib/typescript/redux/reducers/index.d.ts +4 -0
- package/lib/typescript/redux/reducers/index.d.ts.map +1 -1
- package/lib/typescript/utils/functions.d.ts +2 -0
- package/lib/typescript/utils/functions.d.ts.map +1 -1
- package/lib/typescript/utils/types.d.ts +1 -0
- package/lib/typescript/utils/types.d.ts.map +1 -1
- package/package.json +10 -3
- package/src/HMSInstanceSetup.tsx +17 -4
- package/src/HMSRoomSetup.tsx +21 -0
- package/src/Icons/AddImage/assets/add-image.png +0 -0
- package/src/Icons/AddImage/assets/add-image@2x.png +0 -0
- package/src/Icons/AddImage/assets/add-image@3x.png +0 -0
- package/src/Icons/AddImage/index.tsx +33 -0
- package/src/Icons/BlurPeople/assets/blur-people.png +0 -0
- package/src/Icons/BlurPeople/assets/blur-people@2x.png +0 -0
- package/src/Icons/BlurPeople/assets/blur-people@3x.png +0 -0
- package/src/Icons/BlurPeople/index.tsx +33 -0
- package/src/Icons/CrossCircle/assets/cross-circle-large.png +0 -0
- package/src/Icons/CrossCircle/assets/cross-circle-large@2x.png +0 -0
- package/src/Icons/CrossCircle/assets/cross-circle-large@3x.png +0 -0
- package/src/Icons/CrossCircle/index.tsx +19 -3
- package/src/Icons/Pencil/assets/pencil-board.png +0 -0
- package/src/Icons/Pencil/assets/pencil-board@2x.png +0 -0
- package/src/Icons/Pencil/assets/pencil-board@3x.png +0 -0
- package/src/Icons/Pencil/index.tsx +9 -2
- package/src/Icons/VirtualBackground/assets/virtual-background.png +0 -0
- package/src/Icons/VirtualBackground/assets/virtual-background@2x.png +0 -0
- package/src/Icons/VirtualBackground/assets/virtual-background@3x.png +0 -0
- package/src/Icons/VirtualBackground/index.tsx +33 -0
- package/src/Icons/index.ts +3 -0
- package/src/components/Chat/ChatMessage.tsx +19 -2
- package/src/components/DisplayView.tsx +3 -0
- package/src/components/Footer.tsx +5 -2
- package/src/components/FullScreenWhiteboard.tsx +59 -0
- package/src/components/GridView.tsx +14 -5
- package/src/components/HLSChatView.tsx +7 -4
- package/src/components/HLSDescriptionPane.tsx +2 -33
- package/src/components/HLSPlayerContainer.tsx +15 -7
- package/src/components/HMSHLSMessage.tsx +16 -1
- package/src/components/HMSManageCameraRotation.tsx +18 -4
- package/src/components/HMSManageLocalVideo.tsx +20 -4
- package/src/components/HMSManageVirtualBackground.tsx +76 -0
- package/src/components/HMSOverlayMessageView.tsx +16 -1
- package/src/components/HMSRoomOptions.tsx +3 -0
- package/src/components/MeetingScreenContent.tsx +28 -2
- package/src/components/Preview.tsx +12 -5
- package/src/components/RoomSettingsModalContent.tsx +108 -2
- package/src/components/TilesContainer.tsx +7 -5
- package/src/components/VirtualBackgroundBottomSheet.tsx +62 -0
- package/src/components/VirtualBackgroundModalContent.tsx +500 -0
- package/src/components/WebrtcView.tsx +11 -4
- package/src/components/Whiteboard.tsx +101 -0
- package/src/components/WhiteboardContainer.tsx +35 -0
- package/src/components/WhiteboardFullScreenButton.tsx +52 -0
- package/src/hooks-util.ts +41 -9
- package/src/modules/imagePickerWrapper.ts +20 -0
- package/src/modules/videoPluginWrapper.ts +32 -0
- package/src/redux/actionTypes.ts +8 -0
- package/src/redux/actions/index.ts +22 -0
- package/src/redux/reducers/appState.ts +16 -0
- package/src/redux/reducers/hmsStates.ts +29 -1
- package/src/utils/{functions.ts → functions.tsx} +34 -0
- package/src/utils/types.ts +1 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
3
|
+
import { useSelector } from 'react-redux';
|
|
4
|
+
|
|
5
|
+
import { BottomSheet } from './BottomSheet';
|
|
6
|
+
import { useHMSRoomStyleSheet, useModalType } from '../hooks-util';
|
|
7
|
+
import { useHeaderHeight } from './Header';
|
|
8
|
+
import { useIsLandscapeOrientation } from '../utils/dimension';
|
|
9
|
+
import { ModalTypes } from '../utils/types';
|
|
10
|
+
import type { RootState } from '../redux';
|
|
11
|
+
import { VirtualBackgroundModalContent } from './VirtualBackgroundModalContent';
|
|
12
|
+
|
|
13
|
+
export const VirtualBackgroundBottomSheet = () => {
|
|
14
|
+
const headerHeight = useHeaderHeight();
|
|
15
|
+
const isLandscapeOrientation = useIsLandscapeOrientation();
|
|
16
|
+
const isLocalVideoMuted = useSelector(
|
|
17
|
+
(state: RootState) => state.hmsStates.isLocalVideoMuted
|
|
18
|
+
);
|
|
19
|
+
const {
|
|
20
|
+
modalVisibleType: modalVisible,
|
|
21
|
+
handleModalVisibleType: setModalVisible,
|
|
22
|
+
} = useModalType();
|
|
23
|
+
|
|
24
|
+
const hmsRoomStyles = useHMSRoomStyleSheet((theme) => ({
|
|
25
|
+
contentContainer: {
|
|
26
|
+
backgroundColor: theme.palette.surface_dim,
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
const dismissModal = () => {
|
|
31
|
+
setModalVisible(ModalTypes.DEFAULT);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const containerStyles = [
|
|
35
|
+
styles.bottomSheet,
|
|
36
|
+
{
|
|
37
|
+
marginTop: isLandscapeOrientation
|
|
38
|
+
? 0
|
|
39
|
+
: headerHeight + (Platform.OS === 'android' ? 24 : 0),
|
|
40
|
+
},
|
|
41
|
+
hmsRoomStyles.contentContainer,
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<BottomSheet
|
|
46
|
+
dismissModal={dismissModal}
|
|
47
|
+
isVisible={
|
|
48
|
+
!isLocalVideoMuted && modalVisible === ModalTypes.VIRTUAL_BACKGROUND
|
|
49
|
+
}
|
|
50
|
+
containerStyle={containerStyles}
|
|
51
|
+
bottomOffsetSpace={0}
|
|
52
|
+
>
|
|
53
|
+
<VirtualBackgroundModalContent dismissModal={dismissModal} />
|
|
54
|
+
</BottomSheet>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const styles = StyleSheet.create({
|
|
59
|
+
bottomSheet: {
|
|
60
|
+
flex: 1,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Image,
|
|
4
|
+
Text,
|
|
5
|
+
View,
|
|
6
|
+
ScrollView,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
ActivityIndicator,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import type { ImageRequireSource } from 'react-native';
|
|
12
|
+
import { useDispatch, useSelector } from 'react-redux';
|
|
13
|
+
import { HMSTrackType, HMSVideoViewMode } from '@100mslive/react-native-hms';
|
|
14
|
+
import type { HMSVirtualBackgroundPlugin } from '../modules/videoPluginWrapper';
|
|
15
|
+
import { ImagePicker } from '../modules/imagePickerWrapper';
|
|
16
|
+
|
|
17
|
+
import { BottomSheet } from './BottomSheet';
|
|
18
|
+
import {
|
|
19
|
+
AddImageIcon,
|
|
20
|
+
BlurPeopleIcon,
|
|
21
|
+
CloseIcon,
|
|
22
|
+
CrossCircleIcon,
|
|
23
|
+
} from '../Icons';
|
|
24
|
+
import {
|
|
25
|
+
useDisableAutoPip,
|
|
26
|
+
useHMSRoomColorPalette,
|
|
27
|
+
useHMSRoomStyleSheet,
|
|
28
|
+
} from '../hooks-util';
|
|
29
|
+
import { VideoView } from './PeerVideoTile/VideoView';
|
|
30
|
+
import type { RootState } from '../redux';
|
|
31
|
+
import {
|
|
32
|
+
setAutoEnterPipMode,
|
|
33
|
+
setSelectedVirtualBackground,
|
|
34
|
+
} from '../redux/actions';
|
|
35
|
+
import { useState } from 'react';
|
|
36
|
+
import { hexToRgbA } from '../utils/theme';
|
|
37
|
+
|
|
38
|
+
export interface VirtualBackgroundModalContentProps {
|
|
39
|
+
dismissModal(): void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const VirtualBackgroundModalContent: React.FC<
|
|
43
|
+
VirtualBackgroundModalContentProps
|
|
44
|
+
> = ({ dismissModal }) => {
|
|
45
|
+
const dispatch = useDispatch();
|
|
46
|
+
const localPeer = useSelector(
|
|
47
|
+
(state: RootState) => state.hmsStates.localPeer
|
|
48
|
+
);
|
|
49
|
+
const isLocalVideoMuted = useSelector(
|
|
50
|
+
(state: RootState) => state.hmsStates.isLocalVideoMuted
|
|
51
|
+
);
|
|
52
|
+
const autoEnterPipMode = useSelector(
|
|
53
|
+
(state: RootState) => state.app.autoEnterPipMode
|
|
54
|
+
);
|
|
55
|
+
const disableAutoPip = useDisableAutoPip();
|
|
56
|
+
|
|
57
|
+
const hmsRoomStyles = useHMSRoomStyleSheet((theme, typography) => ({
|
|
58
|
+
semiBoldSurfaceHigh: {
|
|
59
|
+
color: theme.palette.on_surface_high,
|
|
60
|
+
fontFamily: `${typography.font_family}-SemiBold`,
|
|
61
|
+
},
|
|
62
|
+
regularSurfaceMedium: {
|
|
63
|
+
color: theme.palette.on_surface_medium,
|
|
64
|
+
fontFamily: `${typography.font_family}-Regular`,
|
|
65
|
+
},
|
|
66
|
+
effectButton: {
|
|
67
|
+
backgroundColor: theme.palette.surface_bright,
|
|
68
|
+
},
|
|
69
|
+
active: {
|
|
70
|
+
borderColor: theme.palette.primary_default,
|
|
71
|
+
},
|
|
72
|
+
inactive: {
|
|
73
|
+
borderColor: theme.palette.surface_bright,
|
|
74
|
+
},
|
|
75
|
+
loadingContainer: {
|
|
76
|
+
backgroundColor:
|
|
77
|
+
theme.palette.background_default &&
|
|
78
|
+
hexToRgbA(theme.palette.background_default, 0.5),
|
|
79
|
+
},
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
const { primary_bright: primaryBrightColor } = useHMSRoomColorPalette();
|
|
83
|
+
|
|
84
|
+
const videoPlugin = useSelector(
|
|
85
|
+
(state: RootState) => state.hmsStates.videoPlugin
|
|
86
|
+
);
|
|
87
|
+
const selectedVirtualBG = useSelector(
|
|
88
|
+
(state: RootState) => state.app.selectedVirtualBackground
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const handleClosePress = () => dismissModal();
|
|
92
|
+
|
|
93
|
+
const handleNoEffectPress = async () => {
|
|
94
|
+
if (videoPlugin) {
|
|
95
|
+
await videoPlugin.disable();
|
|
96
|
+
dispatch(setSelectedVirtualBackground(null));
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const [showLoading, setShowLoading] = useState(false);
|
|
101
|
+
|
|
102
|
+
const handlePhotoLibraryPress = async () => {
|
|
103
|
+
if (!ImagePicker) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
// Current value of `autoEnterPipMode` state
|
|
107
|
+
let pipModeEnabled = autoEnterPipMode;
|
|
108
|
+
try {
|
|
109
|
+
// If PIP is enabled, disable it
|
|
110
|
+
if (pipModeEnabled) {
|
|
111
|
+
dispatch(setAutoEnterPipMode(false));
|
|
112
|
+
disableAutoPip();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const imageLibraryResponse = await ImagePicker.launchImageLibrary({
|
|
116
|
+
mediaType: 'photo',
|
|
117
|
+
selectionLimit: 1,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// If PIP was enabled earlier, enable it again
|
|
121
|
+
if (pipModeEnabled) {
|
|
122
|
+
dispatch(setAutoEnterPipMode(true));
|
|
123
|
+
}
|
|
124
|
+
handleImagePickerResponse(imageLibraryResponse);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.warn(error);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// const handleCameraPress = async () => {
|
|
131
|
+
// if (!ImagePicker) {
|
|
132
|
+
// return;
|
|
133
|
+
// }
|
|
134
|
+
// try {
|
|
135
|
+
// const cameraResponse = await ImagePicker.launchCamera({
|
|
136
|
+
// mediaType: 'photo',
|
|
137
|
+
// cameraType: 'back',
|
|
138
|
+
// });
|
|
139
|
+
// handleImagePickerResponse(cameraResponse);
|
|
140
|
+
// } catch (error) {
|
|
141
|
+
// console.warn(error);
|
|
142
|
+
// }
|
|
143
|
+
// };
|
|
144
|
+
|
|
145
|
+
const handleImagePickerResponse = (response: any) => {
|
|
146
|
+
if (response.didCancel) {
|
|
147
|
+
throw new Error('User cancelled');
|
|
148
|
+
}
|
|
149
|
+
if (response.errorCode !== undefined) {
|
|
150
|
+
throw new Error(response.errorCode, {
|
|
151
|
+
cause: response.errorMessage,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
const firstAsset = response.assets?.[0];
|
|
155
|
+
if (firstAsset && firstAsset.uri && firstAsset.fileName) {
|
|
156
|
+
handleImagePress({ label: firstAsset.fileName, src: firstAsset });
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const handleBlurEffectPress = async () => {
|
|
161
|
+
try {
|
|
162
|
+
if (videoPlugin) {
|
|
163
|
+
setShowLoading(true);
|
|
164
|
+
if (selectedVirtualBG === null) {
|
|
165
|
+
await videoPlugin.enable();
|
|
166
|
+
}
|
|
167
|
+
await videoPlugin.setBlur(100);
|
|
168
|
+
setShowLoading(false);
|
|
169
|
+
dispatch(setSelectedVirtualBackground('blur'));
|
|
170
|
+
}
|
|
171
|
+
} catch (error) {
|
|
172
|
+
setShowLoading(false);
|
|
173
|
+
console.error('Error setting blur effect', error);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const handleImagePress = async (asset: {
|
|
178
|
+
label: string;
|
|
179
|
+
src: Parameters<HMSVirtualBackgroundPlugin['setBackground']>[0];
|
|
180
|
+
}) => {
|
|
181
|
+
try {
|
|
182
|
+
if (videoPlugin) {
|
|
183
|
+
setShowLoading(true);
|
|
184
|
+
if (selectedVirtualBG === null) {
|
|
185
|
+
await videoPlugin.enable();
|
|
186
|
+
}
|
|
187
|
+
await videoPlugin.setBackground(asset.src);
|
|
188
|
+
setShowLoading(false);
|
|
189
|
+
dispatch(setSelectedVirtualBackground(asset.label));
|
|
190
|
+
}
|
|
191
|
+
} catch (error) {
|
|
192
|
+
setShowLoading(false);
|
|
193
|
+
console.error('Error setting virtual background', error);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const showingVideoTrack =
|
|
198
|
+
localPeer &&
|
|
199
|
+
localPeer.videoTrack &&
|
|
200
|
+
localPeer.videoTrack.trackId &&
|
|
201
|
+
localPeer.videoTrack.type === HMSTrackType.VIDEO &&
|
|
202
|
+
!isLocalVideoMuted;
|
|
203
|
+
|
|
204
|
+
const backgrounds: Array<
|
|
205
|
+
| {
|
|
206
|
+
icon: React.JSX.Element;
|
|
207
|
+
onPress: () => Promise<void>;
|
|
208
|
+
label: string;
|
|
209
|
+
src?: undefined;
|
|
210
|
+
}
|
|
211
|
+
| {
|
|
212
|
+
icon?: undefined;
|
|
213
|
+
onPress?: undefined;
|
|
214
|
+
label: string;
|
|
215
|
+
src: ImageRequireSource;
|
|
216
|
+
}
|
|
217
|
+
> = [];
|
|
218
|
+
|
|
219
|
+
if (ImagePicker) {
|
|
220
|
+
// backgrounds.push({
|
|
221
|
+
// label: 'Camera',
|
|
222
|
+
// onPress: handleCameraPress,
|
|
223
|
+
// });
|
|
224
|
+
backgrounds.push({
|
|
225
|
+
icon: <AddImageIcon />,
|
|
226
|
+
label: 'Upload',
|
|
227
|
+
onPress: handlePhotoLibraryPress,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return (
|
|
232
|
+
<View style={styles.flexView}>
|
|
233
|
+
{/* Header */}
|
|
234
|
+
<View style={styles.header}>
|
|
235
|
+
<Text style={[styles.headerText, hmsRoomStyles.semiBoldSurfaceHigh]}>
|
|
236
|
+
Virtual Background
|
|
237
|
+
</Text>
|
|
238
|
+
|
|
239
|
+
<TouchableOpacity
|
|
240
|
+
onPress={handleClosePress}
|
|
241
|
+
hitSlop={styles.closeIconHitSlop}
|
|
242
|
+
style={styles.closeIconButton}
|
|
243
|
+
>
|
|
244
|
+
<CloseIcon />
|
|
245
|
+
</TouchableOpacity>
|
|
246
|
+
</View>
|
|
247
|
+
|
|
248
|
+
{/* Divider */}
|
|
249
|
+
<BottomSheet.Divider style={styles.divider} />
|
|
250
|
+
|
|
251
|
+
{/* Content */}
|
|
252
|
+
<View style={styles.flexView}>
|
|
253
|
+
{showingVideoTrack ? (
|
|
254
|
+
<View style={{ height: 280, alignItems: 'center', marginTop: 32 }}>
|
|
255
|
+
<View style={{ width: 166, height: 280 }}>
|
|
256
|
+
<VideoView
|
|
257
|
+
peer={localPeer}
|
|
258
|
+
trackId={localPeer.videoTrack.trackId}
|
|
259
|
+
scaleType={HMSVideoViewMode.ASPECT_FILL}
|
|
260
|
+
/>
|
|
261
|
+
</View>
|
|
262
|
+
</View>
|
|
263
|
+
) : null}
|
|
264
|
+
|
|
265
|
+
<ScrollView
|
|
266
|
+
style={styles.scrollView}
|
|
267
|
+
contentContainerStyle={styles.scrollContent}
|
|
268
|
+
>
|
|
269
|
+
<View style={{ marginHorizontal: 24 }}>
|
|
270
|
+
<Text
|
|
271
|
+
style={[hmsRoomStyles.semiBoldSurfaceHigh, styles.normalText]}
|
|
272
|
+
>
|
|
273
|
+
Effects
|
|
274
|
+
</Text>
|
|
275
|
+
|
|
276
|
+
<View style={{ flexDirection: 'row' }}>
|
|
277
|
+
<TouchableOpacity
|
|
278
|
+
activeOpacity={0.8}
|
|
279
|
+
onPress={handleNoEffectPress}
|
|
280
|
+
>
|
|
281
|
+
<View
|
|
282
|
+
style={[
|
|
283
|
+
styles.effectButton,
|
|
284
|
+
hmsRoomStyles.effectButton,
|
|
285
|
+
selectedVirtualBG === null
|
|
286
|
+
? hmsRoomStyles.active
|
|
287
|
+
: hmsRoomStyles.inactive,
|
|
288
|
+
]}
|
|
289
|
+
>
|
|
290
|
+
<CrossCircleIcon size="large" style={{ marginBottom: 8 }} />
|
|
291
|
+
<Text
|
|
292
|
+
style={[
|
|
293
|
+
styles.smallText,
|
|
294
|
+
hmsRoomStyles.regularSurfaceMedium,
|
|
295
|
+
]}
|
|
296
|
+
>
|
|
297
|
+
No Effect
|
|
298
|
+
</Text>
|
|
299
|
+
</View>
|
|
300
|
+
</TouchableOpacity>
|
|
301
|
+
|
|
302
|
+
<TouchableOpacity
|
|
303
|
+
activeOpacity={0.8}
|
|
304
|
+
style={styles.horizontalSpacing}
|
|
305
|
+
onPress={handleBlurEffectPress}
|
|
306
|
+
>
|
|
307
|
+
<View
|
|
308
|
+
style={[
|
|
309
|
+
styles.effectButton,
|
|
310
|
+
hmsRoomStyles.effectButton,
|
|
311
|
+
selectedVirtualBG === 'blur'
|
|
312
|
+
? hmsRoomStyles.active
|
|
313
|
+
: hmsRoomStyles.inactive,
|
|
314
|
+
]}
|
|
315
|
+
>
|
|
316
|
+
<BlurPeopleIcon style={{ marginBottom: 8 }} />
|
|
317
|
+
<Text
|
|
318
|
+
style={[
|
|
319
|
+
styles.smallText,
|
|
320
|
+
hmsRoomStyles.regularSurfaceMedium,
|
|
321
|
+
]}
|
|
322
|
+
>
|
|
323
|
+
Blur
|
|
324
|
+
</Text>
|
|
325
|
+
</View>
|
|
326
|
+
</TouchableOpacity>
|
|
327
|
+
</View>
|
|
328
|
+
|
|
329
|
+
{/* Blur radius slider here */}
|
|
330
|
+
</View>
|
|
331
|
+
|
|
332
|
+
{backgrounds && backgrounds.length > 0 ? (
|
|
333
|
+
<View style={styles.backgroundContainer}>
|
|
334
|
+
<Text
|
|
335
|
+
style={[
|
|
336
|
+
hmsRoomStyles.semiBoldSurfaceHigh,
|
|
337
|
+
styles.normalText,
|
|
338
|
+
{ marginHorizontal: 24 },
|
|
339
|
+
]}
|
|
340
|
+
>
|
|
341
|
+
Backgrounds
|
|
342
|
+
</Text>
|
|
343
|
+
|
|
344
|
+
<View style={[styles.backgroundImages, { marginHorizontal: 18 }]}>
|
|
345
|
+
{backgrounds.map((asset) => {
|
|
346
|
+
return (
|
|
347
|
+
<TouchableOpacity
|
|
348
|
+
key={asset.label}
|
|
349
|
+
activeOpacity={0.8}
|
|
350
|
+
onPress={() => {
|
|
351
|
+
const src = asset.src;
|
|
352
|
+
if (src) {
|
|
353
|
+
handleImagePress({ label: asset.label, src });
|
|
354
|
+
} else if (asset.onPress) {
|
|
355
|
+
asset.onPress();
|
|
356
|
+
}
|
|
357
|
+
}}
|
|
358
|
+
style={
|
|
359
|
+
asset.src
|
|
360
|
+
? styles.backgroundImageContainer
|
|
361
|
+
: [
|
|
362
|
+
styles.effectButton,
|
|
363
|
+
hmsRoomStyles.effectButton,
|
|
364
|
+
hmsRoomStyles.inactive,
|
|
365
|
+
styles.backgroundImageContainer,
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
>
|
|
369
|
+
{asset.src ? (
|
|
370
|
+
<Image
|
|
371
|
+
source={asset.src}
|
|
372
|
+
style={[
|
|
373
|
+
styles.backgroundImage,
|
|
374
|
+
selectedVirtualBG === asset.label
|
|
375
|
+
? hmsRoomStyles.active
|
|
376
|
+
: null,
|
|
377
|
+
]}
|
|
378
|
+
/>
|
|
379
|
+
) : (
|
|
380
|
+
<>
|
|
381
|
+
{asset.icon || null}
|
|
382
|
+
<Text
|
|
383
|
+
style={[
|
|
384
|
+
styles.smallText,
|
|
385
|
+
hmsRoomStyles.regularSurfaceMedium,
|
|
386
|
+
]}
|
|
387
|
+
>
|
|
388
|
+
{asset.label}
|
|
389
|
+
</Text>
|
|
390
|
+
</>
|
|
391
|
+
)}
|
|
392
|
+
</TouchableOpacity>
|
|
393
|
+
);
|
|
394
|
+
})}
|
|
395
|
+
</View>
|
|
396
|
+
</View>
|
|
397
|
+
) : null}
|
|
398
|
+
</ScrollView>
|
|
399
|
+
|
|
400
|
+
{showLoading && (
|
|
401
|
+
<View
|
|
402
|
+
style={[styles.loadingContainer, hmsRoomStyles.loadingContainer]}
|
|
403
|
+
>
|
|
404
|
+
<ActivityIndicator size="large" color={primaryBrightColor} />
|
|
405
|
+
</View>
|
|
406
|
+
)}
|
|
407
|
+
</View>
|
|
408
|
+
</View>
|
|
409
|
+
);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
const styles = StyleSheet.create({
|
|
413
|
+
// Header
|
|
414
|
+
header: {
|
|
415
|
+
flexDirection: 'row',
|
|
416
|
+
alignItems: 'center',
|
|
417
|
+
justifyContent: 'space-between',
|
|
418
|
+
marginTop: 16,
|
|
419
|
+
marginHorizontal: 24,
|
|
420
|
+
},
|
|
421
|
+
headerText: {
|
|
422
|
+
fontSize: 16,
|
|
423
|
+
lineHeight: 24,
|
|
424
|
+
letterSpacing: 0.15,
|
|
425
|
+
},
|
|
426
|
+
closeIconButton: {
|
|
427
|
+
marginLeft: 16,
|
|
428
|
+
},
|
|
429
|
+
closeIconHitSlop: {
|
|
430
|
+
bottom: 16,
|
|
431
|
+
left: 16,
|
|
432
|
+
right: 16,
|
|
433
|
+
top: 16,
|
|
434
|
+
},
|
|
435
|
+
// Divider
|
|
436
|
+
divider: {
|
|
437
|
+
marginVertical: 0,
|
|
438
|
+
marginTop: 16,
|
|
439
|
+
},
|
|
440
|
+
// Content
|
|
441
|
+
flexView: {
|
|
442
|
+
flex: 1,
|
|
443
|
+
position: 'relative',
|
|
444
|
+
},
|
|
445
|
+
scrollView: {
|
|
446
|
+
marginTop: 16,
|
|
447
|
+
},
|
|
448
|
+
scrollContent: {
|
|
449
|
+
paddingTop: 8,
|
|
450
|
+
paddingBottom: 24,
|
|
451
|
+
},
|
|
452
|
+
normalText: {
|
|
453
|
+
fontSize: 14,
|
|
454
|
+
lineHeight: 20,
|
|
455
|
+
marginBottom: 8,
|
|
456
|
+
},
|
|
457
|
+
smallText: {
|
|
458
|
+
fontSize: 12,
|
|
459
|
+
lineHeight: 16,
|
|
460
|
+
letterSpacing: 0.4,
|
|
461
|
+
},
|
|
462
|
+
effectButton: {
|
|
463
|
+
width: 104,
|
|
464
|
+
height: 88,
|
|
465
|
+
borderRadius: 8,
|
|
466
|
+
alignItems: 'center',
|
|
467
|
+
justifyContent: 'center',
|
|
468
|
+
borderWidth: 2,
|
|
469
|
+
},
|
|
470
|
+
horizontalSpacing: {
|
|
471
|
+
marginHorizontal: 12,
|
|
472
|
+
},
|
|
473
|
+
backgroundContainer: {
|
|
474
|
+
marginTop: 24,
|
|
475
|
+
},
|
|
476
|
+
backgroundImages: {
|
|
477
|
+
flex: 1,
|
|
478
|
+
flexDirection: 'row',
|
|
479
|
+
flexWrap: 'wrap',
|
|
480
|
+
},
|
|
481
|
+
backgroundImage: {
|
|
482
|
+
width: 104,
|
|
483
|
+
height: 88,
|
|
484
|
+
borderRadius: 8,
|
|
485
|
+
resizeMode: 'cover',
|
|
486
|
+
borderWidth: 2,
|
|
487
|
+
borderColor: 'transparent',
|
|
488
|
+
},
|
|
489
|
+
backgroundImageContainer: {
|
|
490
|
+
marginHorizontal: 6,
|
|
491
|
+
marginVertical: 8,
|
|
492
|
+
},
|
|
493
|
+
loadingContainer: {
|
|
494
|
+
width: '100%',
|
|
495
|
+
height: '100%',
|
|
496
|
+
position: 'absolute',
|
|
497
|
+
alignItems: 'center',
|
|
498
|
+
justifyContent: 'center',
|
|
499
|
+
},
|
|
500
|
+
});
|
|
@@ -49,8 +49,10 @@ export const WebrtcView = React.forwardRef<GridViewRefAttrs, WebrtcViewProps>(
|
|
|
49
49
|
(state: RootState) => state.user.spotlightTrackId
|
|
50
50
|
);
|
|
51
51
|
|
|
52
|
-
const
|
|
53
|
-
(state: RootState) =>
|
|
52
|
+
const screenshareTilesOrWhiteboardAcive = useSelector(
|
|
53
|
+
(state: RootState) =>
|
|
54
|
+
state.app.screensharePeerTrackNodes.length > 0 ||
|
|
55
|
+
!!state.hmsStates.whiteboard
|
|
54
56
|
);
|
|
55
57
|
|
|
56
58
|
const pairedPeers = useMemo(
|
|
@@ -58,13 +60,18 @@ export const WebrtcView = React.forwardRef<GridViewRefAttrs, WebrtcViewProps>(
|
|
|
58
60
|
pairData(
|
|
59
61
|
peerTrackNodes,
|
|
60
62
|
isPortrait
|
|
61
|
-
?
|
|
63
|
+
? screenshareTilesOrWhiteboardAcive
|
|
62
64
|
? MaxTilesInOnePage.IN_PORTRAIT_WITH_SCREENSHARES
|
|
63
65
|
: MaxTilesInOnePage.IN_PORTRAIT
|
|
64
66
|
: MaxTilesInOnePage.IN_LANDSCAPE,
|
|
65
67
|
spotlightTrackId
|
|
66
68
|
),
|
|
67
|
-
[
|
|
69
|
+
[
|
|
70
|
+
peerTrackNodes,
|
|
71
|
+
screenshareTilesOrWhiteboardAcive,
|
|
72
|
+
spotlightTrackId,
|
|
73
|
+
isPortrait,
|
|
74
|
+
]
|
|
68
75
|
);
|
|
69
76
|
|
|
70
77
|
const showWelcomeBanner = useSelector(
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Platform, View } from 'react-native';
|
|
3
|
+
import { useSelector } from 'react-redux';
|
|
4
|
+
import { WebView } from 'react-native-webview';
|
|
5
|
+
import type { WebViewProps } from 'react-native-webview';
|
|
6
|
+
|
|
7
|
+
import type { RootState } from '../redux';
|
|
8
|
+
import { PipModes } from '../utils/types';
|
|
9
|
+
import { useIsLandscapeOrientation } from '../utils/dimension';
|
|
10
|
+
import { WhiteboardFullScreenButton } from './WhiteboardFullScreenButton';
|
|
11
|
+
import type {
|
|
12
|
+
WebViewError,
|
|
13
|
+
WebViewErrorEvent,
|
|
14
|
+
} from 'react-native-webview/lib/WebViewTypes';
|
|
15
|
+
|
|
16
|
+
export type WhiteboardProps = {};
|
|
17
|
+
|
|
18
|
+
export const _Whiteboard = React.forwardRef<
|
|
19
|
+
React.Ref<React.ElementRef<typeof WebView> | null>,
|
|
20
|
+
WhiteboardProps
|
|
21
|
+
>((_props, webviewRef) => {
|
|
22
|
+
const localWebviewRef = React.useRef<null | React.ElementRef<typeof WebView>>(
|
|
23
|
+
null
|
|
24
|
+
);
|
|
25
|
+
React.useImperativeHandle(webviewRef, () => localWebviewRef, []);
|
|
26
|
+
|
|
27
|
+
const whiteboardUrl = useSelector(
|
|
28
|
+
(state: RootState) => state.hmsStates.whiteboard?.url
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
//#region reconnection handling
|
|
32
|
+
let webviewError = React.useRef<WebViewError | null>(null);
|
|
33
|
+
const webviewErrorHandler = React.useCallback((e: WebViewErrorEvent) => {
|
|
34
|
+
webviewError.current = e.nativeEvent;
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
if (Platform.OS === 'ios') {
|
|
38
|
+
const prevReconnecting = React.useRef<boolean | null>(null);
|
|
39
|
+
const reconnecting = useSelector(
|
|
40
|
+
(state: RootState) => state.hmsStates.reconnecting
|
|
41
|
+
);
|
|
42
|
+
if (
|
|
43
|
+
whiteboardUrl &&
|
|
44
|
+
localWebviewRef.current !== null &&
|
|
45
|
+
webviewError.current !== null &&
|
|
46
|
+
prevReconnecting.current === true &&
|
|
47
|
+
reconnecting === false
|
|
48
|
+
) {
|
|
49
|
+
localWebviewRef.current.reload();
|
|
50
|
+
}
|
|
51
|
+
prevReconnecting.current = reconnecting;
|
|
52
|
+
}
|
|
53
|
+
//#endregion reconnection handling
|
|
54
|
+
|
|
55
|
+
const isPipModeActive = useSelector(
|
|
56
|
+
(state: RootState) => state.app.pipModeStatus === PipModes.ACTIVE
|
|
57
|
+
);
|
|
58
|
+
const isLandscapeOrientation = useIsLandscapeOrientation();
|
|
59
|
+
|
|
60
|
+
if (!whiteboardUrl) return null;
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<View style={{ flex: 1, position: 'relative' }}>
|
|
64
|
+
<HMSWebView
|
|
65
|
+
ref={localWebviewRef}
|
|
66
|
+
url={whiteboardUrl}
|
|
67
|
+
onError={webviewErrorHandler}
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
{isPipModeActive || isLandscapeOrientation ? null : (
|
|
71
|
+
<WhiteboardFullScreenButton />
|
|
72
|
+
)}
|
|
73
|
+
</View>
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export const Whiteboard = React.memo(_Whiteboard);
|
|
78
|
+
|
|
79
|
+
//# Memoized Webview
|
|
80
|
+
|
|
81
|
+
interface HMSWebViewProps extends WebViewProps {
|
|
82
|
+
url: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const _HMSWebView = React.forwardRef<
|
|
86
|
+
React.ElementRef<typeof WebView>,
|
|
87
|
+
HMSWebViewProps
|
|
88
|
+
>((props, webviewRef) => {
|
|
89
|
+
return (
|
|
90
|
+
<WebView
|
|
91
|
+
ref={webviewRef}
|
|
92
|
+
source={{ uri: props.url }}
|
|
93
|
+
style={{ flex: 1 }}
|
|
94
|
+
javaScriptEnabled={true}
|
|
95
|
+
domStorageEnabled={true}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
const HMSWebView = React.memo(_HMSWebView);
|