stream: add webcam as a stream source

The stream dialog gets a source choice: screen/window via the browser
picker, or the camera via getUserMedia, announced to TS6 as type=1
(CAMERA). Camera streams send no audio track, since that would be the
microphone a second time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5.5 committed 2026-11-05 11:28:51 +00:00
1 parent 10ae24a99f
commit d299343835
8 files changed
+75 -23

No files matched your search

+30 -8
View File
@@ -2588,17 +2588,18 @@ function SegmentedChoice<T extends string | number>({
}
function StreamSettingsDialog({
defaultName,
ownName,
onStart,
onCancel,
}: {
defaultName: string;
ownName: string;
onStart: (options: StreamPublishOptions) => void;
onCancel: () => void;
}) {
const t = useT();
const backdrop = useBackdropDismiss(onCancel);
const [preset, setPreset] = useState<string | null>("720");
const [source, setSource] = useState<"display" | "camera">("display");
const [audio, setAudio] = useState(true);
const [accessibility, setAccessibility] = useState<number>(StreamAccess.PUBLIC);
const [advanced, setAdvanced] = useState(false);
@@ -2644,6 +2645,18 @@ function StreamSettingsDialog({
<p className="ts-alpha-note">{t("publish.alphaNote")}</p>
<h4 className="ts-stream-settings-section">{t("publish.dialog.basic")}</h4>
<div className="ts-stream-settings-row">
<span>{t("publish.kind")}</span>
<SegmentedChoice
value={source}
onChange={setSource}
options={[
{ value: "display", label: `🖥️ ${t("publish.kind.display")}` },
{ value: "camera", label: `📷 ${t("publish.camera")}` },
]}
/>
</div>
<div className="ts-stream-settings-row">
<span>{t("publish.preset")}</span>
<SegmentedChoice
@@ -2659,8 +2672,16 @@ function StreamSettingsDialog({
<div className="ts-stream-settings-row">
<span>{t("publish.audio")}</span>
<label className="ts-stream-settings-toggle">
<input type="checkbox" checked={audio} onChange={(e) => setAudio(e.target.checked)} />
<label
className="ts-stream-settings-toggle"
title={source === "camera" ? t("publish.audio.cameraHint") : undefined}
>
<input
type="checkbox"
checked={audio && source === "display"}
disabled={source === "camera"}
onChange={(e) => setAudio(e.target.checked)}
/>
<span />
</label>
</div>
@@ -2731,7 +2752,7 @@ function StreamSettingsDialog({
<SegmentedChoice
value={audioBitrateKbps}
onChange={custom(setAudioBitrateKbps)}
disabled={!audio}
disabled={!audio || source === "camera"}
options={AUDIO_BITRATE_CHOICES.map((v) => ({ value: v, label: String(v) }))}
/>
</div>
@@ -2787,8 +2808,9 @@ function StreamSettingsDialog({
className="ts-stream-settings-go"
onClick={() =>
onStart({
name: defaultName,
audio,
name: `${ownName} - ${t(source === "camera" ? "publish.camera" : "publish.screen")}`,
source,
audio: audio && source === "display",
accessibility,
mode,
viewerLimit,
@@ -13976,7 +13998,7 @@ function AppInner() {
{streamSettingsOpen && (
<StreamSettingsDialog
defaultName={`${ownClient?.name ?? "WebSpeak3"} - ${t("publish.screen")}`}
ownName={ownClient?.name ?? "WebSpeak3"}
onStart={handleStartPublishing}
onCancel={() => setStreamSettingsOpen(false)}
/>