Skip to main content

browser_protocol/cast/
mod.rs

1//! A domain for interacting with Cast, Presentation API, and Remote Playback API
2//! functionalities.
3
4use serde::{Serialize, Deserialize};
5
6
7#[derive(Debug, Clone, Serialize, Deserialize, Default)]
8#[serde(rename_all = "camelCase")]
9pub struct Sink {
10
11    pub name: String,
12
13    pub id: String,
14    /// Text describing the current session. Present only if there is an active
15    /// session on the sink.
16
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub session: Option<String>,
19}
20
21/// Starts observing for sinks that can be used for tab mirroring, and if set,
22/// sinks compatible with |presentationUrl| as well. When sinks are found, a
23/// |sinksUpdated| event is fired.
24/// Also starts observing for issue messages. When an issue is added or removed,
25/// an |issueUpdated| event is fired.
26
27#[derive(Debug, Clone, Serialize, Deserialize, Default)]
28#[serde(rename_all = "camelCase")]
29pub struct EnableParams {
30
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub presentationUrl: Option<String>,
33}
34
35/// Sets a sink to be used when the web page requests the browser to choose a
36/// sink via Presentation API, Remote Playback API, or Cast SDK.
37
38#[derive(Debug, Clone, Serialize, Deserialize, Default)]
39#[serde(rename_all = "camelCase")]
40pub struct SetSinkToUseParams {
41
42    pub sinkName: String,
43}
44
45/// Starts mirroring the desktop to the sink.
46
47#[derive(Debug, Clone, Serialize, Deserialize, Default)]
48#[serde(rename_all = "camelCase")]
49pub struct StartDesktopMirroringParams {
50
51    pub sinkName: String,
52}
53
54/// Starts mirroring the tab to the sink.
55
56#[derive(Debug, Clone, Serialize, Deserialize, Default)]
57#[serde(rename_all = "camelCase")]
58pub struct StartTabMirroringParams {
59
60    pub sinkName: String,
61}
62
63/// Stops the active Cast session on the sink.
64
65#[derive(Debug, Clone, Serialize, Deserialize, Default)]
66#[serde(rename_all = "camelCase")]
67pub struct StopCastingParams {
68
69    pub sinkName: String,
70}