Skip to content

[Feature]: Advanced video recording control (MP4 support and Pause/Resume API) #41178

@Sohrab-Malikzada

Description

@Sohrab-Malikzada

🚀 Feature Request

Currently, Playwright supports basic video recording, but it is limited to WebM format and records the entire session from start to finish. I would like to suggest adding native support for the MP4 format and introducing a way to pause and resume video recording during a test session.

Example

Here is a conceptual idea of how the API could look in JavaScript/TypeScript:

// Start recording with MP4 format
const context = await browser.newContext({
  recordVideo: { dir: 'videos/', format: 'mp4' }
});

const page = await context.newPage();

// Pause recording during unnecessary operations
await page.video().pause();
await page.waitForTimeout(5000); 

// Resume when the critical test step starts
await page.video().resume();
await page.click('#submit-order');

Motivation

This feature would be incredibly helpful for:

  1. Saving Storage: Being able to pause recording during long wait times or idle states will significantly reduce file sizes.
  2. Better Compatibility: MP4 is globally supported across all operating systems and presentations without needing external converters.
  3. Clean Reports: It allows developers to record only the critical parts of a test, making debugging videos much shorter and easier to review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions