Maximise the active speaker when the window is small

This commit is contained in:
Robin Townsend 2022-09-14 19:05:05 -04:00
commit 9e367db324
6 changed files with 86 additions and 52 deletions

View file

@ -77,6 +77,7 @@ export const ParticipantsTest = () => {
key={item.id}
name={`User ${item.id}`}
disableSpeakingIndicator={items.length < 3}
maximised={false}
{...rest}
/>
)}

View file

@ -40,7 +40,7 @@
box-shadow: inset 0 0 0 4px var(--accent) !important;
}
.videoTile.fullscreen {
.videoTile.maximised {
position: relative;
border-radius: 0;
}

View file

@ -33,7 +33,8 @@ interface Props {
mediaRef?: React.RefObject<MediaElement>;
onOptionsPress?: () => void;
localVolume?: number;
isFullscreen?: boolean;
maximised: boolean;
fullscreen?: boolean;
onFullscreen?: () => void;
className?: string;
showOptions?: boolean;
@ -53,7 +54,8 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
mediaRef,
onOptionsPress,
localVolume,
isFullscreen,
maximised,
fullscreen,
onFullscreen,
className,
showOptions,
@ -71,7 +73,7 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
[styles.speaking]: speaking,
[styles.muted]: audioMuted,
[styles.screenshare]: screenshare,
[styles.fullscreen]: isFullscreen,
[styles.maximised]: maximised,
})}
ref={ref}
{...rest}
@ -88,7 +90,7 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
{screenshare && (
<FullscreenButton
className={styles.button}
fullscreen={isFullscreen}
fullscreen={fullscreen}
onPress={onFullscreen}
/>
)}
@ -100,17 +102,18 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
{avatar}
</>
)}
{screenshare ? (
<div className={styles.presenterLabel}>
<span>{`${name} is presenting`}</span>
</div>
) : (
<div className={classNames(styles.infoBubble, styles.memberName)}>
{audioMuted && !videoMuted && <MicMutedIcon />}
{videoMuted && <VideoMutedIcon />}
<span title={name}>{name}</span>
</div>
)}
{!maximised &&
(screenshare ? (
<div className={styles.presenterLabel}>
<span>{`${name} is presenting`}</span>
</div>
) : (
<div className={classNames(styles.infoBubble, styles.memberName)}>
{audioMuted && !videoMuted && <MicMutedIcon />}
{videoMuted && <VideoMutedIcon />}
<span title={name}>{name}</span>
</div>
))}
<video ref={mediaRef} playsInline disablePictureInPicture />
</animated.div>
);

View file

@ -39,9 +39,11 @@ interface Props {
audioContext: AudioContext;
audioDestination: AudioNode;
disableSpeakingIndicator: boolean;
isFullscreen: boolean;
maximised: boolean;
fullscreen: boolean;
onFullscreen: (item: Participant) => void;
}
export function VideoTileContainer({
item,
width,
@ -50,7 +52,8 @@ export function VideoTileContainer({
audioContext,
audioDestination,
disableSpeakingIndicator,
isFullscreen,
maximised,
fullscreen,
onFullscreen,
...rest
}: Props) {
@ -101,7 +104,8 @@ export function VideoTileContainer({
avatar={getAvatar && getAvatar(member, width, height)}
onOptionsPress={onOptionsPress}
localVolume={localVolume}
isFullscreen={isFullscreen}
maximised={maximised}
fullscreen={fullscreen}
onFullscreen={onFullscreenCallback}
{...rest}
/>