Creating an Intelligent Livestreaming Room
Function
Creates an intelligent livestreaming room.
Calling Method
For details, see Calling APIs.
URI
POST /v1/{project_id}/smart-live-rooms
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 |
No |
String |
User token. This parameter is mandatory when token authentication is used. You can obtain the token by calling the IAM API used to obtain a user token. Value of X-Subject-Token in the response header. |
Authorization |
No |
String |
Authentication information. This parameter is mandatory for AK/SK authentication. |
X-Sdk-Date |
No |
String |
Time when the request is sent. This parameter is mandatory for AK/SK authentication. The format is YYYYMMDD'T'HHMMSS'Z'. |
X-Project-Id |
No |
String |
Project ID. This parameter is mandatory for AK/SK authentication. |
X-App-UserId |
No |
String |
Third-party user ID, which does not allow Chinese characters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
room_name |
Yes |
String |
Livestreaming room name. |
room_description |
No |
String |
Livestreaming room description. |
room_type |
No |
String |
Live room type.
|
scene_scripts |
No |
Array of LiveVideoScriptInfo objects |
Default livestreaming script list. |
interaction_rules |
No |
Array of LiveRoomInteractionRuleInfo objects |
Interaction rule list. |
play_policy |
No |
PlayPolicy object |
Script playback policy. |
video_config |
No |
VideoConfig object |
Video output configuration. |
output_urls |
No |
Array of strings |
Address of the third-party livestreaming platform for RTMP video stream push. |
stream_keys |
No |
Array of strings |
Stream key of the third-party livestreaming platform for RTMP video stream push, which corresponds to the ingest URL. |
backup_model_asset_ids |
No |
Array of strings |
Asset ID of the alternative virtual streamer (only image assets, excluding timbre). |
live_event_callback_config |
No |
LiveEventCallBackConfig object |
Live event callback notification configuration. |
rtc_callback_config |
No |
RTCLiveEventCallBackConfig object |
RTC callback event configuration. Compatible processing. If the configuration is not carried, LIVE_PROGRESS is subscribed by default. |
review_config |
No |
ReviewConfig object |
Content review configuration. |
shared_config |
No |
SharedConfig object |
Sharing configuration. |
view_mode |
No |
String |
Landscape or portrait mode. Default value: VERTICAL
|
co_streamer_config |
No |
CoStreamerConfig object |
Co-streamer configuration |
priv_data |
No |
String |
Private data, which is filled in by the user and carried back as it is. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
script_id |
No |
String |
Script ID. |
script_name |
Yes |
String |
Script name. |
script_description |
No |
String |
Script description. |
dh_id |
No |
String |
Virtual human ID, which corresponds to the combination of image and timbre. |
model_asset_id |
No |
String |
Asset ID of a virtual human model. |
voice_config |
No |
VoiceConfig object |
Voice configuration parameter. |
background_config |
No |
Array of BackgroundConfigInfo objects |
Background configuration. |
layer_config |
No |
Array of LayerConfig objects |
Layer configuration. |
shoot_scripts |
Yes |
Array of LiveShootScriptItem objects |
Shooting script list. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
background_type |
Yes |
String |
Background type.
NOTE:
|
background_config |
No |
String |
Background file URL.
NOTE:
|
background_color_config |
No |
String |
RGB color value of a solid color background.
NOTE:
|
background_asset_id |
No |
String |
Background asset ID.
NOTE:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
layer_type |
Yes |
String |
Layer type.
|
asset_id |
No |
String |
ID of the asset overlaid on a video. You do not need to set this parameter for external assets. |
group_id |
No |
String |
Groups materials in multiple scenes. Materials with the same group_id share location information when they are applied globally. |
position |
No |
LayerPositionConfig object |
Layer position configuration. |
size |
No |
LayerSizeConfig object |
Layer size configuration. |
image_config |
No |
ImageLayerConfig object |
Material image layer configuration. |
video_config |
No |
VideoLayerConfig object |
Material video layer configuration. |
text_config |
No |
TextLayerConfig object |
Material text layer configuration. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
dx |
Yes |
Integer |
X axis position of the pixel in the upper left corner of the image. The coordinate of the upper left corner of the canvas is 0x0.
NOTE:
|
dy |
Yes |
Integer |
Y axis position of the pixel in the upper left corner of the image. The coordinate of the upper left corner of the canvas is 0x0.
NOTE:
The canvas resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16). |
layer_index |
Yes |
Integer |
Layer sequence of an image, video, or person image.
NOTE:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
width |
No |
Integer |
Width (in pixel) of the layer image (relative to the canvas size).
NOTE:
The canvas resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16). |
height |
No |
Integer |
Height (in pixel) of the layer image (relative to the canvas size).
NOTE:
The canvas resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16). |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
video_url |
No |
String |
Video file URL. |
video_cover_url |
No |
String |
Video thumbnail file URL. |
loop_count |
No |
Integer |
Number of times that a video is played cyclically. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
text_context |
No |
String |
Text of the text layer. The content must be encoded using Base64. For example, if you want to add the text watermark "Test text watermark", set text_context to 5rWL6K+V5paH5a2X5rC05Y2w. |
font_name |
No |
String |
Font. The following fonts are supported:
|
font_size |
No |
Integer |
Font size (pixel). The value ranges from 4 to 120. |
font_color |
No |
String |
Font color. RGB color value. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
sequence_no |
No |
Integer |
Script No. |
title |
No |
String |
Paragraph title. |
text_config |
No |
TextConfig object |
Script configuration. |
audio_config |
No |
LiveAudioConfig object |
Live audio configuration. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
text |
Yes |
String |
Script. Two modes are supported: plain text mode and tag mode. Plain text mode Plain text mode, for example, "Hello, everyone, I'm a virtual streamer." Tag mode For details about the definition of SSML tags, see SSML Definition of Text Control. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
asset_id |
No |
String |
ID of the inserted audio asset. You do not need to set this parameter for external assets. |
audio_url |
No |
String |
Audio URL. Only the MP3 format is supported. The size is less than 100 MB. The output is automatically converted to mono 16 kHz for sampling. |
subtitle_url |
No |
String |
URL of the subtitle file of the audio. Only the SRT format is supported. The size is less than 1 MB. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
rule_index |
No |
String |
Rule index. |
rule_name |
No |
String |
Rule name. |
enabled |
No |
Boolean |
Whether to enable. |
event_type |
No |
Integer |
Event type. - 1: on-screen comment - 2: users joining a live room - 3: giving likes - 4: sending gifts - 10: preset wording |
hit_condition |
No |
HitCondition object |
Hit condition. |
trigger |
No |
TriggerProcess object |
Trigger |
review_config |
No |
ReviewConfig object |
Content review configuration. |
group_id |
No |
String |
Interaction rule library ID, which is carried when a rule is imported from the interaction rule library. |
group_name |
No |
String |
Interaction rule library name, which is carried when a rule is imported from the interaction rule library. |
enabled_scenes |
No |
Array of strings |
Scenario where a rule is enabled. Set this parameter when it is enabled in some scenarios. If this parameter is not specified, the rule is enabled in all scenarios. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
relation |
No |
String |
Condition relationship. The value And or Or RESERVED indicates that the general reply does not check other matching conditions. |
priority |
No |
Integer |
Priority. A smaller value indicates a higher priority. The value ranges from 0 to 999. The default value is 500. This parameter is optional. |
tags |
No |
Array of HitConditionTag objects |
Matching relationship configuration |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
tag |
No |
String |
Key fields in the event content. |
operation |
No |
String |
Field processing.
|
match |
No |
String |
Match type.
|
value |
No |
String |
Match value |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
time_window |
No |
Integer |
Processing suppression duration, in second. –1 indicates the entire livestreaming. 0 indicates no suppression. It is triggered each time. |
reply_mode |
No |
String |
Reply type.
|
layer_config |
No |
SmartLayerConfig object |
Intelligent layer configuration. |
extra_layer_config |
No |
SmartLayerConfig object |
Additional layer, which is used together with the second layer when dynamic text needs to be displayed for products. |
reply_texts |
No |
Array of strings |
Reply scripts. |
reply_audios |
No |
Array of ReplyAudioInfo objects |
Reply audio set. Set audio_url. |
reply_order |
No |
String |
Reply sequence.
|
reply_role |
No |
String |
Reply role. The default value is STREAMER.
|
robot_id |
No |
String |
Bot ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
layer_type |
Yes |
String |
Layer type.
|
asset_id |
No |
String |
ID of the asset overlaid on a video. You do not need to set this parameter for external assets. |
position |
No |
LayerPositionConfig object |
Layer position configuration. |
size |
No |
LayerSizeConfig object |
Layer size configuration. |
image_config |
No |
SmartImageLayerConfig object |
Image layer configuration. |
video_config |
No |
SmartVideoLayerConfig object |
Video layer configuration. |
text_config |
No |
SmartTextLayerConfig object |
Video layer configuration. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
image_url |
Yes |
String |
Image file URL. |
display_duration |
No |
Integer |
Image display duration, in second.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
video_url |
Yes |
String |
Video file URL. |
video_cover_url |
No |
String |
Video thumbnail file URL. |
display_duration |
No |
Integer |
Video display duration, in second.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
text_type |
No |
String |
Text type.
|
text_context |
No |
String |
Text. |
font_name |
No |
String |
Font. The following fonts are supported:
|
font_size |
No |
Integer |
Font size (pixel). The value ranges from 4 to 120. |
font_color |
No |
String |
Font color. RGB color value. |
display_duration |
No |
Integer |
Text display duration, in second.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
audio_url |
No |
String |
Audio URL. |
audio_name |
No |
String |
Audio name. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
repeat_count |
No |
Integer |
Number of times that a script is played repeatedly. The value –1 indicates that the playback is repeated until it is stopped manually. The value 0 indicates that it is played only once. If the value is n, the actual number of running times is n + 1. |
auto_play_script |
No |
Boolean |
Indicates whether to automatically play a script. true: The script is automatically played after the task is initialized. false: After the task is initialized, the script is not played until signal appears. |
play_mode |
No |
String |
Control mode. The default value is TEXT. TEXT: text control, that is, TTS is used AUDIO: speech control NO_PRESET: no preset script, that is, manual control is used |
random_play_mode |
No |
String |
Random broadcast mode.
|
need_independent_capture_client |
No |
Boolean |
Whether an independent data collection device is required |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
clip_mode |
No |
String |
Clipping mode of the output video. Default value: RESIZE.
|
codec |
Yes |
String |
Video encoding format and video file format.
|
bitrate |
Yes |
Integer |
Average output bitrate. Unit: kbit/s The value ranges from 40 to 30,000.
NOTE:
|
width |
Yes |
Integer |
Video width. Unit: pixel.
NOTE:
|
height |
Yes |
Integer |
Video height. Unit: pixel.
NOTE:
|
frame_rate |
No |
String |
Frame rate. Unit: FPS
NOTE:
|
is_subtitle_enable |
No |
Boolean |
Whether the output video is subtitled. The default value is false.
|
subtitle_config |
No |
SubtitleConfig object |
Subtitle configuration. |
dx |
No |
Integer |
Coordinates of the pixel in the upper left corner of the cropped video. This parameter takes effect when clip_mode is set to crop.
NOTE:
|
dy |
No |
Integer |
Coordinates of the pixel in the upper left corner of the cropped video. This parameter takes effect when clip_mode is set to crop.
NOTE:
|
is_enable_super_resolution |
No |
Boolean |
Whether super resolution is enabled for a video.
NOTE:
true: enable false: do not enable |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
dx |
No |
Integer |
Coordinates of the pixel in the lower left corner of the subtitle.
NOTE:
|
dy |
No |
Integer |
Coordinates of the pixel in the lower left corner of the subtitle.
NOTE:
|
font_name |
No |
String |
Font. The following fonts are supported:
|
font_size |
No |
Integer |
Font size. The value ranges from 4 to 120. |
h |
No |
Integer |
Subtitle box height
NOTE:
|
w |
No |
Integer |
Subtitle box width
NOTE:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
live_event_type_callback_url |
No |
String |
Live event callback URL. HTTPS URL, which must contain an authentication string. |
auth_type |
No |
String |
Authentication type.
|
key |
No |
String |
Key |
callback_event_type |
No |
Array of strings |
Live event types in callbacks. Currently, only the following options are supported:
{ "event_type": "SHOOT_SCRIPT_SWITCH", "message":"{\"room_id\":\"26f065244f754b3aa853b649a21aaf66\",\"job_id\":\"e87104f76d7546ce8a46ac6b04c49c3c\",\"scene_script_name\":\"Product 1\",\"shoot_script_sequence_no\":\"2\",\"shoot_script_title\":\"Paragraph 2\"}" } The RTMP_STREAM_STATE_CHANGE callback is defined as follows: { "event_type": "RTMP_STREAM_STATE_CHANGE", "message":"{\"room_id\":\"26f065244f754b3aa853b649a21aaf66\",\"job_id\":\"e87104f76d7546ce8a46ac6b04c49c3c\",\"output_url\":\"rtmp://xxx/xx/xx\",\"stream_key\":\"xxxxx\",\"state\":\"CONNECTED\"}" } The value of state can be CONNECTING, CONNECTED, DISCONNECTED, RECONNECTING, or END. The REPLY_COMMAND_FINISH callback is defined as follows: { "event_type": "REPLY_COMMAND_FINISH", "message":"{\"room_id\":\"26f065244f754b3aa853b649a21aaf66\",\"job_id\":\"e87104f76d7546ce8a46ac6b04c49c3c\",\"reply_id\":\"e87104f76d7546ce8a46ac6b04c49c3c"}" } |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
rtc_callback_event_type |
No |
Array of strings |
Live event types in RTC callbacks. Currently, only the following options are supported: LIVE_PROGRESS: live script progress notification REPLY_COMMAND_FINISH: Playback is complete. The callback event structure is defined as follows:
{ "message_type": "live_progress_notify", "data": { "script_name": "Scene 1", "shoot_script_sequence_no": 2, "shoot_script_title": "Greeting", "offset": "247", "reply_id": "e87104f76d7546ce8a46ac6b04c49c3c" } } The REPLY_COMMAND_FINISH callback is defined as follows: { "message_type": "reply_command_finish_notify", "data":"{ "reply_id":"e87104f76d7546ce8a46ac6b04c49c3c" }" } |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
no_need_review |
No |
Boolean |
Content review whitelist. This feature is available only for users in the whitelist. The auto review policies apply to other users. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
shared_type |
No |
String |
Sharing type.
|
shared_state |
No |
String |
Sharing status.
|
expire_time |
No |
String |
Time when the sharing expires. If this parameter is left blank, the sharing never expires. |
allowed_project_ids |
No |
Array of strings |
Tenants allowed to access the asset. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
voice_config |
No |
VoiceConfig object |
Voice configuration parameter. |
streamer_action |
No |
String |
Behavior of the streamer when the co-streamer speaks.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
voice_asset_id |
Yes |
String |
Timbre asset ID. |
speed |
No |
Integer |
Speech speed. The value defaults to 100 and ranges from 50 to 200.
NOTE:
|
pitch |
No |
Integer |
Pitch. The value defaults to 100 and ranges from 50 to 200. |
volume |
No |
Integer |
Volume. The value defaults to 140 and ranges from 90 to 240. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
Request ID. |
Parameter |
Type |
Description |
---|---|---|
room_id |
String |
Livestreaming room ID. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error description. |
Example Requests
POST https://{endpoint}/v1/70b76xxxxxx34253880af501cdxxxxxx/smart-live-rooms { "room_name" : "The Legend of Nature", "room_description" : "Courseware", "scene_scripts" : [ { "script_name" : "The Legend of Nature —", "model_asset_id" : "a5d295cdb345c11bd9f36bc22ced3a7a", "voice_config" : { "voice_asset_id" : "a5d295cdb345c11bd9f36bc22ced3a7a" }, "background_config" : [ { "background_type" : "IMAGE", "background_config" : "978f893e1de4553c183b7a805e6290f5" } ], "shoot_scripts" : [ { "sequence_no" : 1, "text_config" : { "text" : "Hello, everyone. I'm Sara." } } ] } ], "live_event_callback_config" : { "live_event_type_callback_url" : "https://xxx/xxx/xxx?xxx=xxx", "auth_type" : "NONE", "callback_event_type" : [ "SHOOT_SCRIPT_SWITCH" ] } }
Example Responses
Status code: 200
Succeeded.
{ "room_id" : "26f06524-4f75-4b3a-a853-b649a21aaf66" }
Status code: 400
{ "error_code" : "MSS.00000003", "error_msg" : "Invalid parameter" }
Status code: 401
{ "error_code" : "MSS.00000001", "error_msg" : "Unauthorized" }
Status code: 500
{ "error_code" : "MSS.00000004", "error_msg" : "Internal Error" }
Status Codes
Status Code |
Description |
---|---|
200 |
Succeeded. |
400 |
Parameters error, including the error code and its description. |
401 |
Authentication is not performed or fails. |
500 |
Internal service 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