diff --git a/app/client/src/components/PlayerControlPanel/index.tsx b/app/client/src/components/PlayerControlPanel/index.tsx index 104d8ae..bacc1b8 100644 --- a/app/client/src/components/PlayerControlPanel/index.tsx +++ b/app/client/src/components/PlayerControlPanel/index.tsx @@ -28,6 +28,7 @@ import { VideoQuality } from '../../features/VideoAutoQualityOptimizer/VideoQual import handlePlayerToggleFullscreen from './handlePlayerToggleFullscreen'; import initScreenfullOnChange from './initScreenfullOnChange'; import ScreenSharingSource from '../../features/PeerConnection/ScreenSharingSourceEnum'; +import { REACT_PLAYER_WRAPPER_ID } from '../../constants/appConstants'; const videoQualityButtonStyle: React.CSSProperties = { width: '100%', @@ -46,6 +47,8 @@ interface PlayerControlPanelProps { toaster: undefined | Toaster; } +const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + function PlayerControlPanel(props: PlayerControlPanelProps) { const { isPlaying, @@ -62,6 +65,7 @@ function PlayerControlPanel(props: PlayerControlPanelProps) { const isFullScreenAPIAvailable = useMemo(() => screenfull.isEnabled, []); const [isFullScreenOn, setIsFullScreenOn] = useState(false); + const [isVideoFlipped, setIsVideoFlipped] = useState(false); useEffect(() => { initScreenfullOnChange(setIsFullScreenOn); @@ -71,6 +75,27 @@ function PlayerControlPanel(props: PlayerControlPanelProps) { handlePlayerToggleFullscreen(); }, []); + const toggleFlipVideo = useCallback(() => { + const videoElement = isSafari + ? document.querySelector(`#${REACT_PLAYER_WRAPPER_ID}`) + : document.querySelector(`#${REACT_PLAYER_WRAPPER_ID} > video`); + if (isVideoFlipped) { + // @ts-ignore + videoElement.style.transform = ''; + setIsVideoFlipped(false); + } else { + // @ts-ignore + videoElement.style.transform = 'rotateY(180deg)'; + setIsVideoFlipped(true); + } + + toaster?.show({ + icon: 'clean', + intent: Intent.PRIMARY, + message: `Video is flipped horizontally`, + }); + }, [isVideoFlipped, toaster]); + return ( <> @@ -184,59 +209,60 @@ function PlayerControlPanel(props: PlayerControlPanelProps) { borderBottom: '1px solid #ffffffa8', }} /> - {screenSharingSourceType === ScreenSharingSource.WINDOW ? ( - - + + + {Object.values(VideoQuality).map((q: VideoQuality) => { + return ( + + + + ); + })} + + } + position={Position.BOTTOM} + popoverClassName={Classes.POPOVER_CONTENT_SIZING} + > + + - ) : ( - -
Video Quality:
- - {Object.values(VideoQuality).map( - (q: VideoQuality) => { - return ( - - - - ); - } - )} - - } - position={Position.BOTTOM} - popoverClassName={Classes.POPOVER_CONTENT_SIZING} - > - - - -
- )} + + (LoadingSharingIconEnum.DESKTOP); const [videoQuality, setVideoQuality] = useState( - VideoQuality.Q_AUTO + VideoQuality.Q_100_PERCENT ); const [peer, setPeer] = useState();