Sha256: cfbde9e9236fb47ecd432b034001aac2bd8fffd08947b211dc556bb46ced2ee3

Contents?: true

Size: 848 Bytes

Versions: 12

Compression:

Stored size: 848 Bytes

Contents

# encoding: utf-8

module Adhearsion
  class CallController
    module Output
      class AsyncPlayer < AbstractPlayer

        #
        # @yields The output component before executing it
        # @raises [PlaybackError] if (one of) the given argument(s) could not be played
        #
        def output(content, options = {})
          options.merge! :ssml => content.to_s
          component = new_output options
          component.register_event_handler Punchblock::Event::Complete do |event|
            controller.logger.error event if event.reason.is_a?(Punchblock::Event::Complete::Error)
          end
          controller.write_and_await_response component
          component
        rescue Punchblock::ProtocolError => e
          raise PlaybackError, "Async output failed due to #{e.inspect}"
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
adhearsion-2.3.5 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.3.4 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.3.3 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.3.2 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.3.1 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.3.0 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.2.1 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.2.0 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.1.3 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.1.2 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.1.1 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.1.0 lib/adhearsion/call_controller/output/async_player.rb