All Products
Search
Document Center

:lv_start_push_streaming_cb

Last Updated:Mar 01, 2022

Enables the notification service.

This operation is a callback function. It sends notifications that links, such as links for live stream, video on demand, or cloud storage, have been established and provides related information. After you receive the notifications, you can initialize the encoder based on the information to start pushing audio and video data.

Description

typedef int (*lv_start_push_streaming_cb)(const lv_device_auth_s *auth, const lv_start_push_stream_param_s *param);

The following table describes the related parameters.

Parameter

Type

Description

auth

lv_device_auth_s *

The device information for authentication.

param

const lv_start_push_stream_param_s*

The additional parameters, such as the main stream or sub-stream of the live stream.

Sample code

Note

The sample code is provided for reference only. The complete code is contained in the SDK.

// The callback function start_push_streaming_cb is defined in SDK Demo to implement the lv_start_push_streaming_cb operation.
lv_start_push_streaming_cb = start_push_streaming_cb.

// The callback function startPushStreamingCallback is defined in SDK Demo.
static int start_push_streaming_cb(const lv_device_auth_s *auth, const lv_start_push_stream_param_s *param) {
{
    if (param->common.cmd_type == LV_STREAM_CMD_LIVE) {
       // Use lv_stream_send_media to push audio and video data.
       // We recommend that you add a new thread to send data in actual environments.
        ......
        return 0;
    } else if (param->common.cmd_type == LV_STREAM_CMD_STORAGE_RECORD_BY_UTC_TIME) {
       // Use lv_stream_send_media to push audio and video data.
       // We recommend that you add a new thread to send data in actual environments.
       ......
       return 0;
    }

    return 0;
}