-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add developer mode option to show RTC connection statistics
- Loading branch information
Showing
7 changed files
with
218 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
Copyright 2023, 2024 New Vector Ltd. | ||
SPDX-License-Identifier: AGPL-3.0-only | ||
Please see LICENSE in the repository root for full details. | ||
*/ | ||
|
||
import { type FC } from "react"; | ||
import { Text, Tooltip, TooltipProvider } from "@vector-im/compound-web"; | ||
import { | ||
MicOnSolidIcon, | ||
VideoCallSolidIcon, | ||
} from "@vector-im/compound-design-tokens/assets/web/icons"; | ||
|
||
interface Props { | ||
audio?: RTCInboundRtpStreamStats | RTCOutboundRtpStreamStats; | ||
video?: RTCInboundRtpStreamStats | RTCOutboundRtpStreamStats; | ||
} | ||
|
||
export const RTCConnectionStats: FC<Props> = ({ audio, video, ...rest }) => { | ||
return ( | ||
<div> | ||
<TooltipProvider> | ||
{audio && ( | ||
<div> | ||
<Tooltip label={JSON.stringify(audio, null, 2)}> | ||
<MicOnSolidIcon /> | ||
</Tooltip> | ||
{"jitter" in audio && typeof audio.jitter === "number" && ( | ||
<Text as="span" size="xs"> | ||
{(audio.jitter * 1000).toFixed(0)}ms | ||
</Text> | ||
)} | ||
</div> | ||
)} | ||
{video && ( | ||
<div> | ||
{video && ( | ||
<Tooltip label={JSON.stringify(video, null, 2)}> | ||
<VideoCallSolidIcon /> | ||
</Tooltip> | ||
)} | ||
{video?.framesPerSecond && ( | ||
<Text as="span" size="xs"> | ||
{video.framesPerSecond.toFixed(0)}fps | ||
</Text> | ||
)} | ||
{"jitter" in video && typeof video.jitter === "number" && ( | ||
<Text as="span" size="xs"> | ||
{(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"> | ||
{video.frameWidth}x{video.frameHeight} | ||
</Text> | ||
)} | ||
{"qualityLimitationReason" in video && | ||
typeof video.qualityLimitationReason === "string" && | ||
video.qualityLimitationReason !== "none" && ( | ||
<Text as="span" size="xs"> | ||
{video.qualityLimitationReason} | ||
</Text> | ||
)} | ||
</div> | ||
)} | ||
</TooltipProvider> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters