public final class SpokestackTTSClient extends Object
The TTS client communicates with the Spokestack TTS service using simple REST requests, receiving audio URLs that can be played with the Android media player.
Constructor and Description |
---|
SpokestackTTSClient(TTSCallback callback)
Create a new Spokestack TTS client.
|
SpokestackTTSClient(TTSCallback callback,
okhttp3.OkHttpClient client)
Create a new Spokestack TTS client with an API ID and a provided HTTP
client.
|
Modifier and Type | Method and Description |
---|---|
void |
setCredentials(String apiId,
String apiSecret)
Set the API ID used for synthesis requests.
|
void |
setTtsCallback(TTSCallback callback)
Set the callback that should receive TTS responses.
|
void |
setTtsUrl(String url)
Set the URL used to synthesize text.
|
void |
synthesize(SynthesisRequest request)
Synthesize speech via the Spokestack TTS API.
|
public SpokestackTTSClient(TTSCallback callback)
callback
- The callback object used to deliver an audio URL when it
becomes available.public SpokestackTTSClient(TTSCallback callback, okhttp3.OkHttpClient client)
callback
- The callback object used to deliver an audio URL when it
becomes available.client
- The HTTP client to use for requests.public void setTtsCallback(TTSCallback callback)
callback
- The TTS callback.public void setTtsUrl(String url)
url
- The URL to which synthesis requests should be sent.public void setCredentials(String apiId, String apiSecret)
apiId
- The ID used for synthesis requests.apiSecret
- The secret key used to sign synthesis requests.public void synthesize(SynthesisRequest request)
request
- The request object representing the text to be synthesized
and any additional metadata.Copyright © 2021. All rights reserved.