diff --git a/.gitignore b/.gitignore index 54b76a2..41f0697 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ docker-compose.override.yml .claude/ CLAUDE.md .serena/ + +# TLS material for local HTTPS - a private key never belongs in the repo. +gateway/certs/ diff --git a/.gitmodules b/.gitmodules index fec4885..0855b39 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "tsclientlib"] path = tsclientlib - url = https://github.com/GreenTeaSpeak/tsclientlib.git + url = https://github.com/Moepchi/tsclientlib.git branch = webspeak3 diff --git a/README.md b/README.md index fd077df..2a350fd 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ not need to be installed on the same machine, modified, or operated by you. | 🔁 **Multi-join (server tabs)** | Several connections in parallel — one tab per server, like GreenTeaSpeak 2. Audio stays on the active tab | | 🔁 **Seamless reconnect** | Switch or add connections mid-session without tearing down unrelated tabs | | 🍵 **GreenTeaSpeak support** | Connects to real GreenTeaSpeak servers (not just TS3/TS6/TeaSpeak), plus an optional GTS-styled UI chrome (dark panels, gold menu bar, connection-tab strip) alongside the default look | +| 🖥️ **Screen streaming to/from TS6** | **ALPHA · UNSTABLE** Share your screen to native TeamSpeak 6 clients and watch theirs. Built on TS6's undocumented Stream/Call protocol — expect it to break; see [Roadmap](ROADMAP.md) | ## 🧱 Tech Stack diff --git a/ROADMAP.md b/ROADMAP.md index c17fc81..6289d3d 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -19,6 +19,13 @@ This roadmap is intentionally outcome-focused. It does not promise fixed dates. ## Experimental or still being validated +- **Screen streaming to and from TeamSpeak 6 (alpha, unstable).** WebSpeak3 can + publish a screen share that a native TS6 client can watch, and watch a stream + a TS6 client publishes. It speaks TS6's Stream/Call protocol, which TeamSpeak + does not document, so the wire format was derived from observed behavior and + may break with any TS6 update. Connection setup, picture quality, and viewer + admission are not yet dependable. The "Server" connection mode (TS6's SFU) is + not implemented; only direct P2P works. - Safari and Mobile Safari audio/microphone behavior - Uncommon TeamSpeak permission combinations and large permission sets - Very large servers and long-running browser sessions diff --git a/connector/src/main.rs b/connector/src/main.rs index b2954b5..be69def 100644 --- a/connector/src/main.rs +++ b/connector/src/main.rs @@ -1,5 +1,6 @@ use std::borrow::Cow; -use std::collections::{HashMap, HashSet}; +use std::collections::{BTreeMap, HashMap, HashSet}; +use std::str; use std::time::Duration; use anyhow::Result; @@ -29,6 +30,7 @@ use tsclientlib::{ LicenseType, MaxClients, MessageHandle, MessageTarget, Permission, Reason, ServerGroupId, ServerType, StreamItem, TextMessageTargetMode, TsError, }; +use tsproto_packets::commands::{CommandItem, CommandParser}; use tsproto_packets::packets::{AudioData, CodecType, Direction, Flags, OutAudio, OutCommand, PacketType}; /// 20ms frames at 48kHz, which is what TeamSpeak's Opus voice codec expects. @@ -106,6 +108,48 @@ struct ClientInfo { /// ServerQuery client (`ClientType::Query`). Always included in the /// snapshot; the UI hides these unless the user enables them per favorite. is_query: bool, + /// Whether this client is broadcasting a TS6 Stream/Call right now. This is + /// the only way a client that joins late learns a stream exists - the server + /// sends no stream command in that case, so the id has to be fetched with + /// `requeststreaminfo`. Always `false` on servers that don't report it. + is_streaming: bool, +} + +/// Payload for the "streamsetup " stdin command - the `setupstream` args, which +/// TS6 always sends in full. The server answers by broadcasting +/// `notifystreamstarted` with the stream id it assigned; there is no id here +/// because the client does not get to pick one. +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct StreamSetupPayload { + name: String, + /// Source kind. A real TS6 screen share sends 3. + #[serde(rename = "type")] + kind: u8, + bitrate: u32, + /// Who may join: TS6's Privacy setting (public / contacts / private). + accessibility: u8, + /// Connection mode - P2P or via the server's SFU. + mode: u8, + /// 0 means unlimited. + viewer_limit: u32, + audio: bool, +} + +/// Payload for the "streamrespond " stdin command - our reply to a +/// `notifyjoinstreamrequest`. JSON rather than a plain argument line because +/// `offer` is a multi-line SDP and stdin here is line-based. +#[derive(Deserialize)] +#[serde(rename_all = "camelCase")] +struct StreamRespondPayload { + id: String, + clid: u16, + #[serde(default)] + msg: String, + /// The publisher offers, so on accept this carries our whole SDP. + #[serde(default)] + offer: String, + decision: u8, } /// Payload for the "serveredit " stdin command - every field is optional so @@ -344,6 +388,16 @@ enum Event { /// anywhere), for populating an "add permission" picker. #[serde(rename = "permissionCatalog")] PermissionCatalog { entries: Vec }, + /// A TS6 Stream/Call command the server sent us, forwarded verbatim. + /// + /// `tsclientlib` has no declarations for these, so they arrive as + /// `StreamItem::UnknownCommand` and are only unescaped here - the payload + /// of `notifystreamsignaling` is an opaque JSON blob (SDP offer/answer, + /// ICE candidates) that belongs to the browser's `RTCPeerConnection`, not + /// to the connector. `name` is the raw command name, e.g. + /// `notifystreamsignaling`. + #[serde(rename = "streamEvent")] + StreamEvent { name: String, args: BTreeMap }, } #[derive(Serialize)] @@ -609,6 +663,7 @@ fn snapshot(con: &data::Connection) -> Event { server_groups: c.server_groups.iter().map(|g| g.0).collect(), has_talk_power, is_query: matches!(c.client_type, ClientType::Query { .. }), + is_streaming: c.is_streaming.unwrap_or(false), } }) .collect::>(); @@ -641,6 +696,57 @@ fn snapshot(con: &data::Connection) -> Event { } } +/// Splits a raw TS command line into its unescaped key/value pairs. +/// +/// Only the first part of a `|`-separated multi-part command is read; none of +/// the stream commands use multiple parts. A flag without `=` becomes an empty +/// string, which is how TeamSpeak treats it too. +fn parse_ts_args(content: &str) -> BTreeMap { + let (_, parser) = CommandParser::new(content.as_bytes()); + let mut args = BTreeMap::new(); + for item in parser { + match item { + CommandItem::Argument(arg) => { + let (Ok(name), Ok(value)) = (str::from_utf8(arg.name()), arg.value().get_str()) + else { + continue; + }; + args.insert(name.to_string(), value.into_owned()); + } + // Stop at the first part boundary. + CommandItem::NextCommand => break, + } + } + args +} + +/// Sends `joinstreamrequest` for a `" [msg]"` argument line. +/// +/// Parameter names and order are as recovered from TS6's `TeamSpeak.dll`; `msg` +/// is written even when empty so the shape matches the native client. +fn send_join_stream_request(con: &mut tsclientlib::Connection, rest: &str, is_remove: bool) { + let mut parts = rest.splitn(3, ' '); + let (Some(id), Some(Ok(clid))) = (parts.next(), parts.next().map(|c| c.parse::())) else { + emit(&Event::Error { message: "Usage: streamjoin [msg]".into() }); + return; + }; + if id.is_empty() { + emit(&Event::Error { message: "Usage: streamjoin [msg]".into() }); + return; + } + let msg = parts.next().unwrap_or(""); + + let mut packet = + OutCommand::new(Direction::C2S, Flags::empty(), PacketType::Command, "joinstreamrequest"); + packet.write_arg("id", &id); + packet.write_arg("clid", &clid); + packet.write_arg("msg", &msg); + packet.write_arg("is_remove", &u8::from(is_remove)); + if let Err(e) = packet.send(con) { + emit(&Event::Error { message: format!("joinstreamrequest failed: {e}") }); + } +} + fn send_server_get_variables(con: &mut tsclientlib::Connection) { let packet = OutCommand::new( Direction::C2S, @@ -1401,6 +1507,150 @@ async fn run(args: Args) -> Result<()> { } Err(e) => emit(&Event::Error { message: e.to_string() }), } + } else if let Some(rest) = l.strip_prefix("streaminfo ") { + // A late joiner only learns *that* someone streams, from + // the client_is_streaming property; the stream id has to + // be pulled per client with this. + match rest.trim().parse::() { + Ok(clid) => { + let mut packet = OutCommand::new( + Direction::C2S, + Flags::empty(), + PacketType::Command, + "requeststreaminfo", + ); + packet.write_arg("clid", &clid); + if let Err(e) = packet.send(&mut con) { + emit(&Event::Error { message: format!("requeststreaminfo failed: {e}") }); + } + } + Err(_) => emit(&Event::Error { + message: format!("Invalid client id: {rest}"), + }), + } + } else if let Some(rest) = l.strip_prefix("streamsetup ") { + // Announce a stream we publish. The id is assigned by the + // server and comes back as notifystreamstarted. + match serde_json::from_str::(rest) { + Ok(s) => { + let mut packet = OutCommand::new( + Direction::C2S, + Flags::empty(), + PacketType::Command, + "setupstream", + ); + packet.write_arg("name", &s.name); + packet.write_arg("type", &s.kind); + packet.write_arg("bitrate", &s.bitrate); + packet.write_arg("accessibility", &s.accessibility); + packet.write_arg("mode", &s.mode); + packet.write_arg("viewer_limit", &s.viewer_limit); + packet.write_arg("audio", &u8::from(s.audio)); + match packet.send_with_result(&mut con) { + Ok(handle) => { + pending_messages.insert(handle, "Start stream".into()); + } + Err(e) => emit(&Event::Error { + message: format!("setupstream failed: {e}"), + }), + } + } + Err(e) => emit(&Event::Error { + message: format!("Invalid streamsetup payload: {e}"), + }), + } + } else if let Some(rest) = l.strip_prefix("streamrespond ") { + // Accept or refuse a viewer. decision=1 carries our SDP offer, + // which is the mirror of how TS6 answered us when we watched. + match serde_json::from_str::(rest) { + Ok(s) => { + let mut packet = OutCommand::new( + Direction::C2S, + Flags::empty(), + PacketType::Command, + "respondjoinstreamrequest", + ); + packet.write_arg("id", &s.id); + packet.write_arg("clid", &s.clid); + packet.write_arg("msg", &s.msg); + packet.write_arg("offer", &s.offer); + packet.write_arg("decision", &s.decision); + match packet.send_with_result(&mut con) { + Ok(handle) => { + pending_messages.insert(handle, "Stream join response".into()); + } + Err(e) => emit(&Event::Error { + message: format!("respondjoinstreamrequest failed: {e}"), + }), + } + } + Err(e) => emit(&Event::Error { + message: format!("Invalid streamrespond payload: {e}"), + }), + } + } else if let Some(rest) = l.strip_prefix("streamstop ") { + // "streamstop [reason]" + let mut parts = rest.splitn(2, ' '); + match parts.next() { + Some(id) if !id.is_empty() => { + let mut packet = OutCommand::new( + Direction::C2S, + Flags::empty(), + PacketType::Command, + "stopstream", + ); + packet.write_arg("id", &id); + packet.write_arg("reason", &parts.next().unwrap_or("")); + if let Err(e) = packet.send(&mut con) { + emit(&Event::Error { message: format!("stopstream failed: {e}") }); + } + } + _ => emit(&Event::Error { + message: "Usage: streamstop [reason]".into(), + }), + } + } else if let Some(rest) = l.strip_prefix("streamjoin ") { + // "streamjoin [msg]" - ask the client + // publishing a TS6 stream to let us in. Its reply is a + // notifyrespondjoinstreamrequest carrying the SDP offer. + send_join_stream_request(&mut con, rest, false); + } else if let Some(rest) = l.strip_prefix("streamleave ") { + // Same command with is_remove=1, which is how TS6 leaves + // a stream it has joined. + send_join_stream_request(&mut con, rest, true); + } else if let Some(rest) = l.strip_prefix("streamsignal ") { + // "streamsignal " - the json is + // the rest of the line, opaque to us. Escaping is done by + // write_arg. + let mut parts = rest.splitn(3, ' '); + match (parts.next(), parts.next().and_then(|c| c.parse::().ok()), parts.next()) { + (Some(id), Some(clid), Some(json)) if !id.is_empty() && !json.is_empty() => { + let mut packet = OutCommand::new( + Direction::C2S, + Flags::empty(), + PacketType::Command, + "streamsignaling", + ); + packet.write_arg("id", &id); + packet.write_arg("clid", &clid); + packet.write_arg("json", &json); + // Not fire-and-forget: a signaling command the server refuses + // (a stale clid, say) is otherwise indistinguishable from a peer + // that simply ignored the payload, and the whole handshake then + // stalls with nothing to look at. + match packet.send_with_result(&mut con) { + Ok(handle) => { + pending_messages.insert(handle, "Stream signaling".into()); + } + Err(e) => emit(&Event::Error { + message: format!("streamsignaling failed: {e}"), + }), + } + } + _ => emit(&Event::Error { + message: "Usage: streamsignal ".into(), + }), + } } else if l == "banlist" { // No typed builder exists for banlist, so this is built as a raw // command; the reply arrives via StreamItem::MessageEvent (see below). @@ -2370,6 +2620,25 @@ async fn run(args: Args) -> Result<()> { } } } + Some(Ok(StreamItem::UnknownCommand { name, content })) => { + // Undeclared commands are invisible everywhere else, so name + // them on stderr - that is the only way to tell "the server + // sent nothing" apart from "we filtered it out". + eprintln!("[unknown-command] {name}"); + // TS6 Stream/Call signaling. Everything else undeclared is + // dropped on purpose - forwarding every unknown command + // would turn this into a firehose, and nothing downstream + // wants it. + // ends_with, not starts_with: the inbound request is + // notifyjoinstreamrequest and the reply + // notifyrespondjoinstreamrequest. Matching only the latter's + // prefix silently dropped every viewer asking to watch *us*, + // which is the whole publishing direction. + if name.starts_with("notifystream") || name.ends_with("joinstreamrequest") + { + emit(&Event::StreamEvent { args: parse_ts_args(&content), name }); + } + } Some(Ok(StreamItem::MessageEvent(msg))) => { // Defense in depth: TeaSpeak/GTS may surface notifyclientpoke as an // unhandled MessageEvent if bookkeeping did not mark it handled. diff --git a/gateway/src/index.ts b/gateway/src/index.ts index 670afa5..f648041 100644 --- a/gateway/src/index.ts +++ b/gateway/src/index.ts @@ -1,4 +1,6 @@ import { createServer, type IncomingMessage, type ServerResponse } from "node:http"; +import { createServer as createSecureServer } from "node:https"; +import { readFileSync } from "node:fs"; import { readFile, appendFile, rename, stat } from "node:fs/promises"; import path from "node:path"; import { fileURLToPath } from "node:url"; @@ -249,7 +251,26 @@ const DEV_HINT = ` { res.end(DEV_HINT); } })(); -}); +}; + +// The frontend derives ws:// or wss:// from the page's own scheme, so the +// WebSocket follows this choice without any further configuration. +const server = tlsOptions + ? createSecureServer(tlsOptions, requestHandler) + : createServer(requestHandler); const wss = new WebSocketServer({ server, path: "/ws" }); @@ -319,7 +346,10 @@ const heartbeatTimer = setInterval(() => { wss.on("close", () => clearInterval(heartbeatTimer)); server.listen(PORT, () => { - console.log(`WebSpeak3 gateway listening on http://localhost:${PORT} (WebSocket at /ws)`); + const scheme = tlsOptions ? "https" : "http"; + console.log( + `WebSpeak3 gateway listening on ${scheme}://localhost:${PORT} (WebSocket at /ws)` + ); if (SERVE_STATIC) { console.log(`Serving static UI from ${WEB_DIST}`); console.log(`Dev tip: use http://localhost:5173/ for live UI; rebuild web/dist after UI changes if you open :${PORT}`); @@ -415,6 +445,61 @@ wss.on("connection", (socket: WebSocket) => { await connection?.sendAudio(msg.pcm); break; } + case "requestStreamInfo": { + const clientId = Number(msg.clientId); + if (Number.isFinite(clientId)) await connection?.requestStreamInfo(clientId); + break; + } + case "joinStream": { + const clientId = Number(msg.clientId); + if (Number.isFinite(clientId)) { + await connection?.joinStream(String(msg.streamId ?? ""), clientId, msg.message ?? ""); + } + break; + } + case "leaveStream": { + const clientId = Number(msg.clientId); + if (Number.isFinite(clientId)) { + await connection?.leaveStream(String(msg.streamId ?? ""), clientId); + } + break; + } + case "streamSignal": { + const clientId = Number(msg.clientId); + if (Number.isFinite(clientId) && msg.payload !== undefined) { + await connection?.sendStreamSignal(String(msg.streamId ?? ""), clientId, msg.payload); + } + break; + } + case "setupStream": { + await connection?.setupStream({ + name: String(msg.name ?? "Stream"), + type: Number(msg.streamType ?? 3), + bitrate: Number(msg.bitrate ?? 1_500_000), + accessibility: Number(msg.accessibility ?? 1), + mode: Number(msg.mode ?? 1), + viewerLimit: Number(msg.viewerLimit ?? 0), + audio: Boolean(msg.audio), + }); + break; + } + case "respondJoinStream": { + const clientId = Number(msg.clientId); + if (Number.isFinite(clientId)) { + await connection?.respondJoinStream( + String(msg.streamId ?? ""), + clientId, + Boolean(msg.accept), + String(msg.offer ?? ""), + String(msg.message ?? ""), + ); + } + break; + } + case "stopStream": { + await connection?.stopStream(String(msg.streamId ?? ""), String(msg.reason ?? "")); + break; + } case "setAway": { await connection?.setAway(msg.away, msg.message ?? ""); break; diff --git a/gateway/src/ts3/connection.ts b/gateway/src/ts3/connection.ts index 9796450..23673b2 100644 --- a/gateway/src/ts3/connection.ts +++ b/gateway/src/ts3/connection.ts @@ -21,6 +21,24 @@ export interface ChannelInfo { hasPassword: boolean; } +/** + * The `setupstream` arguments. TS6 always sends all of them, so none are + * optional here - the defaults live in the caller, not on the wire. + */ +export interface StreamSetupOptions { + name: string; + /** Source kind; a real TS6 screen share sends 3. */ + type: number; + bitrate: number; + /** TS6's Privacy setting: who may join without being asked. */ + accessibility: number; + /** Connection mode - peer-to-peer or via the server's SFU. */ + mode: number; + /** 0 means unlimited. */ + viewerLimit: number; + audio: boolean; +} + export interface ClientInfo { id: number; channel: number; @@ -39,6 +57,8 @@ export interface ClientInfo { hasTalkPower: boolean; /** ServerQuery client; UI may hide these unless enabled per favorite. */ isQuery: boolean; + /** Broadcasting a TS6 Stream/Call. The stream id is fetched separately. */ + isStreaming: boolean; } export interface GroupEntry { @@ -184,7 +204,9 @@ export type Ts3ConnectionEvent = | { type: "fileDownloadData"; cid: number; path: string; data: string } | { type: "fileUploadDone"; cid: number; path: string } | { type: "permList"; scope: PermScope; id1: number; id2: number | null; entries: PermissionOverviewEntry[] } - | { type: "permissionCatalog"; entries: PermissionCatalogEntry[] }; + | { type: "permissionCatalog"; entries: PermissionCatalogEntry[] } + /** TS6 Stream/Call signaling, forwarded verbatim; `args` is already unescaped. */ + | { type: "streamEvent"; name: string; args: Record }; export type ServerType = "teamspeak" | "teaspeak" | "auto"; @@ -255,6 +277,7 @@ export class Ts3Connection { server_groups: number[]; has_talk_power: boolean; is_query?: boolean; + is_streaming?: boolean; } interface RawChannelInfo { @@ -384,7 +407,8 @@ export class Ts3Connection { | { type: "fileDownloadData"; cid: number; path: string; data: string } | { type: "fileUploadDone"; cid: number; path: string } | { type: "permList"; scope: PermScope; id1: number; id2: number | null; entries: PermissionOverviewEntry[] } - | { type: "permissionCatalog"; entries: PermissionCatalogEntry[] }; + | { type: "permissionCatalog"; entries: PermissionCatalogEntry[] } + | { type: "streamEvent"; name: string; args: Record }; if (event.type === "connected") { this.emit({ @@ -428,6 +452,7 @@ export class Ts3Connection { serverGroups: c.server_groups, hasTalkPower: c.has_talk_power, isQuery: Boolean(c.is_query), + isStreaming: Boolean(c.is_streaming), })), ownClientId: event.own_client_id ?? 0, serverMaxClients: event.server_max_clients ?? 0, @@ -774,6 +799,79 @@ export class Ts3Connection { this.child?.stdin.write(`audio ${pcmBase64}\n`); } + /** Pulls a streaming client's stream details; answered with a + * `notifystreaminfo` streamEvent carrying the stream id. */ + async requestStreamInfo(clientId: number): Promise { + this.child?.stdin.write(`streaminfo ${clientId}\n`); + } + + /** Ask the client publishing a TS6 stream to let us watch. The answer comes + * back as a `streamEvent` of type `notifyrespondjoinstreamrequest`, which + * carries the SDP offer. */ + async joinStream(streamId: string, clientId: number, message = ""): Promise { + const id = streamId.replace(/[\s]+/g, ""); + const sanitized = message.replace(/[\r\n]+/g, " ").trim(); + if (id) this.child?.stdin.write(`streamjoin ${id} ${clientId} ${sanitized}\n`); + } + + async leaveStream(streamId: string, clientId: number): Promise { + const id = streamId.replace(/[\s]+/g, ""); + if (id) this.child?.stdin.write(`streamleave ${id} ${clientId}\n`); + } + + /** Relays one signaling payload (SDP answer, ICE candidate) to a stream peer. + * `payload` is passed straight through - the connector only escapes it for + * the TS wire, nobody in this path interprets it. Serializing here rather + * than accepting a string keeps literal newlines out of the line-based + * stdin protocol. */ + async sendStreamSignal(streamId: string, clientId: number, payload: unknown): Promise { + const id = streamId.replace(/[\s]+/g, ""); + if (id) this.child?.stdin.write(`streamsignal ${id} ${clientId} ${JSON.stringify(payload)}\n`); + } + + /** Announces a stream we publish. The server assigns the id and reports it + * back as a `notifystreamstarted` streamEvent naming our own client id. */ + async setupStream(options: StreamSetupOptions): Promise { + const payload = { + name: options.name.replace(/[\r\n]+/g, " ").trim() || "Stream", + type: options.type, + bitrate: options.bitrate, + accessibility: options.accessibility, + mode: options.mode, + viewerLimit: options.viewerLimit, + audio: options.audio, + }; + this.child?.stdin.write(`streamsetup ${JSON.stringify(payload)}\n`); + } + + /** Accepts or refuses a viewer that asked to watch our stream. On accept, + * `offer` is our SDP - the publisher offers, which is the mirror of how a + * TS6 publisher answered us. JSON-encoded because an SDP is multi-line. */ + async respondJoinStream( + streamId: string, + clientId: number, + accept: boolean, + offer = "", + message = "", + ): Promise { + const id = streamId.replace(/[\s]+/g, ""); + if (!id) return; + const payload = { + id, + clid: clientId, + msg: message.replace(/[\r\n]+/g, " ").trim(), + offer, + decision: accept ? 1 : 0, + }; + this.child?.stdin.write(`streamrespond ${JSON.stringify(payload)}\n`); + } + + async stopStream(streamId: string, reason = ""): Promise { + const id = streamId.replace(/[\s]+/g, ""); + const sanitized = reason.replace(/[\r\n]+/g, " ").trim(); + if (id) this.child?.stdin.write(`streamstop ${id} ${sanitized}\n`); + } + async setAway(away: boolean, message: string): Promise { if (away) { const sanitized = message.replace(/[\r\n]+/g, " ").trim(); diff --git a/tsclientlib b/tsclientlib index a879f17..40e7c1a 160000 --- a/tsclientlib +++ b/tsclientlib @@ -1 +1 @@ -Subproject commit a879f17fec733c2175674094ce3eb9b9c968e5e3 +Subproject commit 40e7c1a2aff371ea4f9f75c3675d56c5a4067dac diff --git a/web/src/App.css b/web/src/App.css index f48e6b6..3c69822 100644 --- a/web/src/App.css +++ b/web/src/App.css @@ -26,6 +26,7 @@ --log-bg: #f7f8f9; --log-text: #333; --log-error: #b3261e; + --alpha-badge: #a15c07; display: flex; flex-direction: column; @@ -68,6 +69,7 @@ --log-bg: #202124; --log-text: #c7c9cc; --log-error: #f2867a; + --alpha-badge: #e0a23c; color-scheme: dark; } @@ -97,6 +99,7 @@ --log-bg: oklch(0.17 0.014 258); --log-text: oklch(0.62 0.014 258); --log-error: oklch(0.68 0.16 25); + --alpha-badge: oklch(0.75 0.14 70); color-scheme: dark; font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; } @@ -827,6 +830,7 @@ --log-bg: oklch(0.155 0.018 290); --log-text: oklch(0.64 0.014 290); --log-error: oklch(0.68 0.16 25); + --alpha-badge: oklch(0.75 0.14 70); color-scheme: dark; font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; } @@ -1409,6 +1413,206 @@ background: var(--border-soft); } +/* Floating viewer for a TS6 Stream/Call broadcast. */ +.ts-stream-panel { + display: flex; + flex-direction: column; + width: min(480px, calc(100vw - 2rem)); + background: var(--bg-toolbar-1); + border: 1px solid var(--border); + border-radius: 6px; + box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4); + overflow: hidden; +} + +.ts-stream-panel-header { + display: flex; + align-items: center; + gap: 0.5rem; + padding: 0.35rem 0.5rem; + border-bottom: 1px solid var(--border-soft); +} + +.ts-stream-panel-title { + flex: 1; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-weight: 600; +} + +.ts-stream-panel-state { + opacity: 0.7; + font-size: 0.85em; +} + +/* Deliberately loud: the feature speaks an undocumented TS6 protocol, so the + user should never be in doubt that it is experimental. */ +.ts-alpha-badge { + display: inline-block; + padding: 0 0.35em; + border: 1px solid var(--alpha-badge); + border-radius: 3px; + color: var(--alpha-badge); + font-size: 0.7em; + font-weight: 700; + letter-spacing: 0.06em; + text-transform: uppercase; + vertical-align: middle; + white-space: nowrap; +} + +.ts-alpha-note { + margin: 0 0 0.75rem; + padding: 0.5rem 0.6rem; + border-left: 3px solid var(--alpha-badge); + background: var(--log-bg); + color: var(--text-muted); + font-size: 0.85em; + line-height: 1.4; +} + +.ts-stream-panel-close { + padding: 0 0.35rem; + background: none; + border: none; + color: inherit; + cursor: pointer; +} + +.ts-stream-panel video { + width: 100%; + /* Letterbox rather than crop - TS6 screen shares are not always 16:9. */ + aspect-ratio: 16 / 9; + background: #000; + object-fit: contain; +} + +.ts-stream-panel-error { + padding: 0.35rem 0.5rem; + color: var(--danger, #e05a5a); + font-size: 0.85em; +} + +/* TS6's stream dialog, rebuilt: labelled rows with a segmented control on the + right. The segments wrap on narrow screens rather than overflowing. */ +.ts-stream-settings { + width: min(680px, calc(100vw - 2rem)); +} + +.ts-stream-settings-section { + margin: 0.9rem 0 0.4rem; + color: var(--accent); + font-size: 1rem; + font-weight: 600; +} + +.ts-stream-settings-expand { + display: flex; + width: 100%; + justify-content: space-between; + align-items: center; + padding: 0; + background: none; + border: none; + cursor: pointer; + text-align: left; +} + +.ts-stream-settings-row { + display: flex; + gap: 0.75rem; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + padding: 0.35rem 0; +} + +.ts-stream-settings-row > span:first-child { + opacity: 0.85; +} + +.ts-segmented { + display: flex; + flex-wrap: wrap; + gap: 2px; + padding: 2px; + background: var(--bg-toolbar-2, rgba(0, 0, 0, 0.2)); + border: 1px solid var(--border-soft); + border-radius: 999px; +} + +.ts-segmented button { + padding: 0.25rem 0.7rem; + background: none; + border: none; + border-radius: 999px; + color: inherit; + cursor: pointer; + white-space: nowrap; +} + +.ts-segmented button:disabled { + opacity: 0.4; + cursor: not-allowed; +} + +.ts-segmented button.ts-segmented-on { + background: color-mix(in srgb, var(--accent) 25%, transparent); + box-shadow: inset 0 0 0 1px var(--accent); +} + +.ts-stream-settings-stepper { + display: flex; + gap: 0.35rem; + align-items: center; +} + +.ts-stream-settings-stepper input { + width: 5.5rem; + text-align: center; +} + +.ts-stream-settings-stepper button { + width: 1.9rem; + border-radius: 999px; +} + +.ts-stream-settings-unit { + opacity: 0.7; +} + +.ts-stream-settings-toggle input { + width: 2.4rem; + height: 1.3rem; +} + +.ts-stream-settings-go { + border-radius: 999px; + background: var(--accent); + color: #fff; + padding-inline: 1.2rem; +} + +.ts-stream-panel-publish { + border-color: var(--accent); +} + +/* Watching and broadcasting can run at the same time, so the two panels stack + instead of each anchoring itself to the same corner. */ +.ts-stream-panels { + position: fixed; + right: 1rem; + bottom: 1rem; + z-index: 29; + display: flex; + flex-direction: column; + gap: 0.5rem; + align-items: flex-end; + max-height: calc(100vh - 2rem); + overflow-y: auto; +} + .ts-context-menu { position: fixed; z-index: 30; @@ -3937,3 +4141,55 @@ min-width: 160px; } } + +/* A join request waiting for a decision. TS6 shows the viewer "waiting for + access" the whole time this is on screen, so it should not be subtle. */ +.ts-stream-request { + display: flex; + align-items: center; + gap: 0.4rem; + padding: 0.45rem 0.55rem; + border-top: 1px solid var(--ts-border, #2a2f3a); + background: var(--ts-accent-soft, rgba(90, 140, 255, 0.12)); + font-size: 0.82rem; +} + +.ts-stream-request-who { + flex: 1; + min-width: 0; + display: flex; + flex-direction: column; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.ts-stream-request-who em { + opacity: 0.7; + font-size: 0.75rem; + font-style: normal; +} + +.ts-stream-request button { + flex: none; + padding: 0.2rem 0.5rem; + border: 1px solid var(--ts-border, #2a2f3a); + border-radius: 4px; + background: var(--ts-surface, #1b1f27); + color: inherit; + cursor: pointer; + font-size: 0.78rem; +} + +.ts-stream-request button:hover { + border-color: var(--ts-accent, #5a8cff); +} + +.ts-stream-request-allow { + background: var(--ts-accent, #5a8cff) !important; + color: #fff; +} + +.ts-stream-request-block { + opacity: 0.65; +} diff --git a/web/src/App.tsx b/web/src/App.tsx index f6e87ce..400d6ad 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -26,6 +26,14 @@ import { pickAudioOutputDevice, } from "./voice"; import { LanguageProvider, useLanguage, useT, type LangPref } from "./i18n"; +import { + StreamAccess, + StreamMode, + StreamPublisher, + type PublishState, + type StreamPublishOptions, +} from "./publish"; +import { StreamViewer, parseStreamInfo, type StreamEvent, type StreamInfo } from "./stream"; import { DEMO_HOST, DEMO_MODE, DemoSocket } from "./demoMode"; import { SOUND_EVENTS, @@ -154,6 +162,20 @@ interface Identity { blob: string | null; } +// randomId() only exists in a secure context, so it is missing on a +// plain-http origin - which is exactly how a self-hosted instance is reached +// on a LAN before TLS is set up. It used to throw at module load and leave a +// blank page; these ids are local identifiers, not secrets, so fall back. +function randomId(): string { + if (typeof crypto.randomUUID === "function") return crypto.randomUUID(); + const bytes = new Uint8Array(16); + crypto.getRandomValues(bytes); + bytes[6] = (bytes[6] & 0x0f) | 0x40; + bytes[8] = (bytes[8] & 0x3f) | 0x80; + const hex = [...bytes].map((b) => b.toString(16).padStart(2, "0")).join(""); + return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`; +} + // One-time migration from the old single flat identity key to a list of named // identities (so users can maintain more than one persona), and to seed a // default entry for users who never had one either. Runs once at module load. @@ -161,7 +183,7 @@ interface Identity { if (localStorage.getItem(IDENTITIES_KEY) !== null) return; const legacyBlob = localStorage.getItem(IDENTITY_KEY); const legacyNickname = localStorage.getItem(LAST_NICKNAME_KEY) ?? ""; - const id = crypto.randomUUID(); + const id = randomId(); const identities: Identity[] = [ { id, name: "Standard", nickname: legacyNickname, phoneticName: "", blob: legacyBlob }, ]; @@ -178,7 +200,7 @@ function loadIdentities(): Identity[] { // Backfill fields older saves (before per-identity nickname/phonetic // name existed) don't have. return parsed.map((i) => ({ - id: i.id ?? crypto.randomUUID(), + id: i.id ?? randomId(), name: i.name ?? "Standard", nickname: i.nickname ?? "", phoneticName: i.phoneticName ?? "", @@ -188,7 +210,7 @@ function loadIdentities(): Identity[] { } catch { // fall through } - return [{ id: crypto.randomUUID(), name: "Standard", nickname: "", phoneticName: "", blob: null }]; + return [{ id: randomId(), name: "Standard", nickname: "", phoneticName: "", blob: null }]; } const FAVORITES_KEY = "webspeak3:favorites"; @@ -506,6 +528,8 @@ interface ClientInfo { channelGroup: number; serverGroups: number[]; hasTalkPower: boolean; + /** TS6 Stream/Call broadcast running; absent on servers that don't report it. */ + isStreaming?: boolean; /** ServerQuery client; filtered from the tree unless a favorite enables them. */ isQuery?: boolean; } @@ -705,6 +729,7 @@ function ClientStatusIcons({ client }: { client: ClientInfo }) { 🔒 )} {client.outputMuted && 🔕} + {client.isStreaming && 📺} ); } @@ -1567,6 +1592,292 @@ function ChannelPasswordDialog({ ); } +/** + * Presets from TS6's own stream dialog. Each one fills in the advanced + * fields; "source" keeps the capture's native resolution and "presentation" + * trades frame rate for sharp text, which is what the encoder's content hint + * is for. + */ +const STREAM_PRESETS: Record< + string, + { height: number; fps: number; videoBitrateKbps: number; contentHint: "motion" | "detail" } +> = { + "360": { height: 360, fps: 30, videoBitrateKbps: 1000, contentHint: "motion" }, + "480": { height: 480, fps: 30, videoBitrateKbps: 1500, contentHint: "motion" }, + "720": { height: 720, fps: 30, videoBitrateKbps: 2500, contentHint: "motion" }, + "1080": { height: 1080, fps: 30, videoBitrateKbps: 4000, contentHint: "motion" }, + "1440": { height: 1440, fps: 30, videoBitrateKbps: 6000, contentHint: "motion" }, + source: { height: 0, fps: 60, videoBitrateKbps: 8000, contentHint: "motion" }, + presentation: { height: 0, fps: 5, videoBitrateKbps: 3000, contentHint: "detail" }, +}; + +const RESOLUTION_CHOICES = [360, 480, 720, 1080, 1440, 0]; +const FPS_CHOICES = [5, 30, 60]; +const AUDIO_BITRATE_CHOICES = [64, 96, 128, 192, 256, 320]; + +// Streaming talks to TS6 over a protocol nobody published, so it is marked +// alpha everywhere the user can reach it: the settings dialog, both stream +// panels, and the toolbar button's tooltip. +function AlphaBadge() { + const t = useT(); + return ( + + {t("publish.alpha")} + + ); +} + +function SegmentedChoice({ + value, + options, + onChange, + disabled, +}: { + value: T; + options: { value: T; label: string; title?: string; disabled?: boolean }[]; + onChange: (value: T) => void; + disabled?: boolean; +}) { + return ( +
+ {options.map((option) => ( + + ))} +
+ ); +} + +function StreamSettingsDialog({ + defaultName, + onStart, + onCancel, +}: { + defaultName: string; + onStart: (options: StreamPublishOptions) => void; + onCancel: () => void; +}) { + const t = useT(); + const backdrop = useBackdropDismiss(onCancel); + const [preset, setPreset] = useState("720"); + const [audio, setAudio] = useState(true); + const [accessibility, setAccessibility] = useState(StreamAccess.PUBLIC); + const [advanced, setAdvanced] = useState(false); + const [height, setHeight] = useState(STREAM_PRESETS["720"]!.height); + const [fps, setFps] = useState(STREAM_PRESETS["720"]!.fps); + const [videoBitrateKbps, setVideoBitrateKbps] = useState(STREAM_PRESETS["720"]!.videoBitrateKbps); + const [audioBitrateKbps, setAudioBitrateKbps] = useState(128); + const [viewerLimit, setViewerLimit] = useState(0); + const [mode, setMode] = useState(StreamMode.P2P); + const [contentHint, setContentHint] = useState<"motion" | "detail">("motion"); + + const applyPreset = (key: string) => { + const p = STREAM_PRESETS[key]; + if (!p) return; + setPreset(key); + setHeight(p.height); + setFps(p.fps); + setVideoBitrateKbps(p.videoBitrateKbps); + setContentHint(p.contentHint); + }; + + // Any hand-tuned value means the result is no longer one of the presets, so + // the highlight is dropped rather than left lying about what will be sent. + const custom = (setter: (value: T) => void) => (value: T) => { + setter(value); + setPreset(null); + }; + + const resolutionLabel = (value: number) => (value === 0 ? t("publish.res.source") : String(value)); + + return ( +
+
e.stopPropagation()}> +
+ + {t("publish.dialog.title")} + + +
+
+

{t("publish.alphaNote")}

+

{t("publish.dialog.basic")}

+ +
+ {t("publish.preset")} + ({ value: k, label: k })), + { value: "source", label: t("publish.res.source") }, + { value: "presentation", label: t("publish.preset.presentation") }, + ]} + /> +
+ +
+ {t("publish.audio")} + +
+ +
+ {t("publish.privacy")} + +
+ + + + {advanced && ( + <> +
+ {t("publish.resolution")} + ({ value: v, label: resolutionLabel(v) }))} + /> +
+ +
+ {t("publish.fps")} + ({ value: v, label: String(v) }))} + /> +
+ +
+ {t("publish.bitrate")} +
+ + custom(setVideoBitrateKbps)(Math.max(200, Number(e.target.value) || 200))} + /> + Kbps + +
+
+ +
+ {t("publish.audioBitrate")} + ({ value: v, label: String(v) }))} + /> +
+ +
+ {t("publish.viewerLimit")} +
+ + setViewerLimit(Math.max(0, Number(e.target.value) || 0))} + /> + +
+
+ +
+ {t("publish.mode")} + +
+ + )} +
+
+
+ + +
+
+
+
+ ); +} + function UpdatePrompt() { const t = useT(); const { @@ -1820,7 +2131,7 @@ function FavoritesDialog({ const pendingNewRef = useRef( prefillNew ? { - id: crypto.randomUUID(), + id: randomId(), bookmarkName: prefillNew.host || t("favorites.newFavoriteName"), ...prefillNew, showServerQueryClients: prefillNew.showServerQueryClients === true, @@ -1843,7 +2154,7 @@ function FavoritesDialog({ const handleNewFavorite = () => { const nf: Favorite = { - id: crypto.randomUUID(), + id: randomId(), bookmarkName: t("favorites.newFavoriteName"), nickname: "", host: "", @@ -5355,6 +5666,23 @@ function AppInner() { const [connectError, setConnectError] = useState(null); const [channels, setChannels] = useState([]); const [clients, setClients] = useState([]); + /** Stream metadata per publishing client id, keyed by clid. */ + const [streamInfos, setStreamInfos] = useState>({}); + const [watchedStream, setWatchedStream] = useState(null); + const [streamMedia, setStreamMedia] = useState(null); + const [streamState, setStreamState] = useState("new"); + const [streamError, setStreamError] = useState(null); + const streamViewerRef = useRef(null); + const [publishState, setPublishState] = useState("idle"); + const [publishViewers, setPublishViewers] = useState([]); + const [publishPending, setPublishPending] = useState<[number, string][]>([]); + const [publishError, setPublishError] = useState(null); + const publisherRef = useRef(null); + const publishPreviewRef = useRef(null); + const [streamSettingsOpen, setStreamSettingsOpen] = useState(false); + const streamVideoRef = useRef(null); + /** Clients we already pulled a `notifystreaminfo` for, so we ask only once. */ + const requestedStreamInfoRef = useRef>(new Set()); /** Stable self id from the connector (`own_client_id`); nickname match is fallback only. */ const [ownClientId, setOwnClientId] = useState(null); const [serverName, setServerName] = useState(""); @@ -6228,6 +6556,27 @@ function AppInner() { case "talkers": setTalkers(new Set(data.clients)); break; + case "streamEvent": { + const streamEvent = data as StreamEvent; + if (streamEvent.name === "notifystreaminfo" || streamEvent.name === "notifystreamstarted") { + const info = parseStreamInfo(streamEvent.args); + if (info) setStreamInfos((prev) => ({ ...prev, [info.clientId]: info })); + } + if (streamEvent.name === "notifystreamstopped") { + const clid = Number(streamEvent.args.clid); + if (Number.isFinite(clid)) { + setStreamInfos((prev) => { + if (!(clid in prev)) return prev; + const next = { ...prev }; + delete next[clid]; + return next; + }); + } + } + streamViewerRef.current?.handleEvent(streamEvent); + publisherRef.current?.handleEvent(streamEvent); + break; + } case "poke": { const id = ++pokeIdRef.current; setPokes((prev) => [...prev, { id, from: data.from, message: data.message }]); @@ -6281,6 +6630,17 @@ function AppInner() { appendLog({ text: `Disconnected: ${data.reason}`, kind: "info" }); logClient("info", "Connection", `Disconnected: ${data.reason}`); if (wasConnected) void playSound("disconnect"); + streamViewerRef.current?.close(); + streamViewerRef.current = null; + setWatchedStream(null); + setStreamMedia(null); + setStreamInfos({}); + requestedStreamInfoRef.current.clear(); + publisherRef.current?.stop(); + publisherRef.current = null; + setPublishState("idle"); + setPublishViewers([]); + setPublishPending([]); removeSession(sessionId, { skipSocketClose: true }); break; } @@ -6517,7 +6877,7 @@ function AppInner() { ensureAudioContext(); - const sessionId = crypto.randomUUID(); + const sessionId = randomId(); sessionParamsRef.current.set(sessionId, params); const socket = DEMO_MODE ? new DemoSocket() : new WebSocket(GATEWAY_URL); @@ -7339,7 +7699,7 @@ function AppInner() { const channelNames = channels.filter((c) => whisperChannelIds.has(c.id)).map((c) => c.name); const clientNames = clients.filter((c) => whisperClientIds.has(c.id)).map((c) => c.name); if (channelNames.length === 0 && clientNames.length === 0) return; - setWhisperLists((prev) => [...prev, { id: crypto.randomUUID(), name, channelNames, clientNames }]); + setWhisperLists((prev) => [...prev, { id: randomId(), name, channelNames, clientNames }]); }; const handleActivateWhisperList = (list: WhisperList) => { @@ -7367,7 +7727,7 @@ function AppInner() { const handleAddIdentity = () => { const identity: Identity = { - id: crypto.randomUUID(), + id: randomId(), name: t("identities.newName"), nickname: "", phoneticName: "", @@ -7490,7 +7850,7 @@ function AppInner() { const ini = parseIniIdentity(text); if (ini) { const identity: Identity = { - id: crypto.randomUUID(), + id: randomId(), name: ini.name || file.name.replace(/\.ini$/i, "") || t("identities.newName"), nickname: ini.nickname, phoneticName: ini.phonetic, @@ -7506,12 +7866,127 @@ function AppInner() { return; } const name = file.name.replace(/\.(ts3identity\.)?json$/i, "") || t("identities.newName"); - const identity: Identity = { id: crypto.randomUUID(), name, nickname: "", phoneticName: "", blob: text }; + const identity: Identity = { id: randomId(), name, nickname: "", phoneticName: "", blob: text }; setIdentities((prev) => [...prev, identity]); }; reader.readAsText(file); }; + // --- TS6 Stream/Call ----------------------------------------------------- + // + // A client that was already streaming when we joined announces nothing: TS6 + // only sets the `client_is_streaming` property, and the stream id has to be + // pulled with `requeststreaminfo` (ts6-re findings 6b). So whenever a + // streaming client shows up in the tree, ask once. + useEffect(() => { + const streaming = new Set(clients.filter((c) => c.isStreaming).map((c) => c.id)); + for (const id of streaming) { + if (requestedStreamInfoRef.current.has(id)) continue; + requestedStreamInfoRef.current.add(id); + socketRef.current?.send(JSON.stringify({ type: "requestStreamInfo", clientId: id })); + } + // Forget clients that stopped, so a later stream is looked up again. + for (const id of requestedStreamInfoRef.current) { + if (!streaming.has(id)) requestedStreamInfoRef.current.delete(id); + } + setStreamInfos((prev) => { + const stale = Object.keys(prev).filter((id) => !streaming.has(Number(id))); + if (stale.length === 0) return prev; + const next = { ...prev }; + for (const id of stale) delete next[Number(id)]; + return next; + }); + }, [clients]); + + useEffect(() => { + const video = streamVideoRef.current; + if (video && video.srcObject !== streamMedia) video.srcObject = streamMedia; + }, [streamMedia, watchedStream]); + + useEffect(() => { + // The publisher owns the capture; the preview only mirrors it, so it is + // read off the peer connection's senders rather than kept in state. + const video = publishPreviewRef.current; + if (!video) return; + const media = publisherRef.current?.previewStream ?? null; + if (video.srcObject !== media) video.srcObject = media; + }, [publishState, publishViewers]); + + const handleStopWatchingStream = () => { + // close() sends leaveStream and fires onClosed, which clears the rest. + streamViewerRef.current?.close(); + streamViewerRef.current = null; + setWatchedStream(null); + setStreamMedia(null); + setStreamState("new"); + }; + + const handleWatchStream = (clientId: number) => { + const info = streamInfos[clientId]; + if (!info) return; + handleStopWatchingStream(); + setStreamError(null); + const viewer = new StreamViewer(info.id, info.clientId, { + send: (message) => socketRef.current?.send(JSON.stringify(message)), + onTrack: setStreamMedia, + onStateChange: setStreamState, + onError: setStreamError, + onClosed: () => { + // Also reached when the publisher stops, not just via the close button. + streamViewerRef.current = null; + setWatchedStream(null); + setStreamMedia(null); + }, + }); + streamViewerRef.current = viewer; + setWatchedStream(info); + viewer.join(); + }; + + const handleStopPublishing = () => { + publisherRef.current?.stop(); + publisherRef.current = null; + setPublishState("idle"); + setPublishViewers([]); + setPublishPending([]); + }; + + const handleStreamButton = () => { + if (publisherRef.current) { + handleStopPublishing(); + return; + } + setStreamSettingsOpen(true); + }; + + const publishClientName = (clid: number) => + clients.find((c) => c.id === clid)?.name ?? `#${clid}`; + + const handleStartPublishing = (options: StreamPublishOptions) => { + if (ownClientId === null) return; + setStreamSettingsOpen(false); + setPublishError(null); + const publisher = new StreamPublisher({ + send: (message) => socketRef.current?.send(JSON.stringify(message)), + ownClientId, + onStateChange: (state) => { + setPublishState(state); + // "stopped" is also how the browser's own stop-sharing bar reports in, + // so the ref has to be dropped here and not only in the click handler. + if (state === "stopped" || state === "idle") { + publisherRef.current = null; + setPublishViewers([]); + setPublishPending([]); + } + }, + onViewersChange: setPublishViewers, + onPendingChange: setPublishPending, + onError: setPublishError, + }); + publisherRef.current = publisher; + void publisher.start(options); + }; + const handleShowClientConnectionInfo = (clientId: number, clientName: string) => { setClientConnectionInfoTarget({ id: clientId, name: clientName }); setClientConnectionInfo(null); @@ -8610,6 +9085,21 @@ function AppInner() { onChange={(e) => setVadThreshold(Number(e.target.value))} /> + + + {/* muted: this is our own capture playing back locally */} +