Merge pull request #622 from vector-im/SimonBrandner/feat/hide-screen

This commit is contained in:
Šimon Brandner
2022-10-14 16:49:54 +02:00
committed by GitHub
2 changed files with 15 additions and 6 deletions

View File

@@ -29,6 +29,8 @@ export interface UrlParams {
preload: boolean; preload: boolean;
// Whether to hide the room header when in a call // Whether to hide the room header when in a call
hideHeader: boolean; hideHeader: boolean;
// Whether to hide the screen-sharing button
hideScreensharing: boolean;
// Whether to start a walkie-talkie call instead of a video call // Whether to start a walkie-talkie call instead of a video call
isPtt: boolean; isPtt: boolean;
// Whether to use end-to-end encryption // Whether to use end-to-end encryption
@@ -84,6 +86,7 @@ export const getUrlParams = (
isEmbedded: hasParam("embed"), isEmbedded: hasParam("embed"),
preload: hasParam("preload"), preload: hasParam("preload"),
hideHeader: hasParam("hideHeader"), hideHeader: hasParam("hideHeader"),
hideScreensharing: hasParam("hideScreensharing"),
isPtt: hasParam("ptt"), isPtt: hasParam("ptt"),
e2eEnabled: getParam("enableE2e") !== "false", // Defaults to true e2eEnabled: getParam("enableE2e") !== "false", // Defaults to true
userId: getParam("userId"), userId: getParam("userId"),

View File

@@ -57,6 +57,7 @@ import { useFullscreen } from "../video-grid/useFullscreen";
import { AudioContainer } from "../video-grid/AudioContainer"; import { AudioContainer } from "../video-grid/AudioContainer";
import { useAudioOutputDevice } from "../video-grid/useAudioOutputDevice"; import { useAudioOutputDevice } from "../video-grid/useAudioOutputDevice";
import { widget, ElementWidgetActions } from "../widget"; import { widget, ElementWidgetActions } from "../widget";
import { useUrlParams } from "../UrlParams";
const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {}); const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {});
// There is currently a bug in Safari our our code with cloning and sending MediaStreams // There is currently a bug in Safari our our code with cloning and sending MediaStreams
@@ -141,6 +142,8 @@ export function InCallView({
useAudioOutputDevice(audioRef, audioOutput); useAudioOutputDevice(audioRef, audioOutput);
const { hideScreensharing } = useUrlParams();
useEffect(() => { useEffect(() => {
widget?.api.transport.send( widget?.api.transport.send(
layout === "freedom" layout === "freedom"
@@ -329,12 +332,15 @@ export function InCallView({
<div className={styles.footer}> <div className={styles.footer}>
<MicButton muted={microphoneMuted} onPress={toggleMicrophoneMuted} /> <MicButton muted={microphoneMuted} onPress={toggleMicrophoneMuted} />
<VideoButton muted={localVideoMuted} onPress={toggleLocalVideoMuted} /> <VideoButton muted={localVideoMuted} onPress={toggleLocalVideoMuted} />
{canScreenshare && !isSafari && !reducedControls && ( {canScreenshare &&
<ScreenshareButton !hideScreensharing &&
enabled={isScreensharing} !isSafari &&
onPress={toggleScreensharing} !reducedControls && (
/> <ScreenshareButton
)} enabled={isScreensharing}
onPress={toggleScreensharing}
/>
)}
{!reducedControls && ( {!reducedControls && (
<OverflowMenu <OverflowMenu
inCall inCall