1// Package cast provides the Chrome DevTools Protocol 2// commands, types, and events for the Cast domain. 3// 4// A domain for interacting with Cast, Presentation API, and Remote Playback 5// API functionalities. 6// 7// Generated by the cdproto-gen command. 8package cast 9 10// Code generated by cdproto-gen. DO NOT EDIT. 11 12import ( 13 "context" 14 15 "github.com/chromedp/cdproto/cdp" 16) 17 18// EnableParams starts observing for sinks that can be used for tab 19// mirroring, and if set, sinks compatible with |presentationUrl| as well. When 20// sinks are found, a |sinksUpdated| event is fired. Also starts observing for 21// issue messages. When an issue is added or removed, an |issueUpdated| event is 22// fired. 23type EnableParams struct { 24 PresentationURL string `json:"presentationUrl,omitempty"` 25} 26 27// Enable starts observing for sinks that can be used for tab mirroring, and 28// if set, sinks compatible with |presentationUrl| as well. When sinks are 29// found, a |sinksUpdated| event is fired. Also starts observing for issue 30// messages. When an issue is added or removed, an |issueUpdated| event is 31// fired. 32// 33// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#method-enable 34// 35// parameters: 36func Enable() *EnableParams { 37 return &EnableParams{} 38} 39 40// WithPresentationURL [no description]. 41func (p EnableParams) WithPresentationURL(presentationURL string) *EnableParams { 42 p.PresentationURL = presentationURL 43 return &p 44} 45 46// Do executes Cast.enable against the provided context. 47func (p *EnableParams) Do(ctx context.Context) (err error) { 48 return cdp.Execute(ctx, CommandEnable, p, nil) 49} 50 51// DisableParams stops observing for sinks and issues. 52type DisableParams struct{} 53 54// Disable stops observing for sinks and issues. 55// 56// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#method-disable 57func Disable() *DisableParams { 58 return &DisableParams{} 59} 60 61// Do executes Cast.disable against the provided context. 62func (p *DisableParams) Do(ctx context.Context) (err error) { 63 return cdp.Execute(ctx, CommandDisable, nil, nil) 64} 65 66// SetSinkToUseParams sets a sink to be used when the web page requests the 67// browser to choose a sink via Presentation API, Remote Playback API, or Cast 68// SDK. 69type SetSinkToUseParams struct { 70 SinkName string `json:"sinkName"` 71} 72 73// SetSinkToUse sets a sink to be used when the web page requests the browser 74// to choose a sink via Presentation API, Remote Playback API, or Cast SDK. 75// 76// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#method-setSinkToUse 77// 78// parameters: 79// sinkName 80func SetSinkToUse(sinkName string) *SetSinkToUseParams { 81 return &SetSinkToUseParams{ 82 SinkName: sinkName, 83 } 84} 85 86// Do executes Cast.setSinkToUse against the provided context. 87func (p *SetSinkToUseParams) Do(ctx context.Context) (err error) { 88 return cdp.Execute(ctx, CommandSetSinkToUse, p, nil) 89} 90 91// StartTabMirroringParams starts mirroring the tab to the sink. 92type StartTabMirroringParams struct { 93 SinkName string `json:"sinkName"` 94} 95 96// StartTabMirroring starts mirroring the tab to the sink. 97// 98// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#method-startTabMirroring 99// 100// parameters: 101// sinkName 102func StartTabMirroring(sinkName string) *StartTabMirroringParams { 103 return &StartTabMirroringParams{ 104 SinkName: sinkName, 105 } 106} 107 108// Do executes Cast.startTabMirroring against the provided context. 109func (p *StartTabMirroringParams) Do(ctx context.Context) (err error) { 110 return cdp.Execute(ctx, CommandStartTabMirroring, p, nil) 111} 112 113// StopCastingParams stops the active Cast session on the sink. 114type StopCastingParams struct { 115 SinkName string `json:"sinkName"` 116} 117 118// StopCasting stops the active Cast session on the sink. 119// 120// See: https://chromedevtools.github.io/devtools-protocol/tot/Cast#method-stopCasting 121// 122// parameters: 123// sinkName 124func StopCasting(sinkName string) *StopCastingParams { 125 return &StopCastingParams{ 126 SinkName: sinkName, 127 } 128} 129 130// Do executes Cast.stopCasting against the provided context. 131func (p *StopCastingParams) Do(ctx context.Context) (err error) { 132 return cdp.Execute(ctx, CommandStopCasting, p, nil) 133} 134 135// Command names. 136const ( 137 CommandEnable = "Cast.enable" 138 CommandDisable = "Cast.disable" 139 CommandSetSinkToUse = "Cast.setSinkToUse" 140 CommandStartTabMirroring = "Cast.startTabMirroring" 141 CommandStopCasting = "Cast.stopCasting" 142) 143