Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): agent recordings keep up with the page instead of the encoder #36215

Mergedjuliusmarmingemerged 4 commits intomain fromrefs/pull/36215/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 63 additions and 23 deletions.

x
0 of 3 viewed, 3 left
32 additions and 6 deletionsapps/server/src/preview/ServerBrowser.test.tsModified
View file
@@ -360,12 +360,10 @@
document: { createElement: (tag: string) => (tag === "video" ? video : canvas) },
Path2D: function Path2D() {},
MediaRecorder: FakeMediaRecorder,
- createImageBitmap: async (blob: Blob) => ({
- width: 1280,
- height: 800,
- pixels: await blob.text(),
- close() {},
- }),
+ createImageBitmap: async (blob: Blob) => {
+ await decodeGate?.promise;
+ return { width: 1280, height: 800, pixels: await blob.text(), close() {} };
+ },
atob,
btoa,
Blob,
@@ -386,6 +384,7 @@
const contexts: ReturnType<typeof makeContext>[] = [];
let encoderPageOverride: Page | undefined;
const encoderStreams: Array<{ frameRate: number | undefined; bitsPerSecond: number }> = [];
+let decodeGate: PromiseWithResolvers<void> | null = null;
const contextRequests: Array<{ profileId: string; isolated: boolean }> = [];
let contextGate: PromiseWithResolvers<void> | null = null;
let heldStill: (() => Promise<void>) | null = null;
@@ -571,6 +570,7 @@
contexts.length = 0;
encoderPageOverride = undefined;