Class: Adhearsion::CallController::Output::AbstractPlayer

Inherits:
Object
  • Object
show all
Defined in:
lib/adhearsion/call_controller/output/abstract_player.rb

Direct Known Subclasses

AsyncPlayer, Player

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ AbstractPlayer



12
13
14
# File 'lib/adhearsion/call_controller/output/abstract_player.rb', line 12

def initialize(controller)
  @controller = controller
end

Instance Attribute Details

#controllerObject

Returns the value of attribute controller



10
11
12
# File 'lib/adhearsion/call_controller/output/abstract_player.rb', line 10

def controller
  @controller
end

Instance Method Details

#new_output(options) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/adhearsion/call_controller/output/abstract_player.rb', line 26

def new_output(options)
  defaults = {}

  default_voice = Adhearsion.config.core.media.default_voice
  defaults[:voice] = default_voice if default_voice

  renderer = Adhearsion.config.core.media.default_renderer
  defaults[:renderer] = renderer if renderer

  Adhearsion::Rayo::Component::Output.new defaults.merge(options)
end

#play_ssml(ssml, options = {}) ⇒ Object



16
17
18
19
20
# File 'lib/adhearsion/call_controller/output/abstract_player.rb', line 16

def play_ssml(ssml, options = {})
  if [RubySpeech::SSML::Speak, Nokogiri::XML::Document].include? ssml.class
    output ssml, options
  end
end

#play_url(url, options = {}) ⇒ Object



22
23
24
# File 'lib/adhearsion/call_controller/output/abstract_player.rb', line 22

def play_url(url, options = {})
  output url, options.merge(render_document: {url: url, content_type: "application/ssml+xml"})
end