Add a 'waiting for video' state to media tiles

This will show if the call is waiting for media to connect (in practice
doesn't actually seem to happen all that often) but also show if the
media connection is lost, with the js-sdk change.

Requires https://github.com/matrix-org/matrix-js-sdk/pull/2880
Fixes: https://github.com/vector-im/element-call/issues/669
This commit is contained in:
David Baker 2022-11-15 16:13:33 +00:00
commit 80f07a5454
7 changed files with 98 additions and 12 deletions

View file

@ -23,10 +23,11 @@ import styles from "./VideoTile.module.css";
import { ReactComponent as MicMutedIcon } from "../icons/MicMuted.svg";
import { ReactComponent as VideoMutedIcon } from "../icons/VideoMuted.svg";
import { AudioButton, FullscreenButton } from "../button/Button";
import { ConnectionState } from "../room/InCallView";
interface Props {
name: string;
hasFeed: Boolean;
connectionState: ConnectionState;
speaking?: boolean;
audioMuted?: boolean;
videoMuted?: boolean;
@ -48,7 +49,7 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
(
{
name,
hasFeed,
connectionState,
speaking,
audioMuted,
videoMuted,
@ -72,7 +73,7 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
const { t } = useTranslation();
const toolbarButtons: JSX.Element[] = [];
if (hasFeed && !isLocal) {
if (connectionState == ConnectionState.CONNECTED && !isLocal) {
toolbarButtons.push(
<AudioButton
key="localVolume"
@ -94,7 +95,20 @@ export const VideoTile = forwardRef<HTMLDivElement, Props>(
}
}
const caption = hasFeed ? name : t("{{name}} (Connecting...)", { name });
let caption: string;
switch (connectionState) {
case ConnectionState.ESTABLISHING_CALL:
caption = t("{{name}} (Connecting...)", { name });
break;
case ConnectionState.WAIT_MEDIA:
// not strictly true, but probably easier to understand than, "Waiting for media"
caption = t("{{name}} (Waiting for video...)", { name });
break;
case ConnectionState.CONNECTED:
caption = name;
break;
}
return (
<animated.div