Creating an Audio Stream Moderation Job
Function
This API is used to create an audio stream moderation job. After the job is created, the job ID is returned.
- You are advised to record the job_id corresponding to each URL after creating a moderation job so that you can close the moderation job later.
- If the expected moderation result is not called back after a moderation job is created, the stream may be unstable and may fail to be pulled by the service. You can close the moderation job and create another moderation job for the stream.
URI
POST /v3/{project_id}/moderation/audio-stream/jobs
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token, which can be obtained by calling the IAM API (The token is the value of X-Subject-Token in the response header.) |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
data |
Yes |
data object |
Audio stream data input |
event_type |
Yes |
String |
Event type. The options are as follows:
|
categories |
Yes |
Array of strings |
Types of risks to be detected. The list cannot be empty. The available risk types are as follows:
|
callback |
Yes |
String |
If this field is not empty, the callback will be invoked to send the detection result to your URL. If the audio stream does not end, the client is called back when violation is detected in the segment. If the audio stream ends, the client is called back no matter whether violation is detected in the segment.
NOTE:
|
seed |
No |
String |
Used to verify the requests initiated by Huawei Cloud content security service during callback notifications. You can customize it. The value is a random string that contains a maximum of 64 characters, including letters, digits, and underscores (_).
NOTE:
If seed is not empty, headers contains the X-Auth-Signature field. The field value is generated using the HMAC-SHA256 algorithm. The string to be encrypted is composed of create_time, job_id, request_id, and seed in sequence. The key is seed. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
url |
Yes |
String |
Audio stream URL. Mainstream protocols such as RTMP, RTMPS, HLS, HTTP, and HTTPS are supported. |
language |
No |
String |
Supported audio stream language. The options are as follows:
|
return_all_results |
No |
Boolean |
Policy for returning the audio clip moderation result. The following values are available:
|
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Unique ID of the request, which is used for troubleshooting. You are advised to save the ID. |
job_id |
String |
Unique job ID |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code of a failed API call. For details, see Error Codes. This parameter is not included when the API is successfully called. |
error_msg |
String |
Error message of a failed API call. This parameter is not included when the API is successfully called. |
Example Request
Create an audio stream moderation job.
POST https://{endpoint}/v3/{project_id}/moderation/audio-stream/jobs { "data" : { "url" : "https://xxxxx" }, "event_type" : "default", "categories" : [ "porn", "ad" ], "callback" : "http://xxxx" }
Example Response
Status code: 200
Example of a successful response
{ "job_id" : "01661356800_7c0fe871f80543358917e4faebca4a48", "request_id" : "07490f57ac5e034c077ab25b5f9e1da5" }
Status code: 400
Example of a failed response
{ "error_code" : "AIS.0401", "error_msg" : "The input parameter event_type is incorrect." }
Status Codes
Status Code |
Description |
---|---|
200 |
Example of a successful response |
400 |
Example of a failed response |
Error Codes
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot