browsingContext.stopScreencast command

The browsingContext.stopScreencast command of the browsingContext module stops the specified screencast recording and returns the path to the recording file.

Syntax

json
{
  "method": "browsingContext.stopScreencast",
  "params": {
    "screencast": "d746584f-4744-4cb5-aabd-f059ab65144d"
  }
}

Parameters

The params field contains:

screencast

A string that contains the ID of the recording to stop. Recording IDs are returned by the browsingContext.startScreencast command.

Return value

The result object in the response contains the following fields:

error Optional

A string that describes the error when writing the recorded data to a file. The wording of the error message is browser-dependent. This field is included only when a write failure occurs.

path

A string that contains the file path where the browser saves the recording. This is the same path returned by browsingContext.startScreencast.

Errors

invalid argument

Thrown if a required parameter is missing or has an invalid type.

no such screencast

Thrown if no recording with the specified screencast ID is found. Using the ID of a recording previously stopped with this command throws this same error.

Description

When the client sends browsingContext.stopScreencast for an active recording, the browser stops capturing and writes any remaining encoded data to the file identified by path before sending the command response.

If the browser fails to write data to the file while the recording is in progress, it stops recording automatically. When the client subsequently sends browsingContext.stopScreencast, the browser returns a success response containing both the file path and an error description in the result object.

The browser does not delete the recording file. The client is responsible for removing the file when it is no longer needed, provided it has the necessary filesystem access.

Examples

Stopping a recording

Assume you have a WebDriver BiDi connection and an active session.

Suppose you started a recording using the browsingContext.startScreencast command. The browser returned a recording ID in the screencast field. When you are ready to stop recording, send the following message using the returned recording ID:

json
{
  "id": 6,
  "method": "browsingContext.stopScreencast",
  "params": {
    "screencast": "d746584f-4744-4cb5-aabd-f059ab65144d"
  }
}

The browser responds with the recording's file path as follows:

json
{
  "id": 6,
  "type": "success",
  "result": {
    "path": "/home/example/Downloads/screencast-d746584f-4744-4cb5-aabd-f059ab65144d.webm"
  }
}

Specifications

Specification
WebDriver BiDi
# command-browsingContext-stopScreencast

Browser compatibility

See also