vendor/github.com/go-rod/rod/lib/proto/media.go

197 lines · 5674 bytes

  1// This file is generated by "./lib/proto/generate"
  2
  3package proto
  4
  5import (
  6	"github.com/ysmood/gson"
  7)
  8
  9/*
 10
 11Media
 12
 13This domain allows detailed inspection of media elements
 14
 15*/
 16
 17// MediaPlayerID Players will get an ID that is unique within the agent context.
 18type MediaPlayerID string
 19
 20// MediaTimestamp ...
 21type MediaTimestamp float64
 22
 23// MediaPlayerMessageLevel enum.
 24type MediaPlayerMessageLevel string
 25
 26const (
 27	// MediaPlayerMessageLevelError enum const.
 28	MediaPlayerMessageLevelError MediaPlayerMessageLevel = "error"
 29
 30	// MediaPlayerMessageLevelWarning enum const.
 31	MediaPlayerMessageLevelWarning MediaPlayerMessageLevel = "warning"
 32
 33	// MediaPlayerMessageLevelInfo enum const.
 34	MediaPlayerMessageLevelInfo MediaPlayerMessageLevel = "info"
 35
 36	// MediaPlayerMessageLevelDebug enum const.
 37	MediaPlayerMessageLevelDebug MediaPlayerMessageLevel = "debug"
 38)
 39
 40// MediaPlayerMessage Have one type per entry in MediaLogRecord::Type
 41// Corresponds to kMessage.
 42type MediaPlayerMessage struct {
 43	// Level Keep in sync with MediaLogMessageLevel
 44	// We are currently keeping the message level 'error' separate from the
 45	// PlayerError type because right now they represent different things,
 46	// this one being a DVLOG(ERROR) style log message that gets printed
 47	// based on what log level is selected in the UI, and the other is a
 48	// representation of a media::PipelineStatus object. Soon however we're
 49	// going to be moving away from using PipelineStatus for errors and
 50	// introducing a new error type which should hopefully let us integrate
 51	// the error log level into the PlayerError type.
 52	Level MediaPlayerMessageLevel `json:"level"`
 53
 54	// Message ...
 55	Message string `json:"message"`
 56}
 57
 58// MediaPlayerProperty Corresponds to kMediaPropertyChange.
 59type MediaPlayerProperty struct {
 60	// Name ...
 61	Name string `json:"name"`
 62
 63	// Value ...
 64	Value string `json:"value"`
 65}
 66
 67// MediaPlayerEvent Corresponds to kMediaEventTriggered.
 68type MediaPlayerEvent struct {
 69	// Timestamp ...
 70	Timestamp MediaTimestamp `json:"timestamp"`
 71
 72	// Value ...
 73	Value string `json:"value"`
 74}
 75
 76// MediaPlayerErrorSourceLocation Represents logged source line numbers reported in an error.
 77// NOTE: file and line are from chromium c++ implementation code, not js.
 78type MediaPlayerErrorSourceLocation struct {
 79	// File ...
 80	File string `json:"file"`
 81
 82	// Line ...
 83	Line int `json:"line"`
 84}
 85
 86// MediaPlayerError Corresponds to kMediaError.
 87type MediaPlayerError struct {
 88	// ErrorType ...
 89	ErrorType string `json:"errorType"`
 90
 91	// Code is the numeric enum entry for a specific set of error codes, such
 92	// as PipelineStatusCodes in media/base/pipeline_status.h
 93	Code int `json:"code"`
 94
 95	// Stack A trace of where this error was caused / where it passed through.
 96	Stack []*MediaPlayerErrorSourceLocation `json:"stack"`
 97
 98	// Cause Errors potentially have a root cause error, ie, a DecoderError might be
 99	// caused by an WindowsError
100	Cause []*MediaPlayerError `json:"cause"`
101
102	// Data Extra data attached to an error, such as an HRESULT, Video Codec, etc.
103	Data map[string]gson.JSON `json:"data"`
104}
105
106// MediaEnable Enables the Media domain.
107type MediaEnable struct{}
108
109// ProtoReq name.
110func (m MediaEnable) ProtoReq() string { return "Media.enable" }
111
112// Call sends the request.
113func (m MediaEnable) Call(c Client) error {
114	return call(m.ProtoReq(), m, nil, c)
115}
116
117// MediaDisable Disables the Media domain.
118type MediaDisable struct{}
119
120// ProtoReq name.
121func (m MediaDisable) ProtoReq() string { return "Media.disable" }
122
123// Call sends the request.
124func (m MediaDisable) Call(c Client) error {
125	return call(m.ProtoReq(), m, nil, c)
126}
127
128// MediaPlayerPropertiesChanged This can be called multiple times, and can be used to set / override /
129// remove player properties. A null propValue indicates removal.
130type MediaPlayerPropertiesChanged struct {
131	// PlayerID ...
132	PlayerID MediaPlayerID `json:"playerId"`
133
134	// Properties ...
135	Properties []*MediaPlayerProperty `json:"properties"`
136}
137
138// ProtoEvent name.
139func (evt MediaPlayerPropertiesChanged) ProtoEvent() string {
140	return "Media.playerPropertiesChanged"
141}
142
143// MediaPlayerEventsAdded Send events as a list, allowing them to be batched on the browser for less
144// congestion. If batched, events must ALWAYS be in chronological order.
145type MediaPlayerEventsAdded struct {
146	// PlayerID ...
147	PlayerID MediaPlayerID `json:"playerId"`
148
149	// Events ...
150	Events []*MediaPlayerEvent `json:"events"`
151}
152
153// ProtoEvent name.
154func (evt MediaPlayerEventsAdded) ProtoEvent() string {
155	return "Media.playerEventsAdded"
156}
157
158// MediaPlayerMessagesLogged Send a list of any messages that need to be delivered.
159type MediaPlayerMessagesLogged struct {
160	// PlayerID ...
161	PlayerID MediaPlayerID `json:"playerId"`
162
163	// Messages ...
164	Messages []*MediaPlayerMessage `json:"messages"`
165}
166
167// ProtoEvent name.
168func (evt MediaPlayerMessagesLogged) ProtoEvent() string {
169	return "Media.playerMessagesLogged"
170}
171
172// MediaPlayerErrorsRaised Send a list of any errors that need to be delivered.
173type MediaPlayerErrorsRaised struct {
174	// PlayerID ...
175	PlayerID MediaPlayerID `json:"playerId"`
176
177	// Errors ...
178	Errors []*MediaPlayerError `json:"errors"`
179}
180
181// ProtoEvent name.
182func (evt MediaPlayerErrorsRaised) ProtoEvent() string {
183	return "Media.playerErrorsRaised"
184}
185
186// MediaPlayersCreated Called whenever a player is created, or when a new agent joins and receives
187// a list of active players. If an agent is restored, it will receive the full
188// list of player ids and all events again.
189type MediaPlayersCreated struct {
190	// Players ...
191	Players []MediaPlayerID `json:"players"`
192}
193
194// ProtoEvent name.
195func (evt MediaPlayersCreated) ProtoEvent() string {
196	return "Media.playersCreated"
197}