Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Closedjuliusmarmingewants to merge 3 commits intomain fromrefs/pull/34873/headopened 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
@@ -353,12 +353,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,
@@ -378,6 +376,7 @@
​
const contexts: ReturnType<typeof makeContext>[] = [];
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 pageCopy = "";
@@ -561,6 +560,7 @@
beforeEach(() => {
contexts.length = 0;