Sha256: 03dbef18ac5084ecabd7be74016cd6005fb73bd38b5a11768f288909c70861dd

Contents?: true

Size: 1011 Bytes

Versions: 3

Compression:

Stored size: 1011 Bytes

Contents

# encoding: utf-8

require 'ruby_speech'

module Adhearsion
  class CallController
    module Output
      class AbstractPlayer

        attr_accessor :controller

        def initialize(controller)
          @controller = controller
        end

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

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

        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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adhearsion-3.0.0.rc1 lib/adhearsion/call_controller/output/abstract_player.rb
adhearsion-3.0.0.beta2 lib/adhearsion/call_controller/output/abstract_player.rb
adhearsion-3.0.0.beta1 lib/adhearsion/call_controller/output/abstract_player.rb