ConversationTranslator Class
- java.
lang. Object - com.
microsoft. cognitiveservices. speech. transcription. ConversationTranslator
- com.
Implements
public class ConversationTranslator
implements java.lang.AutoCloseable
A conversation translator that enables a connected experience where participants can use their own devices to see everyone else's recognitions and IMs in their own languages. Participants can also speak and send IMs to others. Note: close() must be called in order to release underlying resources held by the object. Added in version 1.12.0
Field Summary
Modifier and Type | Field and Description |
---|---|
final
Event |
canceled
Event that signals an error with the conversation translation, or the end of the audio stream has been reached. |
final
Event |
conversationExpiration
Event that signals how many more minutes are left before the conversation expires. |
final
Event |
participantsChanged
Event that signals participants in the room have changed (e. |
final
Event |
sessionStarted
Event that signals the start of a conversation translation session. |
final
Event |
sessionStopped
Event that signals the end of a conversation translation session. |
final
Event |
textMessageReceived
Event that signals a translated text message from a conversation participant. |
final
Event |
transcribed
Event that signals a final conversation translation result is available for a conversation participant. |
final
Event |
transcribing
Event that signals an intermediate conversation translation result is available for a conversation participant. |
Constructor Summary
Constructor | Description |
---|---|
ConversationTranslator() |
Creates a new instance of the Conversation Translator using the default microphone input. |
ConversationTranslator(AudioConfig audioConfig) |
Creates a new instance of the Conversation Translator. |
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
close()
Dispose of associated resources. |
java.lang.String |
getAuthorizationToken()
Gets the Cognitive Speech authorization token. |
Safe |
getImpl()
Returns the internal conversation translator instance |
Property |
getProperties()
The collection or properties and their values defined for this Conversation |
java.lang.String |
getSpeechRecognitionLanguage()
Gets the language name that is used for recognition. |
java.util.concurrent.Future<java.lang.Void> |
joinConversationAsync(Conversation conversation, String nickname)
Joins an existing conversation. |
java.util.concurrent.Future<java.lang.Void> |
joinConversationAsync(String conversationId, String nickname, String language)
Joins an existing conversation. |
java.util.concurrent.Future<java.lang.Void> |
leaveConversationAsync()
Leave the current conversation. |
java.util.concurrent.Future<java.lang.Void> |
sendTextMessageAsync(String message)
Sends an instant message to all participants in the conversation. |
void |
setAuthorizationToken(String authToken, String region)
Sets the Cognitive Speech authorization token that will be used for connecting to the server. |
java.util.concurrent.Future<java.lang.Void> |
startTranscribingAsync()
Starts sending audio to the conversation service for speech recognition and translation. |
java.util.concurrent.Future<java.lang.Void> |
stopTranscribingAsync()
Stops sending audio to the conversation service. |
Methods inherited from java.lang.Object
Field Details
canceled
public final EventHandlerImpl
Event that signals an error with the conversation translation, or the end of the audio stream has been reached.
conversationExpiration
public final EventHandlerImpl
Event that signals how many more minutes are left before the conversation expires.
participantsChanged
public final EventHandlerImpl
Event that signals participants in the room have changed (e.g. a new participant joined).
sessionStarted
public final EventHandlerImpl
Event that signals the start of a conversation translation session.
sessionStopped
public final EventHandlerImpl
Event that signals the end of a conversation translation session.
textMessageReceived
public final EventHandlerImpl
Event that signals a translated text message from a conversation participant.
transcribed
public final EventHandlerImpl
Event that signals a final conversation translation result is available for a conversation participant.
transcribing
public final EventHandlerImpl
Event that signals an intermediate conversation translation result is available for a conversation participant.
Constructor Details
ConversationTranslator
public ConversationTranslator()
Creates a new instance of the Conversation Translator using the default microphone input.
ConversationTranslator
public ConversationTranslator(AudioConfig audioConfig)
Creates a new instance of the Conversation Translator.
Parameters:
Method Details
close
public void close()
Dispose of associated resources. Note: close() must be called in order to relinquish underlying resources held by the object.
getAuthorizationToken
public String getAuthorizationToken()
Gets the Cognitive Speech authorization token.
Returns:
getImpl
public SafeHandle getImpl()
Returns the internal conversation translator instance
Returns:
getProperties
public PropertyCollection getProperties()
The collection or properties and their values defined for this ConversationTranslator.
Returns:
getSpeechRecognitionLanguage
public String getSpeechRecognitionLanguage()
Gets the language name that is used for recognition.
Returns:
joinConversationAsync
public Future
Joins an existing conversation. You should use this method if you have created a conversation using CreateConversationAsync(SpeechConfig, String).
Parameters:
Returns:
joinConversationAsync
public Future
Joins an existing conversation. You should use this method if you have created a conversation using CreateConversationAsync(SpeechConfig, String).
Parameters:
Returns:
leaveConversationAsync
public Future
Leave the current conversation. After this is called, you will no longer receive any events.
Returns:
sendTextMessageAsync
public Future
Sends an instant message to all participants in the conversation. This instant message will be translated into each participant's text language.
Parameters:
Returns:
setAuthorizationToken
public void setAuthorizationToken(String authToken, String region)
Sets the Cognitive Speech authorization token that will be used for connecting to the server.
Parameters:
startTranscribingAsync
public Future
Starts sending audio to the conversation service for speech recognition and translation. You should subscribe to the Transcribing, and Transcribed events to receive conversation translation results for yourself, and other participants in the conversation.
Returns:
stopTranscribingAsync
public Future
Stops sending audio to the conversation service. You will still receive Transcribing, and Transcribed events for other participants in the conversation.
Returns:
Applies to
Azure SDK for Java