tencent cloud

Feedback

V2TXLivePusherObserver

Last updated: 2024-11-28 17:46:18
    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
    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.
    After calling enableVoiceActivityDetection to turn on voice activity detection, you will receive this callback notification when the anchor starts or stops speaking.

    onError:message:extraInfo:

    onError:message:extraInfo:
    - (void)onError:
    (V2TXLiveCode)code
    message:
    (NSString *)msg
    extraInfo:
    (NSDictionary *)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:message:extraInfo:

    onWarning:message:extraInfo:
    - (void)onWarning:
    (V2TXLiveCode)code
    message:
    (NSString *)msg
    extraInfo:
    (NSDictionary *)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:
    (NSInteger)volume

    Microphone-collected volume callback

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

    onPushStatusUpdate:message:extraInfo:

    onPushStatusUpdate:message:extraInfo:
    - (void)onPushStatusUpdate:
    (V2TXLivePushStatus)status
    message:
    (NSString *)msg
    extraInfo:
    (NSDictionary *)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:
    (nullable TXImage *)image

    Screenshot callback

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

    onProcessAudioFrame:

    onProcessAudioFrame:
    - (void) onProcessAudioFrame:
    (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:dstFrame:

    onProcessVideoFrame:dstFrame:
    - (void)onProcessVideoFrame:
    (V2TXLiveVideoFrame * _Nonnull)srcFrame
    dstFrame:
    (V2TXLiveVideoFrame * _Nonnull)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.
    (void) onProcessVideoFrame:(V2TXLiveVideoFrame * _Nonnull)srcFrame dstFrame:(V2TXLiveVideoFrame * _Nonnull)dstFrame
    {
    GLuint dstTextureId = renderItemWithTexture(srcFrame.textureId, srcFrame.width, srcFrame.height);
    dstFrame.textureId = dstTextureId;
    return 0;
    }
    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:
    (void) onProcessVideoFrame:(V2TXLiveVideoFrame * _Nonnull)srcFrame dstFrame:(V2TXLiveVideoFrame * _Nonnull)dstFrame
    {
    thirdparty_process(srcFrame.textureId, srcFrame.width, srcFrame.height, dstFrame.textureId);
    return 0;
    }

    onGLContextDestroyed

    onGLContextDestroyed

    Callback of destroying the OpenGL context in the SDK

    onSetMixTranscodingConfig:message:

    onSetMixTranscodingConfig:message:
    - (void)onSetMixTranscodingConfig:
    (V2TXLiveCode)code
    message:
    (NSString *)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:storagePath:

    onLocalRecordBegin:storagePath:
    - (void)onLocalRecordBegin:
    (NSInteger)errCode
    storagePath:
    (NSString *)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:storagePath:

    onLocalRecording:storagePath:
    - (void)onLocalRecording:
    (NSInteger)durationMs
    storagePath:
    (NSString *)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:storagePath:

    onLocalRecordComplete:storagePath:
    - (void)onLocalRecordComplete:
    (NSInteger)errCode
    storagePath:
    (NSString *)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.

    onVoiceActivityDetectionUpdate:

    onVoiceActivityDetectionUpdate:
    - (void)onVoiceActivityDetectionUpdate:
    (BOOL)active

    After calling {@link enableVoiceActivityDetection} to turn on voice activity detection, you will receive this callback notification when the anchor starts or stops speaking.

    Param
    DESC
    active
    The voice starts or stops.
    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