Sends control commands when a link is connected to the URL that is used to push live streams or play on-premises videos.
This operation is a callback function.
Description
typedef int (*lv_on_push_streaming_cmd_cb)(const lv_device_auth_s *auth, const lv_on_push_stream_cmd_param_s *param);Parameter | Type | Description |
auth | lv_device_auth_s * | The device information for authentication. |
param | const lv_on_push_stream_cmd_param_s * | The additional parameters, such as a command to pause the playback of local videos. |
Sample code
Note
The sample code is provided for reference only. Refer to the complete code in the SDK.
// In the sample code, a callback function named on_push_streaming_cmd_cb is defined to implement lv_on_push_streaming_cmd_cb and a callback function named stopPushStreamingCallback is defined to implement lv_start_push_streaming_cb.
lv_on_push_streaming_cmd_cb = on_push_streaming_cmd_cb;
static int on_push_streaming_cmd_cb(const lv_device_auth_s *auth, const lv_on_push_stream_cmd_param_s *param) {
printf("on_push_streaming_cmd_cb service_id:%d, cmd:%d %d\n", param->common.service_id, param->common.cmd_type, param->seek.timestamp);
DummyIpcMediaParam ipc_param = {0};
ipc_param.service_id = param->common.service_id;
if (param->common.cmd_type == LV_LIVE_REQUEST_I_FRAME) {
// Forcibly generate an I-frame for live stream.
} else if (param->common.cmd_type == LV_STORAGE_RECORD_SEEK) {
// Find the playback of a specific timestamp.
} else if (param->common.cmd_type == LV_STORAGE_RECORD_PAUSE) {
// Pause the playback of local videos.
} else if (param->common.cmd_type == LV_STORAGE_RECORD_UNPAUSE) {
// Resume the playback of local videos.
} else if (param->common.cmd_type == LV_STORAGE_RECORD_START) {
// Start the playback of local videos.
} else if (param->common.cmd_type == LV_STORAGE_RECORD_SET_PARAM) {
// Change the speed of the playback of local videos.
}
return 0;
}