Inject a text-to-speech message

To inject a text-to-speech (TTS) message into channel or local audio, use VivoxService.Instance.TextToSpeechSendMessage(string message, TextToSpeechMessageType messageType). Each method takes a string and a TextToSpeechMessageType argument that specifies the text to synthesize and the destination for where to inject the synthesized text. The Voice property and the State property of the TTSMessage are updated by either function when it successfully completes.

After being injected into the text-to-speech subsystem, the TTS Message reference can later be used to cancel that message. If you do not want to hold on to the message, you can obtain any previously injected messages at a later time while they remain in the VivoxService.Instance.TextToSpeechCancelMessages() collection until the message is canceled or playback ends.

VivoxService.Instance.TextToSpeechSendMessage("Hello All", TextToSpeechMessageType.QueuedLocalPlayback);

If multiple TTS users are in one voice or text channel, then you can prefix the display name of the user who is sending the TTS message. For example, “[Display name] says…”