Sha256: 5f090baccfcd840ae35f69076ee51058c7e9c32b353600b7c2655c88f3a908dc

Contents?: true

Size: 843 Bytes

Versions: 4

Compression:

Stored size: 843 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
          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

4 entries across 4 versions & 1 rubygems

Version Path
adhearsion-2.4.0 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.4.0.beta3 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.4.0.beta2 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-2.4.0.beta1 lib/adhearsion/call_controller/output/async_player.rb