Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PuppeteerScreenRecorder

PuppeteerScreenRecorder class is responsible for managing the video

const screenRecorderOptions = {
 followNewTab: true,
 fps: 25,
}
const savePath = "./test/demo.mp4";
const screenRecorder = new PuppeteerScreenRecorder(page, screenRecorderOptions);
await screenRecorder.start(savePath);
 // some puppeteer action or test
await screenRecorder.stop()

Hierarchy

  • PuppeteerScreenRecorder

Index

Constructors

constructor

  • Parameters

    • page: Page
    • Default value options: {} = {}

    Returns PuppeteerScreenRecorder

Methods

getRecordDuration

  • getRecordDuration(): string
  • method

    getRecordDuration

    description

    return the total duration of the video recorded,

    1. if this method is called before calling the stop method, it would be return the time till it has recorded.
    2. if this method is called after stop method, it would give the total time for recording

    Returns string

    total duration of video

start

  • method

    start

    description

    Start the video capturing session

    example
     const savePath = './test/demo.mp4'; //.mp4 is required
     await recorder.start(savePath);
    

    Parameters

    • savePath: string

      accepts a path string to store the video

    Returns Promise<PuppeteerScreenRecorder>

    PuppeteerScreenRecorder

startStream

  • method

    startStream

    description

    Start the video capturing session in a stream

    example
     const stream = new PassThrough();
     await recorder.startStream(stream);
    

    Parameters

    • stream: Writable

    Returns Promise<PuppeteerScreenRecorder>

stop

  • stop(): Promise<boolean>
  • method

    stop

    description

    stop the video capturing session

    Returns Promise<boolean>

    indicate whether stop is completed correct or not, if true without any error else false.

Generated using TypeDoc