fix screen recording: resolve relative paths, buffer chunks, wait for encoder

This commit is contained in:
Tommy D. Rossi
2026-01-29 23:30:01 +01:00
parent db54c35b83
commit a9a40e1183
3 changed files with 69 additions and 3 deletions
+6 -1
View File
@@ -7,6 +7,7 @@
*/
import os from 'node:os'
import path from 'node:path'
import type { Page } from 'playwright-core'
import type {
StartRecordingResult,
@@ -96,10 +97,14 @@ export async function startRecording(options: StartRecordingOptions): Promise<Re
relayPort = 19988,
} = options
// Resolve relative paths to absolute using the caller's cwd.
// The relay server may have a different cwd, so we must resolve here.
const absoluteOutputPath = path.resolve(outputPath)
const response = await fetch(`http://127.0.0.1:${relayPort}/recording/start`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ sessionId, frameRate, videoBitsPerSecond, audioBitsPerSecond, audio, outputPath }),
body: JSON.stringify({ sessionId, frameRate, videoBitsPerSecond, audioBitsPerSecond, audio, outputPath: absoluteOutputPath }),
})
const result = await response.json() as StartRecordingResult