Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): reduce dropped frames in agent preview recordings #34131

Closedjuliusmarmingewants to merge 6 commits intomain fromrefs/pull/34131/headopened View on GitHub

Showing 3 changed files with 141 additions and 28 deletions.

x
0 of 3 viewed, 3 left
110 additions and 4 deletionsapps/server/src/preview/ServerBrowser.test.tsModified
View file
@@ -260,27 +260,60 @@
width: 0,
height: 0,
getContext: () => ({ drawImage() {}, fillRect() {} }),
- captureStream: (frameRate?: number) => ({ frameRate, getTracks: () => [] }),
+ captureStream: (frameRate?: number) => ({
+ frameRate,
+ getTracks: () => [],
+ getVideoTracks: () => [{ requestFrame() {} }],
+ }),
+ };
+ const video = {
+ play: async () => {},
+ pause() {},
+ requestVideoFrameCallback: (callback: () => void) => queueMicrotask(callback),
class FakeMediaRecorder {
static isTypeSupported = (type: string) => type === "video/webm";
onstart: (() => void) | null = null;
+ onstop: (() => void) | null = null;
+ ondataavailable: ((event: { data: Blob }) => void) | null = null;
+ state = "inactive";
+ mimeType = "video/webm";
+ readonly stream: { frameRate?: number };
constructor(stream: { frameRate?: number }, options: { videoBitsPerSecond: number }) {
+ this.stream = stream;
encoderStreams.push({
frameRate: stream.frameRate,
bitsPerSecond: options.videoBitsPerSecond,
});