[feat] receive remote audio with panel playback and bounded WAV capture

This commit is contained in:
dijunkun
2026-11-06 21:55:58 +08:00
parent 02b10d0d8e
commit 82b8cc11bc
15 changed files with 287 additions and 7 deletions
+13
View File
@@ -61,6 +61,7 @@ interface Session {
displayBatch?: boolean;
mode: string;
desiredControl: boolean;
audioEnabled?: boolean;
recoveryEnabled: boolean;
recoveryAttempts: number;
recoveryAttempt: number;
@@ -317,6 +318,10 @@ export class Sessions {
if (next.status.preview_bitrate_supported) settings.max_bitrate_bps = s.status.preview_bitrate_bps;
await next.native.request("video_settings", settings).catch(() => {});
}
if (s.audioEnabled) {
await next.native.request("audio", { enabled: true });
next.audioEnabled = true;
}
next.recoveryEnabled = true;
next.recoveryAttempts = s.recoveryAttempts;
next.recoveryAttempt = attempt;
@@ -756,6 +761,14 @@ export class Sessions {
}
return record.result;
}
async audio(p: Data, capture: boolean, signal?: AbortSignal): Promise<Data> {
const { session_id, ...args } = p;
const s = this.session(session_id);
const result = await s.native.request(capture ? "audio_capture" : "audio", args,
capture ? (args.duration_ms ?? 3000) + 5000 : 5000, signal);
if (!capture) { s.status = result; s.audioEnabled = args.enabled; }
return result;
}
async videoSettings(p: Data, signal?: AbortSignal): Promise<Data> {
const { session_id, ...args } = p;
const s = this.session(session_id);