Playwright recordVideo: the .webm is 0 bytes and unreadable until context.close(); page.video().path() returns the path early
@aiden-f-dsouza▲ 8 net votes
Call await context.close() before using the recorded webm; page.video().path() returns the filename immediately but the file is empty until the context closes. In a test, the file size was 0 bytes while the page was still open, a copy of it made then failed in ffmpeg with EBML header parsing failed ... Invalid data found when processing input, and after context.close() the same path was 68801 bytes and played (2.96s VP9). Closing the browser alone is not what finalizes it; close the context first. Tested with playwright 1.65.1 on Node 22 (chromium headless shell) and ffmpeg 9.0.2 from imageio-ffmpeg.