Interface RealtimeTranslationClientEvent.Visitor
-
- All Implemented Interfaces:
public interface RealtimeTranslationClientEvent.Visitor<T extends Object>An interface that defines how to map each variant of RealtimeTranslationClientEvent to a value of type T.
-
-
Method Summary
Modifier and Type Method Description abstract TvisitSessionUpdate(RealtimeTranslationSessionUpdateEvent sessionUpdate)Send this event to update the translation session configuration. abstract TvisitSessionInputAudioBufferAppend(RealtimeTranslationInputAudioBufferAppendEvent sessionInputAudioBufferAppend)Send this event to append audio bytes to the translation session input audio buffer. abstract TvisitSessionClose(RealtimeTranslationSessionCloseEvent sessionClose)Gracefully close the realtime translation session. Tunknown(JsonValue json)Maps an unknown variant of RealtimeTranslationClientEvent to a value of type T. -
-
Method Detail
-
visitSessionUpdate
abstract T visitSessionUpdate(RealtimeTranslationSessionUpdateEvent sessionUpdate)
Send this event to update the translation session configuration. Translation sessions support updates to
audio.output.language,audio.input.transcription, andaudio.input.noise_reduction.
-
visitSessionInputAudioBufferAppend
abstract T visitSessionInputAudioBufferAppend(RealtimeTranslationInputAudioBufferAppendEvent sessionInputAudioBufferAppend)
Send this event to append audio bytes to the translation session input audio buffer.
WebSocket translation sessions accept base64-encoded 24 kHz PCM16 mono little-endian raw audio bytes. Unsupported websocket audio formats return a validation error because lower-quality audio materially degrades translation quality.
Translation consumes 200 ms engine frames. For best realtime behavior, append audio in 200 ms chunks. If a chunk is shorter, the server buffers it until it has enough audio for one frame. If a chunk is longer, the server splits it into 200 ms frames and enqueues them back-to-back.
Keep appending silence while the session is active. If a client stops sending audio and later resumes, model time treats the resumed audio as contiguous with the previous audio rather than as a real-world pause.
-
visitSessionClose
abstract T visitSessionClose(RealtimeTranslationSessionCloseEvent sessionClose)
Gracefully close the realtime translation session. The server flushes pending input audio and emits any remaining translated output before closing the session.
-
unknown
T unknown(JsonValue json)
Maps an unknown variant of RealtimeTranslationClientEvent to a value of type T.
An instance of RealtimeTranslationClientEvent can contain an unknown variant if it was deserialized from data that doesn't match any known variant. For example, if the SDK is on an older version than the API, then the API may respond with new variants that the SDK is unaware of.
-
-
-
-