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:
parent
6ef41b924d
commit
80f07a5454
7 changed files with 98 additions and 12 deletions
|
|
@ -21,7 +21,7 @@ import { RoomMember } from "matrix-js-sdk";
|
|||
import { VideoGrid, useVideoGridLayout } from "./VideoGrid";
|
||||
import { VideoTile } from "./VideoTile";
|
||||
import { Button } from "../button";
|
||||
import { TileDescriptor } from "../room/InCallView";
|
||||
import { ConnectionState, TileDescriptor } from "../room/InCallView";
|
||||
|
||||
export default {
|
||||
title: "VideoGrid",
|
||||
|
|
@ -41,6 +41,7 @@ export const ParticipantsTest = () => {
|
|||
member: new RoomMember("!fake:room.id", `@user${i}:fake.dummy`),
|
||||
focused: false,
|
||||
presenter: false,
|
||||
connectionState: ConnectionState.CONNECTED,
|
||||
})),
|
||||
[participantCount]
|
||||
);
|
||||
|
|
@ -79,7 +80,7 @@ export const ParticipantsTest = () => {
|
|||
key={item.id}
|
||||
name={`User ${item.id}`}
|
||||
disableSpeakingIndicator={items.length < 3}
|
||||
hasFeed={true}
|
||||
connectionState={ConnectionState.CONNECTED}
|
||||
{...rest}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ export function VideoTileContainer({
|
|||
videoMuted={videoMuted}
|
||||
screenshare={purpose === SDPStreamMetadataPurpose.Screenshare}
|
||||
name={rawDisplayName}
|
||||
hasFeed={Boolean(item.callFeed)}
|
||||
connectionState={item.connectionState}
|
||||
ref={tileRef}
|
||||
mediaRef={mediaRef}
|
||||
avatar={getAvatar && getAvatar(item.member, width, height)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue