Add support for screen-sharing

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2022-08-07 19:09:45 +02:00
commit 305c2cb806
No known key found for this signature in database
GPG key ID: 4F68B9EC0536B5CC
5 changed files with 127 additions and 54 deletions

View file

@ -20,7 +20,7 @@ import classNames from "classnames";
import styles from "./VideoTile.module.css";
import { ReactComponent as MicMutedIcon } from "../icons/MicMuted.svg";
import { ReactComponent as VideoMutedIcon } from "../icons/VideoMuted.svg";
import { AudioButton } from "../button/Button";
import { AudioButton, FullscreenButton } from "../button/Button";
export const VideoTile = forwardRef(
(
@ -39,6 +39,8 @@ export const VideoTile = forwardRef(
onOptionsPress,
showOptions,
localVolume,
isFullscreen,
onFullscreen,
...rest
},
ref
@ -50,17 +52,27 @@ export const VideoTile = forwardRef(
[styles.speaking]: speaking,
[styles.muted]: audioMuted,
[styles.screenshare]: screenshare,
[styles.fullscreen]: isFullscreen,
})}
ref={ref}
{...rest}
>
{showOptions && (
{(!isLocal || screenshare) && (
<div className={classNames(styles.toolbar)}>
<AudioButton
className={styles.button}
volume={localVolume}
onPress={onOptionsPress}
/>
{!isLocal && (
<AudioButton
className={styles.button}
volume={localVolume}
onPress={onOptionsPress}
/>
)}
{screenshare && (
<FullscreenButton
className={styles.button}
fullscreen={isFullscreen}
onPress={onFullscreen}
/>
)}
</div>
)}
{(videoMuted || noVideo) && (

View file

@ -40,6 +40,11 @@
box-shadow: inset 0 0 0 4px var(--accent) !important;
}
.videoTile.fullscreen {
position: relative;
border-radius: 0;
}
.videoTile.screenshare > video {
object-fit: contain;
}
@ -79,10 +84,11 @@
z-index: 1;
}
.videoTile:not(.isLocal):not(:hover) .toolbar {
.videoTile:not(:hover) .toolbar {
display: none;
}
.videoTile:not(.fullscreen):hover .presenterLabel,
.videoTile:not(.isLocal):hover .presenterLabel {
top: calc(42px + 20px); /* toolbar + margin */
}

View file

@ -33,6 +33,8 @@ export function VideoTileContainer({
audioContext,
audioDestination,
disableSpeakingIndicator,
isFullscreen,
onFullscreen,
...rest
}) {
const {
@ -81,8 +83,9 @@ export function VideoTileContainer({
mediaRef={mediaRef}
avatar={getAvatar && getAvatar(member, width, height)}
onOptionsPress={onOptionsPress}
showOptions={!item.callFeed.isLocal()}
localVolume={localVolume}
isFullscreen={isFullscreen}
onFullscreen={() => onFullscreen(item)}
{...rest}
/>
{videoTileSettingsModalState.isOpen && (