fix(web): show SFU viewer connection truth (#127)

This commit is contained in:
AAA authored and GitHub committed 2026-08-21 11:21:28 +08:00 Unverified
1 parent b0adbe6084
commit bebfd52fe2
7 files changed
+351 -14

No files matched your search

+16 -2
View File
@@ -37,10 +37,14 @@ export function SignalStatusBadge({
export function PeerStatusBadge({
state,
}: {
state: RTCPeerConnectionState | "waiting";
state: RTCPeerConnectionState | "reconnecting" | "waiting";
}) {
const labels: Record<RTCPeerConnectionState | "waiting", BadgeProps> = {
const labels: Record<
RTCPeerConnectionState | "reconnecting" | "waiting",
BadgeProps
> = {
waiting: { tone: "neutral", label: "等待开始分享" },
reconnecting: { tone: "warning", label: "正在恢复" },
new: { tone: "neutral", label: "准备中" },
connecting: { tone: "neutral", label: "正在连接" },
connected: { tone: "good", label: "已连接" },
@@ -76,6 +80,16 @@ export function PathBadge({ path }: { path: MediaPath }) {
);
}
export function MediaRouteBadge({ route }: { route: "p2p" | "sfu" }) {
return (
<Badge
tone={route === "p2p" ? "good" : "neutral"}
label={route === "p2p" ? "P2P" : "SFU"}
title="当前媒体路径"
/>
);
}
export function TopologyBadge({
topology,
}: {