语音转文本 API
Use the speech-to-text API to transcribe voice messages.
阅读时间1 分钟最后更新于 7 个月前
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"};
这是用作音频听录提示的语言列表。默认值为空数组,意味着为 。可以按偏好顺序指定最多三种口头语言,用于告知所有用户在听录频道中的听录。IETF 语言标签字符串未进行验证,但是应符合 BCP47(RFC Editor)。
en