语音转文本 API
Use the speech-to-text API to transcribe voice messages.
阅读时间1 分钟最后更新于 13 天前
Vivox 使用以下语音转文本听录方法。
启用或禁用听录
IVivoxService.SpeechToTextEnableTranscription
使用此方法启用频道内的语音转文本听录功能。此方法采用以下参数:await VivoxService.Instance.SpeechToTextEnableTranscription( _channelName);
ChannelNameIVivoxService.SpeechToTextDisableTranscription
使用此方法禁用频道内的语音转文本听录功能。此方法采用以下参数:await VivoxService.Instance.SpeechToTextDisableTranscription( _channelName);
ChannelNameIVivoxService.IsSpeechToTextEnabled
使用此方法检查在频道内启用还是禁用了听录。此方法采用以下参数:bool isSpeechToTextEnabled = VivoxService.Instance.IsSpeechToTextEnabled(_channelName);
ChannelName听录通知
IVivoxService.SpeechToTextMessageReceived
将此事件处理程序绑定到某个方法以便在添加听录消息时接收通知,也可取消绑定。VivoxService.Instance.SpeechToTextMessageReceived += OnSpeechTotextMessageAdded;VivoxService.Instance.SpeechToTextMessageReceived -= OnSpeechTotextMessageAdded;private void OnSpeechTotextMessageReceived(VivoxMessage message){ // Add your code here. “message” is the new transcribed message // added to the queue.}
设置听录语言
LoginOptions.SpeechToTextLanguages
这是用作音频听录提示的语言列表。默认值为空数组,意味着为loginOptions = loginOptions ?? new LoginOptions();loginOptions.SpeechToTextLanguages = new List<string>{"en", "es", "fr"};
en