Class: SignalWire::Relay::PlayAction
- Defined in:
- lib/signalwire/relay/action.rb
Overview
Handle for an active play operation.
Instance Attribute Summary
Attributes inherited from Action
#call, #completed, #control_id, #result
Instance Method Summary collapse
-
#initialize(call, control_id) ⇒ PlayAction
constructor
A new instance of PlayAction.
- #pause ⇒ Object
- #resume ⇒ Object
- #stop ⇒ Object
- #volume(vol) ⇒ Object
Methods inherited from Action
#_check_event, #_resolve, #_set_on_completed, #done?, #on_completed, #wait
Constructor Details
#initialize(call, control_id) ⇒ PlayAction
Returns a new instance of PlayAction.
98 99 100 101 |
# File 'lib/signalwire/relay/action.rb', line 98 def initialize(call, control_id) super(call, control_id, EVENT_CALL_PLAY, [PLAY_STATE_FINISHED, PLAY_STATE_ERROR]) end |
Instance Method Details
#pause ⇒ Object
107 108 109 |
# File 'lib/signalwire/relay/action.rb', line 107 def pause @call._execute('play.pause', { 'control_id' => @control_id }) end |
#resume ⇒ Object
111 112 113 |
# File 'lib/signalwire/relay/action.rb', line 111 def resume @call._execute('play.resume', { 'control_id' => @control_id }) end |
#stop ⇒ Object
103 104 105 |
# File 'lib/signalwire/relay/action.rb', line 103 def stop @call._execute('play.stop', { 'control_id' => @control_id }) end |
#volume(vol) ⇒ Object
115 116 117 |
# File 'lib/signalwire/relay/action.rb', line 115 def volume(vol) @call._execute('play.volume', { 'control_id' => @control_id, 'volume' => vol }) end |