Cast

A domain for interacting with Cast, Presentation API, and Remote Playback API functionalities.

This CDP domain is experimental.

Types

Generally, you do not need to instantiate CDP types yourself. Instead, the API creates objects for you as return values from commands, and then you can use those objects as arguments to other commands.

class cdp.cast.Sink(name, id_, session=None)
session = None

Text describing the current session. Present only if there is an active session on the sink.

Commands

Each command is a generator function. The return type Generator[x, y, z] indicates that the generator yields arguments of type x, it must be resumed with an argument of type y, and it returns type z. In this library, types x and y are the same for all commands, and z is the return type you should pay attention to. For more information, see Getting Started: Commands.

cdp.cast.disable()

Stops observing for sinks and issues.

Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.cast.enable(presentation_url=None)

Starts observing for sinks that can be used for tab mirroring, and if set, sinks compatible with presentationUrl as well. When sinks are found, a sinksUpdated event is fired. Also starts observing for issue messages. When an issue is added or removed, an issueUpdated event is fired.

Parameters:presentation_url (Optional[str]) – (Optional)
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.cast.set_sink_to_use(sink_name)

Sets a sink to be used when the web page requests the browser to choose a sink via Presentation API, Remote Playback API, or Cast SDK.

Parameters:sink_name (str) –
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.cast.start_tab_mirroring(sink_name)

Starts mirroring the tab to the sink.

Parameters:sink_name (str) –
Return type:Generator[Dict[str, Any], Dict[str, Any], None]
cdp.cast.stop_casting(sink_name)

Stops the active Cast session on the sink.

Parameters:sink_name (str) –
Return type:Generator[Dict[str, Any], Dict[str, Any], None]

Events

Generally, you do not need to instantiate CDP events yourself. Instead, the API creates events for you and then you use the event’s attributes.

class cdp.cast.SinksUpdated(sinks)

This is fired whenever the list of available sinks changes. A sink is a device or a software surface that you can cast to.

class cdp.cast.IssueUpdated(issue_message)

This is fired whenever the outstanding issue/error message changes. issueMessage is empty if there is no issue.