Important: This is documentation for the legacy version of the Vivox Unity SDK. This documentation will be removed after July 2025. Refer to the v16 documentation for the new version of the SDK.
Queue a text-to-speech message
Some destinations offer a built-in queuing system. When a new message is injected and there is an ongoing message playing, then the new message is put into a queue. After the ongoing message finishes playing, the next message in the queue automatically starts to play.
// Start playing speech as soon as it is synthesized.
myLoginSession.TTS.Messages.Enqueue(new TTSMessage("1st Message.", TTSDestination.QueuedLocalPlayback));
// After the first message finishes playback, this message starts.
myLoginSession.TTS.Messages.Enqueue(new TTSMessage("2nd Message.", TTSDestination.QueuedLocalPlayback));
A queue is shared between TTSDestination.QueuedRemoteTransmission
and TTSDestination.QueuedRemoteTransmissionWithLocalPlayback
. The destination TTSDestination.QueuedLocalPlayback
has its own queue.
A destination queue can hold up to 10 enqueued messages in addition to the message that is actively playing. If a message is added when a destination queue is full, the Vivox SDK discards the message and raises an InvalidOperationException (VxErrorTTSDestinationQueueIsFull)
. In this case, no text-to-speech related events are raised.