chat.convertVoiceToText(options);
Name | Type | Description |
message | Message | Audio Message |
language | String | undefined | Language type, defaults to Chinese-English-Cantonese Speech-to-Text. Other selectable types: zh (cmn-Hans-CN), Universal Chinese en-US, English yue-Hant-HK, Cantonese ja-JP, Japanese |
Promise
// Most commonly used Chinese-English-Cantonese Speech-to-Text, the language parameter can be omittedlet promise = chat.convertVoiceToText({ message });promise.then(function(imResponse)) {// Speech-to-Text Conversion Successfulconst { result } = imResponse.data;}).catch(function(imError) {// Speech-to-Text Conversion Failedconsole.warn('convertVoiceToText error:', imError);});
// Japanese Speech-to-Textlet promise = chat.convertVoiceToText({ message, language: 'ja-JP'});promise.then(function(imResponse)) {// Speech-to-Text Conversion Successfulconst { result } = imResponse.data;}).catch(function(imError) {// Speech-to-Text Conversion Failedconsole.warn('convertVoiceToText error:', imError);});
Was this page helpful?