Sha256: ebe51a9da4efaa59134452aff34469279468ee2edc976f8791f76cf2c9424836

Contents?: true

Size: 865 Bytes

Versions: 3

Compression:

Stored size: 865 Bytes

Contents

# encoding: utf-8

module Adhearsion
  class CallController
    module Output
      class AsyncPlayer < AbstractPlayer

        #
        # @yield The output component before executing it
        # @raise [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 Adhearsion::Event::Complete do |event|
            controller.logger.error event if event.reason.is_a?(Adhearsion::Event::Complete::Error)
            throw :pass
          end
          controller.write_and_await_response component
          component
        rescue Adhearsion::ProtocolError => e
          raise PlaybackError, "Async output failed due to #{e.inspect}"
        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/async_player.rb
adhearsion-3.0.0.beta2 lib/adhearsion/call_controller/output/async_player.rb
adhearsion-3.0.0.beta1 lib/adhearsion/call_controller/output/async_player.rb