webaudio.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // Package webaudio provides the Chrome DevTools Protocol
  2. // commands, types, and events for the WebAudio domain.
  3. //
  4. // This domain allows inspection of Web Audio API.
  5. // https://webaudio.github.io/web-audio-api/.
  6. //
  7. // Generated by the cdproto-gen command.
  8. package webaudio
  9. // Code generated by cdproto-gen. DO NOT EDIT.
  10. import (
  11. "context"
  12. "github.com/chromedp/cdproto/cdp"
  13. )
  14. // EnableParams enables the WebAudio domain and starts sending context
  15. // lifetime events.
  16. type EnableParams struct{}
  17. // Enable enables the WebAudio domain and starts sending context lifetime
  18. // events.
  19. //
  20. // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#method-enable
  21. func Enable() *EnableParams {
  22. return &EnableParams{}
  23. }
  24. // Do executes WebAudio.enable against the provided context.
  25. func (p *EnableParams) Do(ctx context.Context) (err error) {
  26. return cdp.Execute(ctx, CommandEnable, nil, nil)
  27. }
  28. // DisableParams disables the WebAudio domain.
  29. type DisableParams struct{}
  30. // Disable disables the WebAudio domain.
  31. //
  32. // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#method-disable
  33. func Disable() *DisableParams {
  34. return &DisableParams{}
  35. }
  36. // Do executes WebAudio.disable against the provided context.
  37. func (p *DisableParams) Do(ctx context.Context) (err error) {
  38. return cdp.Execute(ctx, CommandDisable, nil, nil)
  39. }
  40. // GetRealtimeDataParams fetch the realtime data from the registered
  41. // contexts.
  42. type GetRealtimeDataParams struct {
  43. ContextID GraphObjectID `json:"contextId"`
  44. }
  45. // GetRealtimeData fetch the realtime data from the registered contexts.
  46. //
  47. // See: https://chromedevtools.github.io/devtools-protocol/tot/WebAudio#method-getRealtimeData
  48. //
  49. // parameters:
  50. //
  51. // contextID
  52. func GetRealtimeData(contextID GraphObjectID) *GetRealtimeDataParams {
  53. return &GetRealtimeDataParams{
  54. ContextID: contextID,
  55. }
  56. }
  57. // GetRealtimeDataReturns return values.
  58. type GetRealtimeDataReturns struct {
  59. RealtimeData *ContextRealtimeData `json:"realtimeData,omitempty"`
  60. }
  61. // Do executes WebAudio.getRealtimeData against the provided context.
  62. //
  63. // returns:
  64. //
  65. // realtimeData
  66. func (p *GetRealtimeDataParams) Do(ctx context.Context) (realtimeData *ContextRealtimeData, err error) {
  67. // execute
  68. var res GetRealtimeDataReturns
  69. err = cdp.Execute(ctx, CommandGetRealtimeData, p, &res)
  70. if err != nil {
  71. return nil, err
  72. }
  73. return res.RealtimeData, nil
  74. }
  75. // Command names.
  76. const (
  77. CommandEnable = "WebAudio.enable"
  78. CommandDisable = "WebAudio.disable"
  79. CommandGetRealtimeData = "WebAudio.getRealtimeData"
  80. )