diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 4892bcec9334..184c339e77c7 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -4231,6 +4231,10 @@ button.module-image__border-overlay:focus { } } + &__local-preview-video-container { + display: contents; + } + &__local-preview-fullsize { position: absolute; top: 0; @@ -4283,14 +4287,19 @@ button.module-image__border-overlay:focus { } &__video { - // The background-color is seen while the video loads. - background-color: $color-gray-75; height: 100%; - transform: rotateY(180deg); width: 100%; - &--presenting { - transform: inherit; + video { + // The background-color is seen while the video loads. + background-color: $color-gray-75; + height: 100%; + width: 100%; + + transform: rotateY(180deg); + &--presenting { + transform: inherit; + } } } } @@ -4373,8 +4382,13 @@ button.module-image__border-overlay:focus { height: 32px; position: absolute; inset-inline-end: 4px; - transform: rotateY(180deg); width: 32px; + + video { + transform: rotateY(180deg); + width: 100%; + height: 100%; + } } } diff --git a/stylesheets/components/CallingLobby.scss b/stylesheets/components/CallingLobby.scss index a5f94e08f473..e072c605bf45 100644 --- a/stylesheets/components/CallingLobby.scss +++ b/stylesheets/components/CallingLobby.scss @@ -14,6 +14,14 @@ height: 100%; max-height: calc(100% - 140px); opacity: 0.6; + + // Border radius should clip children + overflow: hidden; + } + + &--camera-is-on video { + width: auto; + height: 100%; } &--camera-is-off { diff --git a/ts/components/CallManager.stories.tsx b/ts/components/CallManager.stories.tsx index be8c68d9e3ec..6dded0c8e41a 100644 --- a/ts/components/CallManager.stories.tsx +++ b/ts/components/CallManager.stories.tsx @@ -130,7 +130,7 @@ const createProps = (storyProps: Partial = {}): PropsType => ({ setGroupCallVideoRequest: action('set-group-call-video-request'), setIsCallActive: action('set-is-call-active'), setLocalAudio: action('set-local-audio'), - setLocalPreview: action('set-local-preview'), + setLocalPreviewContainer: action('set-local-preview-container'), setLocalVideo: action('set-local-video'), setRendererCanvas: action('set-renderer-canvas'), setOutgoingRing: action('set-outgoing-ring'), diff --git a/ts/components/CallManager.tsx b/ts/components/CallManager.tsx index 9a0499ea6377..e7f5747a31ee 100644 --- a/ts/components/CallManager.tsx +++ b/ts/components/CallManager.tsx @@ -37,7 +37,6 @@ import type { SendGroupCallReactionType, SetGroupCallVideoRequestType, SetLocalAudioType, - SetLocalPreviewType, SetLocalVideoType, SetRendererCanvasType, StartCallType, @@ -127,7 +126,7 @@ export type PropsType = { setIsCallActive: (_: boolean) => void; setLocalAudio: (_: SetLocalAudioType) => void; setLocalVideo: (_: SetLocalVideoType) => void; - setLocalPreview: (_: SetLocalPreviewType) => void; + setLocalPreviewContainer: (container: HTMLDivElement | null) => void; setOutgoingRing: (_: boolean) => void; setRendererCanvas: (_: SetRendererCanvasType) => void; showShareCallLinkViaSignal: ( @@ -192,7 +191,7 @@ function ActiveCallManager({ sendGroupCallReaction, setGroupCallVideoRequest, setLocalAudio, - setLocalPreview, + setLocalPreviewContainer, setLocalVideo, setRendererCanvas, setOutgoingRing, @@ -351,7 +350,7 @@ function ActiveCallManager({ hasLocalVideo={hasLocalVideo} i18n={i18n} setGroupCallVideoRequest={setGroupCallVideoRequestForConversation} - setLocalPreview={setLocalPreview} + setLocalPreviewContainer={setLocalPreviewContainer} setRendererCanvas={setRendererCanvas} switchToPresentationView={switchToPresentationView} switchFromPresentationView={switchFromPresentationView} @@ -383,7 +382,7 @@ function ActiveCallManager({ onJoinCall={joinActiveCall} outgoingRing={outgoingRing} peekedParticipants={peekedParticipants} - setLocalPreview={setLocalPreview} + setLocalPreviewContainer={setLocalPreviewContainer} setLocalAudio={setLocalAudio} setLocalVideo={setLocalVideo} setOutgoingRing={setOutgoingRing} @@ -471,7 +470,7 @@ function ActiveCallManager({ sendGroupCallRaiseHand={sendGroupCallRaiseHand} sendGroupCallReaction={sendGroupCallReaction} setGroupCallVideoRequest={setGroupCallVideoRequestForConversation} - setLocalPreview={setLocalPreview} + setLocalPreviewContainer={setLocalPreviewContainer} setRendererCanvas={setRendererCanvas} setLocalAudio={setLocalAudio} setLocalVideo={setLocalVideo} @@ -567,7 +566,7 @@ export function CallManager({ setGroupCallVideoRequest, setIsCallActive, setLocalAudio, - setLocalPreview, + setLocalPreviewContainer, setLocalVideo, setOutgoingRing, setRendererCanvas, @@ -662,7 +661,7 @@ export function CallManager({ sendGroupCallReaction={sendGroupCallReaction} setGroupCallVideoRequest={setGroupCallVideoRequest} setLocalAudio={setLocalAudio} - setLocalPreview={setLocalPreview} + setLocalPreviewContainer={setLocalPreviewContainer} setLocalVideo={setLocalVideo} setOutgoingRing={setOutgoingRing} setRendererCanvas={setRendererCanvas} diff --git a/ts/components/CallScreen.stories.tsx b/ts/components/CallScreen.stories.tsx index 62fd4b06d980..f7b64bd4151e 100644 --- a/ts/components/CallScreen.stories.tsx +++ b/ts/components/CallScreen.stories.tsx @@ -219,7 +219,7 @@ const createProps = ( sendGroupCallReaction: action('send-group-call-reaction'), setGroupCallVideoRequest: action('set-group-call-video-request'), setLocalAudio: action('set-local-audio'), - setLocalPreview: action('set-local-preview'), + setLocalPreviewContainer: action('set-local-preview-container'), setLocalVideo: action('set-local-video'), setRendererCanvas: action('set-renderer-canvas'), stickyControls: false, diff --git a/ts/components/CallScreen.tsx b/ts/components/CallScreen.tsx index b56bb92d972f..eecb47be2c0f 100644 --- a/ts/components/CallScreen.tsx +++ b/ts/components/CallScreen.tsx @@ -13,7 +13,6 @@ import type { SendGroupCallRaiseHandType, SendGroupCallReactionType, SetLocalAudioType, - SetLocalPreviewType, SetLocalVideoType, SetRendererCanvasType, } from '../state/ducks/calling'; @@ -119,7 +118,7 @@ export type PropsType = { ) => void; setLocalAudio: (_: SetLocalAudioType) => void; setLocalVideo: (_: SetLocalVideoType) => void; - setLocalPreview: (_: SetLocalPreviewType) => void; + setLocalPreviewContainer: (container: HTMLDivElement | null) => void; setRendererCanvas: (_: SetRendererCanvasType) => void; stickyControls: boolean; switchToPresentationView: () => void; @@ -209,7 +208,7 @@ export function CallScreen({ sendGroupCallReaction, setLocalAudio, setLocalVideo, - setLocalPreview, + setLocalPreviewContainer, setRendererCanvas, stickyControls, switchToPresentationView, @@ -294,15 +293,6 @@ export function CallScreen({ const [showControls, setShowControls] = useState(true); - const localVideoRef = useRef(null); - - useEffect(() => { - setLocalPreview({ element: localVideoRef }); - return () => { - setLocalPreview({ element: undefined }); - }; - }, [setLocalPreview, setRendererCanvas]); - useEffect(() => { if ( !showControls || @@ -431,7 +421,10 @@ export function CallScreen({ )} > {isSendingVideo ? ( -