Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(preview): remote viewers recover from stalled first captures #25381

Mergedjuliusmarmingemerged 7 commits intomain fromrefs/pull/25381/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 56 additions and 6 deletions.

x
0 of 3 viewed, 3 left
1 addition and 1 deletionapps/mobile/src/features/browser/PreviewStreamWebView.tsxModified
View file
@@ -405,7 +405,7 @@
onPictureInPicture?.(message, message.detail);
return;
case "status":
- clearBootstrapTimer();
+ if (message.status !== "connecting") clearBootstrapTimer();
if (message.status === "error") {
fail(message.detail ?? "Browser stream failed.");
return;
39 additions and 1 deletionapps/server/src/preview/ServerBrowser.test.tsModified
View file
@@ -113,6 +113,7 @@
if (method === "Page.getNavigationHistory") return { currentIndex: 0, entries: [{}] };
if (method === "Page.getLayoutMetrics") return { cssVisualViewport: { pageX: 0, pageY: 0 } };
if (method === "Page.captureScreenshot") {
+ if ((input as { format: string }).format === "jpeg" && heldStill) await heldStill();
// A snapshot sizes its screenshot from the PNG header; viewers get JPEG frames as-is.
return { data: (input as { format: string }).format === "png" ? PNG_HEADER : "ZnJhbWU=" };
@@ -383,6 +384,7 @@
const encoderStreams: Array<{ frameRate: number | undefined; bitsPerSecond: number }> = [];
const contextRequests: Array<{ profileId: string; isolated: boolean }> = [];
let contextGate: PromiseWithResolvers<void> | null = null;
+let heldStill: (() => Promise<void>) | null = null;
let pageCopy = "";
let keyCopy = "";
let focusedFrame: ReturnType<typeof makeFrame> | null = null;