- since: v1.59
- langs: js
Interface for capturing screencast frames from a page.
- since: v1.59
- argument: <[Object]>
data<[Buffer]> JPEG-encoded frame data.
Emitted for each captured JPEG screencast frame while the screencast is running.
Usage
const screencast = page.screencast;
screencast.on('screencastframe', ({ data, width, height }) => {
console.log(`frame ${width}x${height}, jpeg size: ${data.length}`);
require('fs').writeFileSync('frame.jpg', data);
});
await screencast.start({ maxSize: { width: 1200, height: 800 } });
// ... perform actions ...
await screencast.stop();- since: v1.59
Starts capturing screencast frames. Frames are emitted as [event: Screencast.screencastFrame] events.
Usage
const screencast = page.screencast;
screencast.on('screencastframe', ({ data, width, height }) => {
console.log(`frame ${width}x${height}, size: ${data.length}`);
});
await screencast.start({ maxSize: { width: 800, height: 600 } });
// ... perform actions ...
await screencast.stop();- since: v1.59
maxSize?<[Object]>width<[int]> Max frame width in pixels.height<[int]> Max frame height in pixels.
Maximum screencast frame dimensions. The output frame may be smaller to preserve the page aspect ratio. Defaults to 800×800.
- since: v1.59
Stops the screencast started with [method: Screencast.start].
Usage
await screencast.start();
// ... perform actions ...
await screencast.stop();