Skip to content

fix(api): migrate Screencast from events to onFrame callback - #39714

Merged
Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:screencast-onframe-callback
Mar 18, 2026
Merged

Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:screencast-onframe-callback

Conversation

@pavelfeldman

@pavelfeldman Pavel Feldman (pavelfeldman) commented Mar 17, 2026

Copy link
Copy Markdown
Member

No description provided.

Comment thread docs/src/api/class-screencast.md Outdated

Maximum screencast frame dimensions. The output frame may be smaller to preserve the page aspect ratio. Defaults to 800×800.

### option: Screencast.start.onFrame

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this an option, and not a first argument?

Comment thread docs/src/api/class-screencast.md Outdated
### option: Screencast.start.onFrame
* since: v1.59
* langs: js
- `onFrame` ?<[function]\([Buffer]\)>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To show that it can be async:

Suggested change
- `onFrame` ?<[function]\([Buffer]\)>
- `onFrame` <[function]\([Buffer]\): [Promise<any>|any]>

Comment thread utils/generate_types/overrides.d.ts Outdated
}

export interface Screencast {
start(options?: {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since page.route() does not need an override, I hope this one doesn't need one either.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.


async start(options: { maxSize?: { width: number, height: number } } = {}) {
async start(onFrame: (buffer: Buffer) => any, options: { maxSize?: { width: number, height: number } } = {}): Promise<DisposableStub> {
this._onFrame = onFrame;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw if non-null?

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

5 flaky ⚠️ [chromium-library] › library/trace-viewer.spec.ts:1223 › should display language-specific locators `@ubuntu-22.04-chromium-tip-of-tree`
⚠️ [chromium-library] › library/inspector/recorder-api.spec.ts:120 › should type `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/trace-viewer.spec.ts:1223 › should display language-specific locators `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/trace-viewer.spec.ts:1223 › should display language-specific locators `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`

38809 passed, 845 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [chrome] › mcp/cli-help.spec.ts:19 › prints help by default @mcp-macos-latest

5506 passed, 343 skipped


Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants