Updating a Recording Rule
Function
This API is used to update a recording rule.
Constraints
If a rule is modified, the modified rule does not take effect for the stream that is being recorded.
The modification is valid for new streams and takes effect 5 minutes later. That is, the new rule can be used for recording tasks 5 minutes after being modified.
URI
PUT /v2/apps/{app_id}/record-rules/{rule_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
app_id |
Yes |
String |
Application ID. |
rule_id |
Yes |
String |
Rule ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
Content type. |
X-Auth-Token |
No |
String |
User token. This parameter is mandatory when token authentication is used. It can be obtained by calling the IAM API that is used for obtaining a user token. The value of X-Subject-Token in the response header is the user token. |
Authorization |
No |
String |
Authentication information. This parameter is mandatory when AK/SK-based authentication is used. |
X-Sdk-Date |
No |
String |
Time when the request is sent. This parameter is mandatory when AK/SK-based authentication is used. |
X-Project-Id |
No |
String |
Project ID. This parameter is mandatory when AK/SK-based authentication is used. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
obs_addr |
Yes |
RecordObsFileAddr object |
Bucket where recording files are stored. |
record_formats |
Yes |
Array of strings |
Recording format: The HLS and MP4 formats are supported.
|
hls_config |
No |
HLSRecordConfig object |
HLS recording rule configuration. |
mp4_config |
No |
MP4RecordConfig object |
MP4 recording rule configuration. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
location |
Yes |
String |
ID of the region where the OBS bucket resides. |
project_id |
Yes |
String |
Project ID of the region where the OBS bucket resides. |
bucket |
Yes |
String |
OBS bucket name. |
object |
No |
String |
OBS object path, which complies with the OBS Object definition. If this parameter is left empty, recordings will be saved to the root directory. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
record_cycle |
Yes |
Integer |
Duration of periodic recording. Value range: [60,43200] or 0. If the value is 0, the entire stream is recorded as a file. Unit: second |
record_prefix |
No |
String |
Prefix of the M3U8 recording file containing the path and file name. Default value: {app_id}/{record_format}/{stream}_{file_start_time}/{stream}_{file_start_time} The following special variables can be customized:
|
record_slice_duration |
No |
Integer |
TS slice duration for HLS recording, which is optional. The value ranges from 2 to 60. The default value is 10. Unit: second |
record_max_duration_to_merge_file |
No |
Integer |
Interval threshold for combining HLS chunks. If the stream interruption duration exceeds this threshold, a new file will be generated. The value ranges from -1 to 300. The default value is 0. Unit: second If the value is set to 0, a new file will be generated once the stream is interrupted.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
record_cycle |
Yes |
Integer |
Duration of periodic recording. Value range: [60, 10800]. Unit: second |
record_prefix |
No |
String |
Prefix of the recording file containing the path and file name. Default value: {app_id}/{record_format}/{stream}_{file_start_time}/{stream}_{file_start_time} The following special variables can be customized:
|
record_max_duration_to_merge_file |
No |
Integer |
Interval threshold for combining MP4 chunks. If the stream interruption duration exceeds this threshold, a new file will be generated. The value ranges from 0 to 300. The default value is 0. Unit: second If the value is set to 0, a new file will be generated once the stream is interrupted. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
X-request-Id |
String |
Request ID for task tracing. |
Parameter |
Type |
Description |
---|---|---|
rule_id |
String |
Rule ID, which is returned by the server. This parameter does not need to be carried during rule creation or modification. |
app_id |
String |
Application ID. |
obs_addr |
RecordObsFileAddr object |
Bucket where recording files are stored. |
record_formats |
Array of strings |
Recording format: HLS or MP4. |
hls_config |
HLSRecordConfig object |
HLS recording rule configuration. |
mp4_config |
MP4RecordConfig object |
MP4 recording rule configuration. |
create_time |
String |
Creation time, for example, 2006-01-02T15:04:05.075Z. The time zone is UTC. |
update_time |
String |
Update time, for example, 2006-01-02T15:04:05.075Z. The time zone is UTC. |
Parameter |
Type |
Description |
---|---|---|
location |
String |
ID of the region where the OBS bucket resides. |
project_id |
String |
Project ID of the region where the OBS bucket resides. |
bucket |
String |
OBS bucket name. |
object |
String |
OBS object path, which complies with the OBS Object definition. If this parameter is left empty, recordings will be saved to the root directory. |
Parameter |
Type |
Description |
---|---|---|
record_cycle |
Integer |
Duration of periodic recording. Value range: [60,43200] or 0. If the value is 0, the entire stream is recorded as a file. Unit: second |
record_prefix |
String |
Prefix of the M3U8 recording file containing the path and file name. Default value: {app_id}/{record_format}/{stream}_{file_start_time}/{stream}_{file_start_time} The following special variables can be customized:
|
record_slice_duration |
Integer |
TS slice duration for HLS recording, which is optional. The value ranges from 2 to 60. The default value is 10. Unit: second |
record_max_duration_to_merge_file |
Integer |
Interval threshold for combining HLS chunks. If the stream interruption duration exceeds this threshold, a new file will be generated. The value ranges from -1 to 300. The default value is 0. Unit: second If the value is set to 0, a new file will be generated once the stream is interrupted.
|
Parameter |
Type |
Description |
---|---|---|
record_cycle |
Integer |
Duration of periodic recording. Value range: [60, 10800]. Unit: second |
record_prefix |
String |
Prefix of the recording file containing the path and file name. Default value: {app_id}/{record_format}/{stream}_{file_start_time}/{stream}_{file_start_time} The following special variables can be customized:
|
record_max_duration_to_merge_file |
Integer |
Interval threshold for combining MP4 chunks. If the stream interruption duration exceeds this threshold, a new file will be generated. The value ranges from 0 to 300. The default value is 0. Unit: second If the value is set to 0, a new file will be generated once the stream is interrupted. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
X-request-Id |
String |
Request ID for task tracing. |
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Description. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
X-request-Id |
String |
Request ID for task tracing. |
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Description. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
X-request-Id |
String |
Request ID for task tracing. |
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Description. |
Example Requests
PUT https://rtc-api.myhuaweicloud.com/v2/apps/{app_id}/record-rules/{rule_id} { "obs_addr" : { "bucket" : "obsName", "location" : "cn-north-4", "object" : "Record/", "project_id" : "ad7456ce8ef89adf567" }, "record_formats" : [ "MP4" ], "mp4_config" : { "record_cycle" : 60, "record_max_duration_to_merge_file" : 0 } }
Example Responses
Status code: 200
The configuration is successful.
{ "app_id" : "123456abc", "rule_id" : "456789abc", "create_time" : "2006-01-02T15:04:05.075Z", "obs_addr" : { "bucket" : "obsName", "location" : "cn-north-4", "object" : "Record/", "project_id" : "ad7456ce8ef89adf567" }, "record_formats" : [ "MP4" ], "mp4_config" : { "record_cycle" : 60, "record_max_duration_to_merge_file" : 0 }, "update_time" : "2006-01-02T15:04:05.075Z" }
Status code: 400
Configuration failed because the request cannot be understood by the server or parameters are incorrect.
{ "error_code" : "RTC.00001003", "error_msg" : "InvalidParameterValue" }
Status code: 404
Configuration failed because the application does not exist.
{ "error_code" : "RTC.00001003", "error_msg" : "InvalidParameterValue" }
Status code: 500
Configuration failed due to server error.
{ "error_code" : "RTC.00002xxx", "error_msg" : "InternalError" }
Status Codes
Status Code |
Description |
---|---|
200 |
The configuration is successful. |
400 |
Configuration failed because the request cannot be understood by the server or parameters are incorrect. |
404 |
Configuration failed because the application does not exist. |
500 |
Configuration failed due to server error. |
Error Codes
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