;
+}
+
+export function JoinCodeForm({
+ value,
+ onChange,
+ onSubmit,
+ rejectedAttempt = 0,
+ children,
+}: JoinRoomFormProps & { rejectedAttempt?: number; children?: ReactNode }) {
+ const { t, vis } = useCopy();
+ return (
+
+ );
+}
+
+export function JoinPasswordForm({
+ value,
+ onChange,
+ onSubmit,
+ error,
+}: JoinRoomFormProps & { error?: CopyKey | null }) {
+ const { t } = useCopy();
+ return (
+
+ );
+}
diff --git a/src/client/components/living/RoomInviteControls.tsx b/src/client/components/living/RoomInviteControls.tsx
new file mode 100644
index 000000000..c57d7d963
--- /dev/null
+++ b/src/client/components/living/RoomInviteControls.tsx
@@ -0,0 +1,60 @@
+import { InviteQrCode } from "./InviteQrCode";
+import { Btn, SwitchItem } from "./primitives";
+import { Tooltip } from "./Tooltip";
+import { Glyph } from "../../ui/icons";
+import { useCopy } from "../../ui/copy";
+
+type InviteState = {
+ roomLink: string | null | undefined;
+ roomLinkBlocked: boolean;
+ roomMutating: boolean;
+ includeInviteCredential: boolean;
+};
+
+export function CopyRoomInvite({ roomLink, roomLinkBlocked, roomMutating,
+ includeInviteCredential, copied, onCopy }: InviteState & { copied: boolean; onCopy: () => void }) {
+ return (
+
+ );
+}
+
+export function RoomInviteField({ roomLink, roomLinkBlocked, roomMutating,
+ includeInviteCredential, onCredentialChange }: InviteState & { onCredentialChange: (checked: boolean) => void }) {
+ const { t } = useCopy();
+ return (
+
+
+ {roomLink ? (
+
+ event.currentTarget.select()}
+ />
+
+ ) : null}
+
+
+
+
+
+ );
+}
diff --git a/src/client/pages/ControlsPreview.tsx b/src/client/pages/ControlsPreview.tsx
index 07fb1404b..7ce8487a3 100644
--- a/src/client/pages/ControlsPreview.tsx
+++ b/src/client/pages/ControlsPreview.tsx
@@ -11,7 +11,7 @@ import { RoomInteractions } from "../components/living/RoomInteractions";
import { RoomChatOverlay, RoomChatOverlaySettings, RoomChatToggle } from "../components/living/RoomChatOverlay";
import { REACTION_IDS, type ReactionId } from "../../shared/room-interactions";
import { PlaybackControls } from "../components/living/PlaybackControls";
-import { InviteQrCode } from "../components/living/InviteQrCode";
+import { RoomInviteField } from "../components/living/RoomInviteControls";
import { BrandMark } from "../components/living/BrandMark";
import { SharingSettings } from "../components/living/SharingSettings";
import { ShareMicrophoneSettings } from "../components/living/ShareMicrophoneSettings";
@@ -37,8 +37,8 @@ import { useRoomVoicePreview } from "./RoomVoicePreview";
import { usePreviewInteractions } from "./use-preview-interactions";
import "./controls-preview.css";
-const POSTER = `data:image/svg+xml,${encodeURIComponent(' ')}`;
-const SOURCES = { kind: "ready", processAudio: true, systemAudio: true, processAudioExclusion: true, captureBorderControl: true, sources: [
+export const POSTER = `data:image/svg+xml,${encodeURIComponent(' ')}`;
+export const SOURCES = { kind: "ready", processAudio: true, systemAudio: true, processAudioExclusion: true, captureBorderControl: true, sources: [
{ kind: "window", sourceId: "101", pid: 1, creationTime: "1", title: "Sketchbook" },
{ kind: "window", sourceId: "102", pid: 2, creationTime: "2", title: "A short film" },
{ kind: "window", sourceId: "104", pid: 3, creationTime: "3", title: "Voice call" },
@@ -49,7 +49,7 @@ const CAMERA_PREVIEWS = [
{ id: "usb", label: "USB Camera", preview: `data:image/svg+xml,${encodeURIComponent(' ')}` },
];
const previewCameras: typeof loadCameraPreviews = async (_signal, publish) => publish(CAMERA_PREVIEWS);
-const previewSource = async (source: NativeCaptureTarget) => source.sourceId === "101" ? CAMERA_PREVIEWS[1].preview
+export const previewSource = async (source: NativeCaptureTarget) => source.sourceId === "101" ? CAMERA_PREVIEWS[1].preview
: source.sourceId === "102" ? CAMERA_PREVIEWS[0].preview : POSTER;
const previewApplications = async () => SOURCES.sources;
@@ -248,17 +248,9 @@ export function ControlsPreview() {
- {inviteAvailable &&
-
-
-
-
-
-
-
-
}
+ {inviteAvailable && }
{inviteAvailable && !includeCredential && policy === "private" && !roomPassword ? : null}
{en ? "The website's architecture picker uses the same sliding style with native radio buttons. Arrow keys change the choice."
diff --git a/src/client/pages/GuideJoinControls.tsx b/src/client/pages/GuideJoinControls.tsx
new file mode 100644
index 000000000..b6fc0377b
--- /dev/null
+++ b/src/client/pages/GuideJoinControls.tsx
@@ -0,0 +1,19 @@
+import { useState, type FormEvent } from "react";
+import { JoinCodeForm, JoinPasswordForm } from "../components/living/JoinRoomForms";
+
+export function GuideJoinControls({ password }: { password: boolean }) {
+ const [code, setCode] = useState("9527");
+ const [passwordDraft, setPasswordDraft] = useState("");
+
+ function submit(event: FormEvent) {
+ event.preventDefault();
+ }
+
+ return (
+
+ {password
+ ?
+ : }
+
+ );
+}
diff --git a/src/client/pages/GuidePreviewPage.tsx b/src/client/pages/GuidePreviewPage.tsx
new file mode 100644
index 000000000..538e87569
--- /dev/null
+++ b/src/client/pages/GuidePreviewPage.tsx
@@ -0,0 +1,90 @@
+import { useEffect, useState } from "react";
+import { POSTER, SOURCES, previewSource } from "./ControlsPreview";
+import { RemoteControlsPreview } from "./RemoteControlsPreview";
+import { GuideJoinControls } from "./GuideJoinControls";
+import { GuideViewerRouteFailure, GuideShareFailure, GuideRoomVoice } from "./GuideRoomScenes";
+import { CaptureSourcePicker } from "../components/living/CaptureSourcePicker";
+import { LauncherForm, type AppMode } from "../components/living/LauncherForm";
+import { CopyRoomInvite, RoomInviteField } from "../components/living/RoomInviteControls";
+import { SharingSettings } from "../components/living/SharingSettings";
+import { QualityPresets, PictureSettingsSummary } from "../components/living/QualityPresets";
+import { QUALITY_PROFILES } from "../media/quality";
+import { StageTv } from "../components/living/Stage";
+import { Row, RowGroup } from "../components/living/primitives";
+import { setCopy, useCopy } from "../ui/copy";
+import { applyTheme } from "../ui/theme";
+
+const noop = () => {};
+
+function Launcher({ lan }: { lan: boolean }) {
+ const [mode, setMode] = useState(lan ? "local" : "link");
+ const [address, setAddress] = useState("192.0.2.30");
+ return event.preventDefault()}
+ onSubmit={event => event.preventDefault()} lan={{ selected: address, onChange: setAddress, addresses: [
+ { address: "192.0.2.10", name: "Wi-Fi" },
+ { address: "192.0.2.30", name: "Virtual LAN" },
+ ] }} />
;
+}
+
+function Invite() {
+ const { t } = useCopy();
+ const [includeInviteCredential, setIncludeInviteCredential] = useState(true);
+ const roomLink = "https://piik.example/r/9527" + (includeInviteCredential ? "#v=preview" : "");
+ const state = { roomLink, includeInviteCredential, roomLinkBlocked: false, roomMutating: false };
+ return
+
+ void navigator.clipboard.writeText(roomLink).catch(noop)} />
+
+
+
;
+}
+
+function Sources() {
+ return ;
+}
+
+function Settings() {
+ const [preset, setPreset] = useState("1080p30");
+ return }
+ pictureSummary={ } picture={null} audio={null} />;
+}
+
+function GuideScene({ scene }: { scene: string | null }) {
+ switch (scene) {
+ case "app-modes": return ;
+ case "virtual-lan-address": return ;
+ case "invite-copy":
+ case "invite-qr": return ;
+ case "share-source":
+ case "share-source-confirm": return ;
+ case "sharing-settings": return ;
+ case "room-voice": return ;
+ case "touch-joystick": return ;
+ case "share-failure": return ;
+ case "viewer-route-failure": return ;
+ case "join-code":
+ case "join-password": return ;
+ default: return null;
+ }
+}
+
+export function GuidePreviewPage() {
+ const parameters = new URLSearchParams(location.search);
+ const [ready, setReady] = useState(false);
+ useEffect(() => {
+ setCopy({ lang: parameters.get("lang") === "zh" ? "zh" : "en", vis: false });
+ applyTheme(parameters.get("theme") === "dark" ? "dark" : "light");
+ setReady(true);
+ }, []);
+ if (!ready) return null;
+ const scene = parameters.get("scene");
+ return
+
+ ;
+}
diff --git a/src/client/pages/GuideRoomScenes.tsx b/src/client/pages/GuideRoomScenes.tsx
new file mode 100644
index 000000000..98933717f
--- /dev/null
+++ b/src/client/pages/GuideRoomScenes.tsx
@@ -0,0 +1,41 @@
+import { RoomInteractions } from "../components/living/RoomInteractions";
+import { ShareFailureHelp } from "../components/living/ShareFailureHelp";
+import { StageOverlay } from "../components/living/Stage";
+import { deriveViewerPresentation } from "../media/viewer-presentation";
+import { useCopy } from "../ui/copy";
+import { deriveParticipantStatus, deriveViewerStatus } from "../ui/media-status";
+import { hostFailureChecks } from "./host-page-notices";
+import { useRoomVoicePreview } from "./RoomVoicePreview";
+import { STATUS_SCENARIOS } from "./status-preview-scenarios";
+import { usePreviewInteractions } from "./use-preview-interactions";
+
+export function GuideViewerRouteFailure() {
+ const { t } = useCopy();
+ const { state } = STATUS_SCENARIOS.find(item => item.id === "initial-route-failed")!;
+ const presentation = deriveViewerPresentation(state);
+ const { overlay } = deriveViewerStatus(presentation, state.signal,
+ state.route?.kind === "none" ? null : state.route?.kind);
+ if (!overlay) return null;
+ return
+
+
;
+}
+
+export function GuideShareFailure() {
+ const { t } = useCopy();
+ const code = "app/start-share/rejected";
+ const labelKey = "native.fail.captureStart";
+ return ;
+}
+
+export function GuideRoomVoice() {
+ const { session } = usePreviewInteractions(false);
+ const voice = useRoomVoicePreview(false);
+ return
+
;
+}
diff --git a/src/client/pages/HostPage.tsx b/src/client/pages/HostPage.tsx
index df30a3c24..6499f174f 100644
--- a/src/client/pages/HostPage.tsx
+++ b/src/client/pages/HostPage.tsx
@@ -31,7 +31,7 @@ import { LiveAudioExclusion } from "../components/living/AudioExclusionSelect";
import { RoomInteractions } from "../components/living/RoomInteractions";
import { RoomChatOverlay, RoomChatOverlaySettings, RoomChatToggle } from "../components/living/RoomChatOverlay";
import { PlaybackControls } from "../components/living/PlaybackControls";
-import { InviteQrCode } from "../components/living/InviteQrCode";
+import { CopyRoomInvite, RoomInviteField } from "../components/living/RoomInviteControls";
import { useTheaterMode } from "../components/living/use-theater-mode";
import { useHostPreviewPlayback } from "../components/living/use-host-preview-playback";
import { readRoomPreferences, saveRoomPreferences } from "../lib/room-preferences";
@@ -4573,17 +4573,8 @@ export function HostPage({
{room ? (
- void copyRoomLink()}
- />
+ void copyRoomLink()} />
void changeViewerGrant("revoke")}
/>
-
-
- {roomLink ? (
-
- event.currentTarget.select()}
- />
-
- ) : null}
-
-
- {
- copyRoomLinkRequestRef.current = null;
- setCopiedRoomLink(null);
- setIncludeInviteCredential(checked);
- }} />
-
-
+ {
+ copyRoomLinkRequestRef.current = null;
+ setCopiedRoomLink(null);
+ setIncludeInviteCredential(checked);
+ }} />
{roomLinkBlocked ? : null}
diff --git a/src/client/pages/JoinPage.tsx b/src/client/pages/JoinPage.tsx
index 7bec29462..8d03539e2 100644
--- a/src/client/pages/JoinPage.tsx
+++ b/src/client/pages/JoinPage.tsx
@@ -1,9 +1,7 @@
import { useState, type FormEvent } from "react";
import { AppHeader } from "../components/living/Header";
-import { Tooltip } from "../components/living/Tooltip";
-import { RoomCodeInput, RoomCodeError } from "../components/living/RoomCodeInput";
+import { JoinCodeForm } from "../components/living/JoinRoomForms";
import { HintComic } from "../components/living/hints";
-import { Glyph } from "../ui/icons";
import { useCopy } from "../ui/copy";
import { roomRouteForExplicitEntry } from "../lib/session";
@@ -24,22 +22,16 @@ export function JoinPage() {
window.location.assign(route);
}
- const goButton = (
-
-
-
- );
-
return (
)}
- { setRoomId(value); setRejectedAttempt(0); }} />
-
-
- {goButton}
-
- {vis ? null : {t("join.submit")} }
-
+
);
diff --git a/src/client/pages/PlaybackPreviewPage.tsx b/src/client/pages/PlaybackPreviewPage.tsx
index 8e0b45369..9f23b0af0 100644
--- a/src/client/pages/PlaybackPreviewPage.tsx
+++ b/src/client/pages/PlaybackPreviewPage.tsx
@@ -19,16 +19,23 @@ import { MAX_VIEWERS_PER_ROOM_LIMIT } from "../../shared/protocol";
type PreviewRole = "host" | "viewer";
-export function testMedia(withAudio: boolean, portrait: boolean) {
+export function testMedia(withAudio: boolean, portrait: boolean, poster?: string) {
const canvas = document.createElement("canvas");
canvas.width = portrait ? 480 : 640;
// A 4:3 picture makes contain, crop and stretch visible in the 16:9 player.
canvas.height = portrait ? 640 : 480;
const paint = canvas.getContext("2d")!;
+ const image = poster ? new Image() : undefined;
+ if (image && poster) image.src = poster;
const started = performance.now();
let animation = 0;
function draw(now: number) {
paint.setTransform(canvas.width / 640, 0, 0, canvas.height / 480, 0, 0);
+ if (image) {
+ if (image.complete && image.naturalWidth) paint.drawImage(image, 0, 0, 640, 480);
+ animation = requestAnimationFrame(draw);
+ return;
+ }
const seconds = (now - started) / 1000;
paint.fillStyle = "#172c3b";
paint.fillRect(0, 0, 640, 480);
diff --git a/src/client/pages/RemoteControlsPreview.tsx b/src/client/pages/RemoteControlsPreview.tsx
index e444a78de..e3ea538e6 100644
--- a/src/client/pages/RemoteControlsPreview.tsx
+++ b/src/client/pages/RemoteControlsPreview.tsx
@@ -29,13 +29,14 @@ const participants = [
{ peerId: "preview-gamepad", name: "Player 3" },
];
-export function RemoteControlsPreview({ joystick = false }: { joystick?: boolean }) {
+export function RemoteControlsPreview({ joystick = false, guide = false, guidePoster }: { joystick?: boolean; guide?: boolean; guidePoster?: string }) {
const { lang, t } = useCopy();
const en = lang === "en";
const [platform, setPlatform] = useState("windows");
const [mode, setMode] = useState("off");
const [simultaneous, setSimultaneous] = useState(false);
const [requests, setRequests] = useState<(RemoteControlRequest & { name: string })[]>([]);
+ const [stickMode, setStickMode] = useState<"keyboard" | "gamepad">("keyboard");
const [keyboardOpen, setKeyboardOpen] = useState(false);
const [lastInput, setLastInput] = useState("");
const [axes, setAxes] = useState({ x: 0, y: 0 });
@@ -80,7 +81,7 @@ export function RemoteControlsPreview({ joystick = false }: { joystick?: boolean
placePointer(position);
}, view);
setPointer(current);
- const sample = testMedia(false, false);
+ const sample = testMedia(false, false, guidePoster);
element.srcObject = sample.stream;
void element.play().catch(() => {});
const wheel = (event: WheelEvent) => {
@@ -101,21 +102,21 @@ export function RemoteControlsPreview({ joystick = false }: { joystick?: boolean
element.srcObject = null;
sample.stop();
};
- }, [input, placePointer]);
+ }, [input, placePointer, guidePoster]);
const closeKeyboard = () => {
setKeyboardOpen(false);
document.getElementById("preview-remote-keyboard-toggle")?.focus();
};
return <>{!joystick && }
-
+ {!guide &&
{joystick ? (en ? "Touch joysticks" : "触屏双摇杆") : t("remote.inputTools")}
- {joystick ?
{en ? "Open L and R to try both sticks. Tap the mode switch for WASD movement on the left and mouse movement on the right. Input stays on this page."
- : "点 L、R 可分别展开摇杆。点「手柄 ⇄」切换到键鼠:左杆按 WASD,右杆移动鼠标。输入仅显示在本页。"}
+ {joystick ?
{en ? "Open L and R to try both sticks. Open Remote keyboard and use Stick mode to switch between keys and mouse or gamepad. Input stays on this page."
+ : "点 L、R 可分别展开摇杆。在远程键盘的「摇杆模式」中切换键鼠或手柄。输入仅显示在本页。"}
:
{en ? "Expand the mini mouse and drag its lower half to move the pointer. Hold and move L or R to drag, or hold a button with one finger and move the lower half with another. Pinch or pan the picture with two fingers to adjust the local view. Tap the wheel to middle-click, swipe to scroll, or hold to drag. Try direct touch or the compact trackpad below. Input stays in the local log."
: "展开迷你鼠标,拖动下半部移动光标。按住 L 或 R 后移动即可拖拽,也可用一指按住按钮、另一指拖动下半部。在画面上双指缩放或平移可调整本地视图。滚轮可轻点中击、滑动滚动、长按后拖动。下方可切换直接触摸或光标触控板,输入仅记录在本地。"}
}
-
+
}
pointer?.cancel(event.pointerId)}
onLostPointerCapture={event => pointer?.cancel(event.pointerId)}
onContextMenu={event => event.preventDefault()}>
- {pointer && mouseVideo.current && picturePoint(mouseVideo.current, x, y)} />}
- {joystick ?
+ {!guide && <>{joystick ?
{en ? "Left stick axes" : "左摇杆轴值"}
X {axes.x.toFixed(2)} · Y {axes.y.toFixed(2)}
{t("remote.rightStick")} X {rightAxes.x.toFixed(2)} · Y {rightAxes.y.toFixed(2)}
{t("remote.mouseStick")} X {mouseAxes.x.toFixed(2)} · Y {mouseAxes.y.toFixed(2)}
-
: <>
- }
- {en ? "Host platform" : "房主平台"}
+ {!joystick && {en ? "Host platform" : "房主平台"}
setPlatform(event.target.value as RemoteInputPlatform)}>
Windows macOS Linux
-
+ }
setKeyboardOpen(value => !value)} />
{keyboardOpen && request.state !== "pending").length < 2}
releaseKey={releaseKey} onReleaseKeyChange={setReleaseKey} />}
+ {!joystick && <>
{en ? "Latest input" : "最近一次输入"}
{lastInput || (en ? "Touch the picture directly, or tap the mini mouse for pointer controls." : "直接触摸画面,或轻点迷你鼠标展开光标控制。")}
@@ -195,7 +197,7 @@ export function RemoteControlsPreview({ joystick = false }: { joystick?: boolean
collaboration: Boolean(grant) };
})} />
>}
- >;
+ >}>;
}
function PermissionRequestPreview() {
diff --git a/src/client/pages/ViewerPage.tsx b/src/client/pages/ViewerPage.tsx
index 759888e11..c9a87e617 100644
--- a/src/client/pages/ViewerPage.tsx
+++ b/src/client/pages/ViewerPage.tsx
@@ -9,7 +9,6 @@ import {
import {
DEFAULT_QUALITY_SETTINGS,
DEFAULT_ROUTE_POLICY,
- MAX_VIEWER_PASSWORD_LENGTH,
MAX_VIEWERS_PER_ROOM_LIMIT,
viewerPasswordSchema,
type IceConfig,
@@ -52,6 +51,7 @@ import { RemoteControl } from "../components/living/RemoteControl";
import { InputRoute } from "../remote-control/input-route";
import { useTheaterMode } from "../components/living/use-theater-mode";
import { LoadingStatus } from "../components/living/WaitingStatus";
+import { JoinPasswordForm } from "../components/living/JoinRoomForms";
import {
Btn,
FieldCap,
@@ -2190,37 +2190,15 @@ export function ViewerPage({
/>
{viewerPasswordExpanded ? (
-
+
{
+ setViewerPasswordDraft(value);
+ setViewerPasswordError(null);
+ }}
+ onSubmit={submitViewerPassword}
+ />
) : null}
>
diff --git a/src/client/pages/controls-preview.css b/src/client/pages/controls-preview.css
index de6a5d47b..129cc9005 100644
--- a/src/client/pages/controls-preview.css
+++ b/src/client/pages/controls-preview.css
@@ -55,3 +55,12 @@
.cp-permission-host > p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.cp-permission-caption { color: var(--muted); font-size: 12px; }
@media (max-width: 620px) { .cp-permission-flow { grid-template-columns: 1fr; } }
+
+.cp-guide-stage { min-height: 0; margin: 24px auto; width: min(820px, 100%); padding: 18px; }
+.cp-guide-stage:has([data-guide-capture]) { width: fit-content; max-width: 100%; padding: 0; }
+.cp-guide-stage[data-guide-scene^="share-source"] .lr-tv-screen { min-height: 500px; }
+.cp-guide-stage[data-guide-scene^="share-source"] .lr-source-picker-panel { padding: 14px; }
+.cp-guide-stage[data-guide-scene="touch-joystick"] { width: min(520px, 100%); }
+.cp-guide-stage[data-guide-scene="touch-joystick"] .lr-tv-screen { width: 100%; min-height: 0; }
+
+.cp-guide-invite { width: min(650px, 100%); padding: 14px; }