Inject a text-to-speech message
Inject a text-to-speech message into Vivox channels.
Read time 1 minuteLast updated 7 months ago
To inject a text-to-speech (TTS) message into channel or local audio, use . 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.
VivoxService.Instance.TextToSpeechSendMessage(string message, TextToSpeechMessageType messageType)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 collection until the message is canceled or playback ends.
VivoxService.Instance.TextToSpeechCancelMessages()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…”