mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-02 19:49:23 +00:00
Changed styling and fixed fps = 0 (#2916)
(React rendered 0 instead of <Text /> for fps && <Text>{fps}</text>)
This commit is contained in:
@@ -9,6 +9,12 @@ Please see LICENSE in the repository root for full details.
|
|||||||
font-size: var(--font-size-micro);
|
font-size: var(--font-size-micro);
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.statsPill {
|
||||||
color: var(--cpd-color-text-primary);
|
border-radius: var(--media-view-border-radius);
|
||||||
|
grid-area: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,16 @@ Please see LICENSE in the repository root for full details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { useState, type FC } from "react";
|
import { useState, type FC } from "react";
|
||||||
import { IconButton, Text } from "@vector-im/compound-web";
|
import { Button, Text } from "@vector-im/compound-web";
|
||||||
import {
|
import {
|
||||||
MicOnSolidIcon,
|
MicOnSolidIcon,
|
||||||
VideoCallSolidIcon,
|
VideoCallSolidIcon,
|
||||||
} from "@vector-im/compound-design-tokens/assets/web/icons";
|
} from "@vector-im/compound-design-tokens/assets/web/icons";
|
||||||
|
import classNames from "classnames";
|
||||||
|
|
||||||
import { Modal } from "./Modal";
|
import { Modal } from "./Modal";
|
||||||
import styles from "./RTCConnectionStats.module.css";
|
import styles from "./RTCConnectionStats.module.css";
|
||||||
|
import mediaViewStyles from "../src/tile/MediaView.module.css";
|
||||||
interface Props {
|
interface Props {
|
||||||
audio?: RTCInboundRtpStreamStats | RTCOutboundRtpStreamStats;
|
audio?: RTCInboundRtpStreamStats | RTCOutboundRtpStreamStats;
|
||||||
video?: RTCInboundRtpStreamStats | RTCOutboundRtpStreamStats;
|
video?: RTCInboundRtpStreamStats | RTCOutboundRtpStreamStats;
|
||||||
@@ -37,7 +38,7 @@ export const RTCConnectionStats: FC<Props> = ({ audio, video, ...rest }) => {
|
|||||||
setModalContents("none");
|
setModalContents("none");
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className={classNames(mediaViewStyles.nameTag, styles.statsPill)}>
|
||||||
<Modal
|
<Modal
|
||||||
title="RTC Connection Stats"
|
title="RTC Connection Stats"
|
||||||
open={showModal}
|
open={showModal}
|
||||||
@@ -56,46 +57,54 @@ export const RTCConnectionStats: FC<Props> = ({ audio, video, ...rest }) => {
|
|||||||
</Modal>
|
</Modal>
|
||||||
{audio && (
|
{audio && (
|
||||||
<div>
|
<div>
|
||||||
<IconButton onClick={() => showFullModal("audio")} size="sm">
|
<Button
|
||||||
<MicOnSolidIcon className={styles.icon} />
|
onClick={() => showFullModal("audio")}
|
||||||
</IconButton>
|
size="sm"
|
||||||
{"jitter" in audio && typeof audio.jitter === "number" && (
|
kind="tertiary"
|
||||||
<Text as="span" size="xs" title="jitter">
|
Icon={MicOnSolidIcon}
|
||||||
{(audio.jitter * 1000).toFixed(0)}ms
|
>
|
||||||
</Text>
|
{"jitter" in audio && typeof audio.jitter === "number" && (
|
||||||
)}
|
<Text as="span" size="xs" title="jitter">
|
||||||
|
{(audio.jitter * 1000).toFixed(0)}ms
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{video && (
|
{video && (
|
||||||
<div>
|
<div>
|
||||||
<IconButton onClick={() => showFullModal("video")} size="sm">
|
<Button
|
||||||
<VideoCallSolidIcon className={styles.icon} />
|
onClick={() => showFullModal("video")}
|
||||||
</IconButton>
|
size="sm"
|
||||||
{video?.framesPerSecond && (
|
kind="tertiary"
|
||||||
<Text as="span" size="xs" title="frame rate">
|
Icon={VideoCallSolidIcon}
|
||||||
{video.framesPerSecond.toFixed(0)}fps
|
>
|
||||||
</Text>
|
{!!video?.framesPerSecond && (
|
||||||
)}
|
<Text as="span" size="xs" title="frame rate">
|
||||||
{"jitter" in video && typeof video.jitter === "number" && (
|
{video.framesPerSecond.toFixed(0)}fps
|
||||||
<Text as="span" size="xs" title="jitter">
|
|
||||||
{(video.jitter * 1000).toFixed(0)}ms
|
|
||||||
</Text>
|
|
||||||
)}
|
|
||||||
{"frameHeight" in video &&
|
|
||||||
typeof video.frameHeight === "number" &&
|
|
||||||
"frameWidth" in video &&
|
|
||||||
typeof video.frameWidth === "number" && (
|
|
||||||
<Text as="span" size="xs" title="frame size">
|
|
||||||
{video.frameWidth}x{video.frameHeight}
|
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
{"qualityLimitationReason" in video &&
|
{"jitter" in video && typeof video.jitter === "number" && (
|
||||||
typeof video.qualityLimitationReason === "string" &&
|
<Text as="span" size="xs" title="jitter">
|
||||||
video.qualityLimitationReason !== "none" && (
|
{(video.jitter * 1000).toFixed(0)}ms
|
||||||
<Text as="span" size="xs" title="quality limitation reason">
|
|
||||||
{video.qualityLimitationReason}
|
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
|
{"frameHeight" in video &&
|
||||||
|
typeof video.frameHeight === "number" &&
|
||||||
|
"frameWidth" in video &&
|
||||||
|
typeof video.frameWidth === "number" && (
|
||||||
|
<Text as="span" size="xs" title="frame size">
|
||||||
|
{video.frameWidth}x{video.frameHeight}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
{"qualityLimitationReason" in video &&
|
||||||
|
typeof video.qualityLimitationReason === "string" &&
|
||||||
|
video.qualityLimitationReason !== "none" && (
|
||||||
|
<Text as="span" size="xs" title="quality limitation reason">
|
||||||
|
{video.qualityLimitationReason}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user