chat.convertVoiceToText(options);
Name | Type | Description |
message | Message | Audio message. |
language | String | undefined | Language type, defaults to Chinese-English-Cantonese voice-to-text. Other selectable types: zh (cmn-Hans-CN), Standard Chinese en-US, English yue-Hant-HK, Cantonese ja-JP, Japanese |
Promise
// Most commonly used Chinese-English-Cantonese voice-to-text. The language parameter can be omitted.let promise = chat.convertVoiceToText({ message });promise.then(function(imResponse)) {// Voice-to-text conversion succeeded.const { result } = imResponse.data;}).catch(function(imError) {// Voice-to-text conversion failed.console.warn('convertVoiceToText error:', imError);});
// Japanese voice-to-textlet promise = chat.convertVoiceToText({ message, language: 'ja-JP'});promise.then(function(imResponse)) {// Voice-to-text conversion succeeded.const { result } = imResponse.data;}).catch(function(imError) {// Voice-to-text conversion failed.console.warn('convertVoiceToText error:', imError);});
Was this page helpful?