tencent cloud

Feedback

React Native

Last updated: 2024-11-20 16:10:58

    Description

    The Speech-to-Text feature supports recognizing the VMS you sent successfully or received, converting it into text.
    Note:
    Speech-to-Text is a Value-Added Paid Feature, currently in a free trial phase. You can contact us through the Telegram Technical Support Group to activate the full feature experience.
    Supported by v3.1.3 or later.

    Display Effect

    
    
    

    convertVoiceToText

    The Speech-to-Text interface. Audio format support includes wav, pcm, ogg-opus, speex, silk, mp3, m4a, aac, amr.
    API
    chat.convertVoiceToText(options);
    Parameter
    The options parameter is of the Object type, and contains the following attribute values:
    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
    Returned values
    Promise
    Sample code
    // Most commonly used Chinese-English-Cantonese Speech-to-Text, the language parameter can be omitted
    let promise = chat.convertVoiceToText({ message });
    promise.then(function(imResponse)) {
    // Speech-to-Text Conversion Successful
    const { result } = imResponse.data;
    }).catch(function(imError) {
    // Speech-to-Text Conversion Failed
    console.warn('convertVoiceToText error:', imError);
    });
    // Japanese Speech-to-Text
    let promise = chat.convertVoiceToText({ message, language: 'ja-JP'});
    promise.then(function(imResponse)) {
    // Speech-to-Text Conversion Successful
    const { result } = imResponse.data;
    }).catch(function(imError) {
    // Speech-to-Text Conversion Failed
    console.warn('convertVoiceToText error:', imError);
    });
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support