-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement screencasting (#11084)
- Loading branch information
1 parent
ddbb43c
commit f060d46
Showing
17 changed files
with
830 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
sidebar_label: Page.screencast | ||
--- | ||
|
||
# Page.screencast() method | ||
|
||
Captures a screencast of this [page](./puppeteer.page.md). | ||
|
||
#### Signature: | ||
|
||
```typescript | ||
class Page { | ||
screencast(options?: Readonly<ScreencastOptions>): Promise<ScreenRecorder>; | ||
} | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --------- | --------------------------------------------------------------------- | -------------------------------------------- | | ||
| options | Readonly<[ScreencastOptions](./puppeteer.screencastoptions.md)> | _(Optional)_ Configures screencast behavior. | | ||
|
||
**Returns:** | ||
|
||
Promise<[ScreenRecorder](./puppeteer.screenrecorder.md)> | ||
|
||
## Remarks | ||
|
||
All recordings will be \[WebM\](https://www.webmproject.org/) format using the \[VP9\](https://www.webmproject.org/vp9/) video codec. The FPS is 30. | ||
|
||
You must have \[ffmpeg\](https://ffmpeg.org/) installed on your system. | ||
|
||
## Example | ||
|
||
Recording a [page](./puppeteer.page.md): | ||
|
||
``` | ||
import puppeteer from 'puppeteer'; | ||
// Launch a browser | ||
const browser = await puppeteer.launch(); | ||
// Create a new page | ||
const page = await browser.newPage(); | ||
// Go to your site. | ||
await page.goto("https://www.example.com"); | ||
// Start recording. | ||
const recorder = await page.screencast({path: 'recording.webm'}); | ||
// Do something. | ||
// Stop recording. | ||
await recorder.stop(); | ||
browser.close(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
sidebar_label: ScreencastOptions | ||
--- | ||
|
||
# ScreencastOptions interface | ||
|
||
#### Signature: | ||
|
||
```typescript | ||
export interface ScreencastOptions | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Modifiers | Type | Description | Default | | ||
| ---------- | --------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------- | | ||
| crop | <code>optional</code> | [BoundingBox](./puppeteer.boundingbox.md) | Specifies the region of the viewport to crop. | | | ||
| ffmpegPath | <code>optional</code> | string | <p>Path to the \[ffmpeg\](https://ffmpeg.org/).</p><p>Required if <code>ffmpeg</code> is not in your PATH.</p> | | | ||
| path | <code>optional</code> | \`${string}.webm\` | File path to save the screencast to. | | | ||
| scale | <code>optional</code> | number | <p>Scales the output video.</p><p>For example, <code>0.5</code> will shrink the width and height of the output video by half. <code>2</code> will double the width and height of the output video.</p> | <code>1</code> | | ||
| speed | <code>optional</code> | number | <p>Specifies the speed to record at.</p><p>For example, <code>0.5</code> will slowdown the output video by 50%. <code>2</code> will double the speed of the output video.</p> | <code>1</code> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
sidebar_label: ScreenRecorder | ||
--- | ||
|
||
# ScreenRecorder class | ||
|
||
#### Signature: | ||
|
||
```typescript | ||
export declare class ScreenRecorder extends PassThrough | ||
``` | ||
**Extends:** PassThrough | ||
## Remarks | ||
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `ScreenRecorder` class. | ||
## Methods | ||
| Method | Modifiers | Description | | ||
| -------------------------------------------- | --------- | ------------------- | | ||
| [stop()](./puppeteer.screenrecorder.stop.md) | | Stops the recorder. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
sidebar_label: ScreenRecorder.stop | ||
--- | ||
|
||
# ScreenRecorder.stop() method | ||
|
||
Stops the recorder. | ||
|
||
#### Signature: | ||
|
||
```typescript | ||
class ScreenRecorder { | ||
stop(): Promise<void>; | ||
} | ||
``` | ||
|
||
**Returns:** | ||
|
||
Promise<void> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.