tencent cloud

Feedback

V2TXLivePremier

Last updated: 2024-01-16 17:57:14
    Copyright (c) 2021 Tencent. All rights reserved.
    
    Module: V2TXLivePremier @ TXLiteAVSDK
    
    Function: V2TXLive High-level interface
    
    V2TXLivePremier

    V2TXLivePremierObserver

    FuncList
    DESC
    Custom Log output callback interface
    setLicence result callback interface
    Raw audio data captured locally
    Data mixed from each channel before being submitted to the system for playback
    In-ear monitoring data

    V2TXLivePremier

    FuncList
    DESC
    Get the SDK version number
    Set V2TXLivePremier callback interface
    Set Log configuration information
    Set up SDK access environment
    Set SDK authorization license
    Set SDK socks5 proxy config
    Enables/Disables audio capture callback
    Enables/Disables audio playout callback
    Enables/Disables in-ear monitoring callback
    Set user id
    Call experimental APIs

    onLog

    onLog
    void onLog
    (int level
    
    String log)

    Custom Log output callback interface

    onLicenceLoaded

    onLicenceLoaded
    void onLicenceLoaded
    (int result
    
    String reason)

    setLicence result callback interface

    Param
    DESC
    reason
    the reason for failure.
    result
    the result of setLicence interface, 0 succeeds, negative number fails.

    onCaptureAudioFrame

    onCaptureAudioFrame
    void onCaptureAudioFrame
    (V2TXLiveDef.V2TXLiveAudioFrame frame)

    Raw audio data captured locally

    Param
    DESC
    frame
    Audio frames in PCM format.
    Note
    1. Please avoid time-consuming operations in this callback function. The SDK processes an audio frame every 20 ms, so if your operation takes more than 20 ms, it will cause audio exceptions.
    2. The audio data returned via this callback can be read and modified, but please keep the duration of your operation short.
    3. The audio data returned via this callback does not include pre-processing effects like background music, audio effects, or reverb, and therefore has a very short delay.

    onPlayoutAudioFrame

    onPlayoutAudioFrame
    void onPlayoutAudioFrame
    (V2TXLiveDef.V2TXLiveAudioFrame frame)

    Data mixed from each channel before being submitted to the system for playback

    After you configure the callback of custom audio processing, the SDK will return to you via this callback the data (PCM format) mixed from each channel before it is submitted to the system for playback.
    The audio data returned via this callback is in PCM format and has a fixed frame length (time) of 0.02s.
    The formula to convert a frame length in seconds to one in bytes is sample rate * frame length in seconds * number of sound channels * audio bit depth.
    Assume that the audio is recorded on a single channel with a sample rate of 48,000 Hz and audio bit depth of 16 bits, which are the default settings of SDK. The frame length in bytes will be 48000 * 0.02s * 1 * 16 bits = 15360 bits = 1920 bytes.
    Param
    DESC
    frame
    Audio frames in PCM format.
    Note
    1. Please avoid time-consuming operations in this callback function. The SDK processes an audio frame every 20 ms, so if your operation takes more than 20 ms, it will cause audio exceptions.
    2. The audio data returned via this callback can be read and modified, but please keep the duration of your operation short.
    3. The audio data returned via this callback is the audio data mixed from each channel before it is played. It does not include the in-ear monitoring data.

    onVoiceEarMonitorAudioFrame

    onVoiceEarMonitorAudioFrame
    void onVoiceEarMonitorAudioFrame
    (V2TXLiveDef.V2TXLiveAudioFrame frame)

    In-ear monitoring data

    After you configure the callback of custom audio processing, the SDK will return to you via this callback the in-ear monitoring data (PCM format) before it is submitted to the system for playback.
    The audio returned is in PCM format and has a not-fixed frame length (time).
    The formula to convert a frame length in seconds to one in bytes is sample rate * frame length in seconds * number of sound channels * audio bit depth.
    Assume that the audio is recorded on a single channel with a sample rate of 48,000 Hz and audio bit depth of 16 bits, which are the default settings of TRTC. The length of 0.02s frame in bytes will be 48000 * 0.02s * 1 * 16 bits = 15360 bits = 1920 bytes.
    Param
    DESC
    frame
    Audio frames in PCM format
    Note
    1. Please avoid time-consuming operations in this callback function, or it will cause audio exceptions.
    2. The audio data returned via this callback can be read and modified, but please keep the duration of your operation short.

    getSDKVersionStr

    getSDKVersionStr

    Get the SDK version number

    setObserver

    setObserver
    void setObserver
    (V2TXLivePremierObserver observer)

    Set V2TXLivePremier callback interface

    setLogConfig

    setLogConfig
    void setLogConfig
    (V2TXLiveDef.V2TXLiveLogConfig config)

    Set Log configuration information

    setEnvironment

    setEnvironment
    void setEnvironment
    (String env)

    Set up SDK access environment

    Param
    DESC
    env
    currently supports two parameters "default" and "GDPR".
    default: In the default environment, the SDK will find the best access point in the world for access.
    GDPR: All audio and video data and quality statistics will not pass through servers in mainland China.
    Note
    If your application has no special requirements, please do not call this interface for setting.

    setLicence

    setLicence
    void setLicence
    (Context context
    
    String url
    
    String key)

    Set SDK authorization license

    
    Try and Purchase a License: https://www.tencentcloud.com/document/product/1071/38546.
    Param
    DESC
    context
    
    key
    the key of licence.
    url
    the url of licence.

    setSocks5Proxy

    setSocks5Proxy
    void setSocks5Proxy
    (String host
    
    int port
    
    String username
    
    String password
    
    V2TXLiveDef.V2TXLiveSocks5ProxyConfig config)

    Set SDK socks5 proxy config

    Param
    DESC
    config
    protocol configured with socks5 proxy.
    host
    socks5 proxy host.
    password
    socks5 proxy password.
    port
    socks5 proxy port.
    username
    socks5 proxy username.

    enableAudioCaptureObserver

    enableAudioCaptureObserver
    void enableAudioCaptureObserver
    (boolean enable
    
    V2TXLiveDef.V2TXLiveAudioFrameObserverFormat format)

    Enables/Disables audio capture callback

    Param
    DESC
    enable
    true : enable; false (default): disable.
    format
    audio frame format.
    Note
    This API works only if you call it before startPush.

    enableAudioPlayoutObserver

    enableAudioPlayoutObserver
    void enableAudioPlayoutObserver
    (boolean enable
    
    V2TXLiveDef.V2TXLiveAudioFrameObserverFormat format)

    Enables/Disables audio playout callback

    Param
    DESC
    enable
    true : enable; false (default): disable.
    format
    audio frame format.

    enableVoiceEarMonitorObserver

    enableVoiceEarMonitorObserver
    void enableVoiceEarMonitorObserver
    (boolean enable)

    Enables/Disables in-ear monitoring callback

    Param
    DESC
    enable
    true : enable; false (default): disable.

    setUserId

    setUserId
    void setUserId
    (String userId)

    Set user id

    Param
    DESC
    userId
    User/device id maintained by the service side itself.

    callExperimentalAPI

    callExperimentalAPI
    int callExperimentalAPI
    (String jsonStr)

    Call experimental APIs

    Param
    DESC
    jsonStr
    JSON string describing interface and parameters.

    Return Desc:

    Return code V2TXLiveCode.
    V2TXLIVE_OK: successful.
    V2TXLIVE_ERROR_INVALID_PARAMETER: operation failed because of illegal parameter.
    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