Class: Selenium::DevTools::V85::WebAudio

Inherits:
Object
  • Object
show all
Defined in:
lib/selenium/devtools/v85/web_audio.rb

Constant Summary collapse

EVENTS =
{
  context_created: 'contextCreated',
  context_will_be_destroyed: 'contextWillBeDestroyed',
  context_changed: 'contextChanged',
  audio_listener_created: 'audioListenerCreated',
  audio_listener_will_be_destroyed: 'audioListenerWillBeDestroyed',
  audio_node_created: 'audioNodeCreated',
  audio_node_will_be_destroyed: 'audioNodeWillBeDestroyed',
  audio_param_created: 'audioParamCreated',
  audio_param_will_be_destroyed: 'audioParamWillBeDestroyed',
  nodes_connected: 'nodesConnected',
  nodes_disconnected: 'nodesDisconnected',
  node_param_connected: 'nodeParamConnected',
  node_param_disconnected: 'nodeParamDisconnected',
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(devtools) ⇒ WebAudio

Returns a new instance of WebAudio.



41
42
43
# File 'lib/selenium/devtools/v85/web_audio.rb', line 41

def initialize(devtools)
  @devtools = devtools
end

Instance Method Details

#disableObject



54
55
56
# File 'lib/selenium/devtools/v85/web_audio.rb', line 54

def disable
  @devtools.send_cmd('WebAudio.disable')
end

#enableObject



50
51
52
# File 'lib/selenium/devtools/v85/web_audio.rb', line 50

def enable
  @devtools.send_cmd('WebAudio.enable')
end

#get_realtime_data(context_id:) ⇒ Object



58
59
60
61
# File 'lib/selenium/devtools/v85/web_audio.rb', line 58

def get_realtime_data(context_id:)
  @devtools.send_cmd('WebAudio.getRealtimeData',
                     contextId: context_id)
end

#on(event, &block) ⇒ Object



45
46
47
48
# File 'lib/selenium/devtools/v85/web_audio.rb', line 45

def on(event, &block)
  event = EVENTS[event] if event.is_a?(Symbol)
  @devtools.callbacks["WebAudio.#{event}"] << block
end