tencent cloud

Feedback

V2TXLivePusherObserver

Last updated: 2024-01-16 17:57:14
    Copyright (c) 2021 Tencent. All rights reserved.
    
    Module: V2TXLivePusherObserver @ TXLiteAVSDK
    
    Function: Tencent Cloud live pusher callback notification
    

    Function

    Callback notification for push streaming of Tencent Cloud Live.

    Introduce

    You can receive some push notifications from the V2TXLivePusher pusher, including the connection status of the pusher, callback of the first frame of audio and video, statistical data, warning and error messages, etc.
    
    V2TXLivePusherObserver

    V2TXLivePusherObserver

    FuncList
    DESC
    Live pusher error notification, which is called back when the pusher encounters an error
    Live pusher warning notification
    Callback notification indicating that collection of the first audio frame is complete
    Callback notification indicating that collection of the first video frame is complete
    Microphone-collected volume callback
    Callback notification of the pusher connection status
    Live pusher statistics callback
    Screenshot callback
    Callback of created the OpenGL context in the SDK
    Audio data captured by the local mic, pre-processed by the audio module, effect-processed and BGM-mixed
    Custom video processing callback
    Callback of destroying the OpenGL context in the SDK
    Callback of setting On-Cloud MixTranscoding parameters, which corresponds to the setMixTranscodingConfig API
    The SDK returns this callback when you call startScreenCapture and other APIs to start screen sharing.
    The SDK returns this callback when you call stopScreenCapture to stop screen sharing
    The SDK returns this callback when you call startLocalRecording to start local recording.
    The SDK returns this callback when you call startLocalRecording to start local recording, which means recording task in progress.
    The SDK returns this callback when you call stopLocalRecording to start local recording.

    onError

    onError
    void onError
    (int code
    
    String msg
    
    Bundle extraInfo)

    Live pusher error notification, which is called back when the pusher encounters an error

    Param
    DESC
    code
    Error code V2TXLiveCode.
    extraInfo
    Extended information.
    msg
    Error message.

    onWarning

    onWarning
    void onWarning
    (int code
    
    String msg
    
    Bundle extraInfo)

    Live pusher warning notification

    Param
    DESC
    code
    Warning code V2TXLiveCode.
    extraInfo
    Extended information.
    msg
    Warning message.

    onCaptureFirstAudioFrame

    onCaptureFirstAudioFrame

    Callback notification indicating that collection of the first audio frame is complete

    onCaptureFirstVideoFrame

    onCaptureFirstVideoFrame

    Callback notification indicating that collection of the first video frame is complete

    onMicrophoneVolumeUpdate

    onMicrophoneVolumeUpdate
    void onMicrophoneVolumeUpdate
    (int volume)

    Microphone-collected volume callback

    Param
    DESC
    volume
    Current volume value for collection.
    Note
    This callback notification is received after enableVolumeEvaluation is called.

    onPushStatusUpdate

    onPushStatusUpdate
    void onPushStatusUpdate
    (V2TXLivePushStatus status
    
    String msg
    
    Bundle extraInfo)

    Callback notification of the pusher connection status

    Param
    DESC
    extraInfo
    Extended information.
    msg
    Connection status message.
    status
    Pusher connection status V2TXLivePushStatus .

    onStatisticsUpdate

    onStatisticsUpdate
    void onStatisticsUpdate
    (V2TXLivePusherStatistics statistics)

    Live pusher statistics callback

    Param
    DESC
    statistics
    Pusher statistics V2TXLivePusherStatistics .

    onSnapshotComplete

    onSnapshotComplete
    void onSnapshotComplete
    (Bitmap image)

    Screenshot callback

    Param
    DESC
    image
    Captured video image.
    Note
    This callback notification will be received after calling V2TXLivePusher#snapshot .

    onGLContextCreated

    onGLContextCreated

    Callback of created the OpenGL context in the SDK

    onProcessAudioFrame

    onProcessAudioFrame
    void onProcessAudioFrame
    (V2TXLiveDef.V2TXLiveAudioFrame frame)

    Audio data captured by the local mic, pre-processed by the audio module, effect-processed and BGM-mixed

    After you configure the callback of custom audio processing, the SDK will return via this callback the data captured, pre-processed (ANS, AEC, and AGC), effect-processed and BGM-mixed in PCM format, before it is submitted to the network module for encoding.
    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 TRTC. 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.

    onProcessVideoFrame

    onProcessVideoFrame
    int onProcessVideoFrame
    (V2TXLiveVideoFrame srcFrame
    
    V2TXLiveVideoFrame dstFrame)

    Custom video processing callback

    Param
    DESC
    dstFrame
    For images after processing.
    srcFrame
    For images before processing.
    Note
    You will receive this callback only after you call enableCustomVideoProcess
    to enable custom video processing.
    Case 1: The beauty filter component generates new textures.
    If the beauty filter component you use generates a new texture frame (for the processed image) during image processing, please set dstFrame.textureId to a new texture ID in the callback API.
    @Override
    public void onGLContextCreated() {
    mFURenderer.onSurfaceCreated();
    mFURenderer.setUseTexAsync(true);
    }
    @Override
    public int onProcessVideoFrame(V2TXLiveVideoFrame srcFrame, V2TXLiveVideoFrame dstFrame) {
    dstFrame.texture.textureId = mFURenderer.onDrawFrameSingleInput(
    srcFrame.texture.textureId, srcFrame.width, srcFrame.height);
    return 0;
    }
    @Override
    public void onGLContextDestroyed() {
    mFURenderer.onSurfaceDestroyed();
    }
    Case 2: The third-party beauty filter component doesn’t generate new textures.
    If the third-party beauty filter component you use does not generate new textures and you need to manually set an input texture and an output texture for the component, please consider the following scheme:
    int onProcessVideoFrame(V2TXLiveVideoFrame srcFrame, V2TXLiveVideoFrame dstFrame) {
    thirdparty_process(srcFrame.texture.textureId, srcFrame.width, srcFrame.height, dstFrame.texture.textureId);
    return 0;
    }

    onGLContextDestroyed

    onGLContextDestroyed

    Callback of destroying the OpenGL context in the SDK

    onSetMixTranscodingConfig

    onSetMixTranscodingConfig
    void onSetMixTranscodingConfig
    (int code
    
    String msg)

    Callback of setting On-Cloud MixTranscoding parameters, which corresponds to the {@link setMixTranscodingConfig} API

    Param
    DESC
    code
    0: successful; other values: failed.
    msg
    Error message.

    onScreenCaptureStarted

    onScreenCaptureStarted

    The SDK returns this callback when you call {@link startScreenCapture} and other APIs to start screen sharing.

    onScreenCaptureStopped

    onScreenCaptureStopped
    void onScreenCaptureStopped
    (int reason)

    The SDK returns this callback when you call {@link stopScreenCapture} to stop screen sharing

    Param
    DESC
    Reason
    for stop.
    0 : Screen capture stopped by user.
    1 : On iOS platform means the screen recording is interrupted by the system; Mac, Windows means the screen sharing window is closed.
    2 : On windows platform indicates that the display screen status of screen sharing is changed (such as the interface is pulled out, the projection mode is changed, etc.); other platforms do not throw.

    onLocalRecordBegin

    onLocalRecordBegin
    void onLocalRecordBegin
    (int code
    
    String storagePath)

    The SDK returns this callback when you call {@link startLocalRecording} to start local recording.

    Param
    DESC
    code
    status.
    0: successful.
    -1: failed.
    -2: unsupported format.
    -6: recording has been started. Stop recording first.
    -7: recording file already exists and needs to be deleted.
    -8: recording directory does not have the write permission. Please check the directory permission.
    storagePath
    recording filePath.

    onLocalRecording

    onLocalRecording
    void onLocalRecording
    (long durationMs
    
    String storagePath)

    The SDK returns this callback when you call {@link startLocalRecording} to start local recording, which means recording task in progress.

    Param
    DESC
    durationMs
    recording duration.
    storagePath
    recording filePath.

    onLocalRecordComplete

    onLocalRecordComplete
    void onLocalRecordComplete
    (int code
    
    String storagePath)

    The SDK returns this callback when you call {@link stopLocalRecording} to start local recording.

    Param
    DESC
    code
    status
    0: successful.
    -1: failed.
    -2: Switching resolution or horizontal and vertical screen causes the recording to stop.
    -3: recording duration is too short or no video or audio data is received. Check the recording duration or whether audio or video capture is enabled.
    storagePath
    recording filePath.
    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