API | Description |
Submits a live stream moderation job. | |
Queries the result of a specified live stream moderation job. |
function postLiveAuditing() {var config = {// Replace with your own bucket informationBucket: 'examplebucket-1250000000', /* Bucket. Required */Region: 'COS_REGION', /* Bucket region. Required */};var host = config.Bucket + '.ci.' + config.Region + '.myqcloud.com';var url = 'https://' + host + '/video/auditing';var body = COS.util.json2xml({Request: {Type: 'live_video',Input: {Url: 'rtmp://example.com/live/123', // The URL of the live stream to be moderated// DataId: '',// UserInfo: {},},Conf: {BizType: '766d07a7af937c26216c51db29793ea6', // BizType can be obtained after you create a live stream moderation policy in the console. Required// Callback: 'https://callback.com', // Callback address. Optional// CallbackType: 1, // Callback segment type. Optional}}});cos.request({Bucket: config.Bucket,Region: config.Region,Method: 'POST',Url: url,Key: '/video/auditing',ContentType: 'application/xml',Body: body},function(err, data){console.log(err || data);});}postLiveAuditing();
Node Name (Keyword) | Parent Node | Description | Type | Required |
Request | - | The configuration items for live stream moderation. | Container | Yes |
Request
has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Type | Required |
Type | Request | Moderation job type, which is fixed at live_video for live stream moderation. | String | Yes |
Input | Request | The information of the live stream to be moderated. | Container | Yes |
Conf | Request | The configuration information of the moderation rule. | Container | Yes |
StorageConf | Request | The configuration information of live stream storage. | Container | No |
Input
has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Type | Required |
Url | Request.Input | The URL of the live stream to be moderated, such as rtmp://example.com/live/123 . | String | Yes |
DataId | Request.Input | This field will return the original content in the moderation result, which can contain up to 512 bytes. You can use this field to uniquely identify the data to be moderated in your business. | String | No |
UserInfo | Request.Input | Custom field, which can be used to assist in behavioral data analysis. | Container | No |
UserInfo
has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Type | Required |
TokenId | Request.Input.UserInfo | Account information, which can contain up to 128 bytes. | String | No |
Nickname | Request.Input.UserInfo | Nickname information, which can contain up to 128 bytes. | String | No |
DeviceId | Request.Input.UserInfo | Device information, which can contain up to 128 bytes. | String | No |
AppId | Request.Input.UserInfo | Unique app ID, which can contain up to 128 bytes. | String | No |
Room | Request.Input.UserInfo | Room ID information, which can contain up to 128 bytes. | String | No |
IP | Request.Input.UserInfo | IP address information, which can contain up to 128 bytes. | String | No |
Type | Request.Input.UserInfo | Business type, which can contain up to 128 bytes. | String | No |
ReceiveTokenId | Request.Input.UserInfo | User account to receive messages, which can contain up to 128 bytes. | String | No |
Gender | Request.Input.UserInfo | Gender information, which can contain up to 128 bytes. | String | No |
Level | Request.Input.UserInfo | Level information, which can contain up to 128 bytes. | String | No |
Role | Request.Input.UserInfo | Role information, which can contain up to 128 bytes. | String | No |
Conf
has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Type | Required |
BizType | Request.Conf | Unique identifier of the moderation policy. You can configure the scenes you want to moderate on the moderation policy page in the console, such as pornographic, advertising, and illegal information. For configuration instructions, see Setting Moderation Policy. You can get BizType in the console. If BizType is specified, the moderation request will perform moderation based on the scenes configured in the moderation policy. | String | Yes |
Callback | Request.Conf | Callback address, which must start with http:// or https:// . | String | No |
CallbackType | Request.Conf | Callback segment type. Valid values: 1 (calls back all captured frames and audio segments); 2 (calls back only non-compliant captured frames and audio segments). Default value: 1 . | Integer | No |
StorageConf
has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Type | Required |
Path | Request.StorageConf | The path where to dump the live stream. The TS and M3U8 files of the live stream will be saved in this directory of the bucket. The M3U8 file will be named Path/{$JobId}.m3u8 , and the TS file will be named Path/{$JobId}-{$Realtime}.ts , where Realtime is the 17-digit time of year, month, day, hour, minute, second, and millisecond . | String | No |
function getLiveAuditingResult() {var config = {// Replace with your own bucket informationBucket: 'examplebucket-1250000000', /* Bucket. Required */Region: 'COS_REGION', /* Bucket region. Required */};var jobId = 'av0ca69557bd6111ed904c5254009411xx'; // `jobId`, which is returned after a live stream moderation job is submitted.var host = config.Bucket + '.ci.' + config.Region + '.myqcloud.com';var url = 'https://' + host + '/video/auditing/' + jobId;cos.request({Bucket: config.Bucket,Region: config.Region,Method: 'GET',Key: '/video/auditing/' + jobId,Url: url,},function(err, data){console.log(err || data);});}getLiveAuditingResult();
Parameter | Description | Type | Required |
jobId | ID of the job to be queried. | String | Yes |
Was this page helpful?