Class: Aws::Polly::AsyncClient
- Inherits:
-
Seahorse::Client::AsyncBase
- Object
- Seahorse::Client::Base
- Seahorse::Client::AsyncBase
- Aws::Polly::AsyncClient
- Includes:
- AsyncClientStubs
- Defined in:
- gems/aws-sdk-polly/lib/aws-sdk-polly/async_client.rb
Overview
An API async client for Polly. To construct an async client, you need to configure a :region and :credentials.
async_client = Aws::Polly::AsyncClient.new(
region: region_name,
credentials: credentials,
# ...
)
For details on configuring region and credentials see the developer guide.
See #initialize for a full list of supported configuration options.
Instance Attribute Summary
Attributes inherited from Seahorse::Client::AsyncBase
Attributes inherited from Seahorse::Client::Base
API Operations collapse
-
#start_speech_synthesis_stream(params = {}) ⇒ Types::StartSpeechSynthesisStreamOutput
Synthesizes UTF-8 input, plain text, or SSML over a bidirectional streaming connection.
Instance Method Summary collapse
-
#initialize(options) ⇒ AsyncClient
constructor
A new instance of AsyncClient.
Methods included from AsyncClientStubs
Methods included from ClientStubs
#api_requests, #stub_data, #stub_responses
Methods inherited from Seahorse::Client::AsyncBase
#close_connection, #connection_errors, #new_connection, #operation_names
Methods inherited from Seahorse::Client::Base
add_plugin, api, clear_plugins, define, new, #operation_names, plugins, remove_plugin, set_api, set_plugins
Methods included from Seahorse::Client::HandlerBuilder
#handle, #handle_request, #handle_response
Constructor Details
#initialize(options) ⇒ AsyncClient
Returns a new instance of AsyncClient.
411 412 413 414 415 416 |
# File 'gems/aws-sdk-polly/lib/aws-sdk-polly/async_client.rb', line 411 def initialize(*args) unless Kernel.const_defined?("HTTP2") raise "Must include http/2 gem to use AsyncClient instances." end super end |
Instance Method Details
#start_speech_synthesis_stream(params = {}) ⇒ Types::StartSpeechSynthesisStreamOutput
Synthesizes UTF-8 input, plain text, or SSML over a bidirectional streaming connection. Specify synthesis parameters in HTTP/2 headers, send text incrementally as events on the input stream, and receive synthesized audio as it becomes available.
This operation serves as a bidirectional counterpart to
SynthesizeSpeech:
^
To use a custom voice, specify its ID in VoiceId. The voice must be
in active status. If the voice is in pending or failed status,
the request fails with ConflictException. If no custom voice with
the specified ID exists in your account and Region, the request fails
with ResourceNotFoundException. If the custom voice uses a customer
managed key, you need kms:Decrypt permission on the key. If you
disabled the key or scheduled it for deletion, the request fails with
ValidationException. If you don't have permission to use the key,
the request fails with AccessDeniedException. If Amazon Web Services
KMS throttles Amazon Polly's request to use the key, the request
fails with ThrottlingException.
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
# File 'gems/aws-sdk-polly/lib/aws-sdk-polly/async_client.rb', line 636 def start_speech_synthesis_stream(params = {}, = {}, &block) params = params.dup input_event_stream_handler = _event_stream_handler( :input, params.delete(:input_event_stream_handler), EventStreams::StartSpeechSynthesisStreamActionStream ) output_event_stream_handler = _event_stream_handler( :output, params.delete(:output_event_stream_handler) || params.delete(:event_stream_handler), EventStreams::StartSpeechSynthesisStreamEventStream ) yield(output_event_stream_handler) if block_given? req = build_request(:start_speech_synthesis_stream, params) req.context[:input_event_stream_handler] = input_event_stream_handler req.handlers.add(Aws::Binary::EncodeHandler, priority: 55) req.context[:output_event_stream_handler] = output_event_stream_handler req.handlers.add(Aws::Binary::DecodeHandler, priority: 55) req.send_request(, &block) end |