Activate speaker view when screensharing, even while in PiP

This commit is contained in:
Josh Perez 2021-10-07 14:56:27 -04:00 committed by GitHub
parent 1f4a3851bf
commit a363c6c0ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View file

@ -271,6 +271,7 @@ const ActiveCallManager: React.FC<ActiveCallManagerPropsType> = ({
setLocalPreview={setLocalPreview} setLocalPreview={setLocalPreview}
setRendererCanvas={setRendererCanvas} setRendererCanvas={setRendererCanvas}
togglePip={togglePip} togglePip={togglePip}
toggleSpeakerView={toggleSpeakerView}
/> />
); );
} }

View file

@ -66,6 +66,7 @@ const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
setLocalPreview: action('set-local-preview'), setLocalPreview: action('set-local-preview'),
setRendererCanvas: action('set-renderer-canvas'), setRendererCanvas: action('set-renderer-canvas'),
togglePip: action('toggle-pip'), togglePip: action('toggle-pip'),
toggleSpeakerView: action('toggleSpeakerView'),
}); });
const story = storiesOf('Components/CallingPip', module); const story = storiesOf('Components/CallingPip', module);

View file

@ -13,6 +13,7 @@ import {
SetRendererCanvasType, SetRendererCanvasType,
} from '../state/ducks/calling'; } from '../state/ducks/calling';
import { missingCaseError } from '../util/missingCaseError'; import { missingCaseError } from '../util/missingCaseError';
import { useActivateSpeakerViewOnPresenting } from '../hooks/useActivateSpeakerViewOnPresenting';
enum PositionMode { enum PositionMode {
BeingDragged, BeingDragged,
@ -58,6 +59,7 @@ export type PropsType = {
setLocalPreview: (_: SetLocalPreviewType) => void; setLocalPreview: (_: SetLocalPreviewType) => void;
setRendererCanvas: (_: SetRendererCanvasType) => void; setRendererCanvas: (_: SetRendererCanvasType) => void;
togglePip: () => void; togglePip: () => void;
toggleSpeakerView: () => void;
}; };
const PIP_HEIGHT = 156; const PIP_HEIGHT = 156;
@ -75,6 +77,7 @@ export const CallingPip = ({
setLocalPreview, setLocalPreview,
setRendererCanvas, setRendererCanvas,
togglePip, togglePip,
toggleSpeakerView,
}: PropsType): JSX.Element | null => { }: PropsType): JSX.Element | null => {
const videoContainerRef = React.useRef<null | HTMLDivElement>(null); const videoContainerRef = React.useRef<null | HTMLDivElement>(null);
const localVideoRef = React.useRef(null); const localVideoRef = React.useRef(null);
@ -86,6 +89,12 @@ export const CallingPip = ({
offsetY: PIP_TOP_MARGIN, offsetY: PIP_TOP_MARGIN,
}); });
useActivateSpeakerViewOnPresenting(
activeCall.remoteParticipants,
activeCall.isInSpeakerView,
toggleSpeakerView
);
React.useEffect(() => { React.useEffect(() => {
setLocalPreview({ element: localVideoRef }); setLocalPreview({ element: localVideoRef });
}, [setLocalPreview]); }, [setLocalPreview]);