Updated on 2024-07-04 GMT+08:00

Updating Intelligent Livestreaming Room Information

Function

Updates intelligent livestreaming room information.

Calling Method

For details, see Calling APIs.

URI

PUT /v1/{project_id}/smart-live-rooms/{room_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

room_id

Yes

String

Script ID.

Request Parameters

Table 2 Request header 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.

Table 3 Request body parameters

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.

  • NORMAL: general live room. The room always exists and can start and stop livestreaming at any time.
  • TEMP: temporary live room. After a livestreaming task is complete, the live room is automatically cleared.
  • TEMPLATE: live room template

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

  • LANDSCAPE: landscape
  • VERTICAL: portrait

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.

Table 4 LiveVideoScriptInfo

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.

Table 5 BackgroundConfigInfo

Parameter

Mandatory

Type

Description

background_type

Yes

String

Background type.

  • IMAGE: image, which is used as the image for 3D virtual human demonstration materials or virtual avatar background.
  • IMAGE_2D: image, which is used as the background image in the 2D scene for 3D virtual broadcasters.
  • VIDEO: video
  • AUDIO: audio
NOTE:
  • Only IMAGE is supported for virtual avatar video production.

background_config

No

String

Background file URL.

NOTE:
  • External URLs are allowed only for livestreaming. For other services, obtain a URL from the asset library.
  • This parameter is mandatory when background_type is set to IMAGE.

background_color_config

No

String

RGB color value of a solid color background.

NOTE:
  • This parameter is mandatory when background_type is set to COLOR.

background_asset_id

No

String

Background asset ID.

NOTE:
  • If the background is a background image, set this parameter to the image asset ID.
Table 6 LayerConfig

Parameter

Mandatory

Type

Description

layer_type

Yes

String

Layer type.

  • HUMAN: person layer
  • IMAGE: image layer
  • VIDEO: video layer
  • TEXT: material text layer

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.

Table 7 LayerPositionConfig

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:
  • The canvas resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16).

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:
  • The layer sequence is an integer starting from 1. The sequence of the bottom layer is 1 and incremented by 1.
Table 8 LayerSizeConfig

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).

Table 9 ImageLayerConfig

Parameter

Mandatory

Type

Description

image_url

No

String

Image file URL.

Table 10 VideoLayerConfig

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.

Table 11 TextLayerConfig

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:

  • HarmonyOS_Sans_SC_Black: HarmonyOS bold
  • HarmonyOS_Sans_SC_Regular: HarmonyOS normal
  • HarmonyOS_Sans_SC_Thin: HarmonyOS light
  • fzyouh: Square & lean

font_size

No

Integer

Font size (pixel).

The value ranges from 4 to 120.

font_color

No

String

Font color. RGB color value.

Table 12 LiveShootScriptItem

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.

Table 13 TextConfig

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.

Table 14 LiveAudioConfig

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.

Table 15 LiveRoomInteractionRuleInfo

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.

Table 16 HitCondition

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

Table 17 HitConditionTag

Parameter

Mandatory

Type

Description

tag

No

String

Key fields in the event content.

operation

No

String

Field processing.

  • SUM: accumulation
  • AVG: average
  • COUNT: count
  • NONE: no processing

match

No

String

Match type.

  • EQUAL: completely equal
  • REGEX: regular expression match
  • MATH_GT: greater than
  • MATH_GE: greater than or equal to
  • MATH_LT: less than
  • MATH_LE: less than or equal to
  • MATH_EQ: numerically equal

value

No

String

Match value

Table 18 TriggerProcess

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.

  • SYSTEM_REPLY: automatic reply based on the preset script
  • CALLBACK: callback to other services, with the preset script
  • SHOW_LAYER: overlaid layer display, which does not affect the script
  • INTELLIGENT_REPLY: script of an intelligent reply

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.

  • RANDOM: random
  • ORDER: sequential loop

reply_role

No

String

Reply role. The default value is STREAMER.

  • STREAMER: streamer
  • CO_STREAMER: co-streamer

robot_id

No

String

Bot ID.

Table 19 SmartLayerConfig

Parameter

Mandatory

Type

Description

layer_type

Yes

String

Layer type.

  • IMAGE: image layer
  • VIDEO: video layer
  • TEXT: text layer

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.

Table 20 SmartImageLayerConfig

Parameter

Mandatory

Type

Description

image_url

Yes

String

Image file URL.

display_duration

No

Integer

Image display duration, in second.

  • 0 Display duration rule: If reply_texts and reply_audios are carried, the duration is the same as the voice playback duration.

    If reply_texts and reply_audios are not carried, the duration is the same as the voice playback duration of the matched keyword.

Table 21 SmartVideoLayerConfig

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.

  • 0 Display duration rule: If reply_texts and reply_audios are carried, the duration is the same as the voice playback duration.

    If reply_texts and reply_audios are not carried, the duration is the same as the voice playback duration of the matched keyword.

Table 22 SmartTextLayerConfig

Parameter

Mandatory

Type

Description

text_type

No

String

Text type.

  • DYNAMIC: dynamic text, which requires keyword replacement
  • STATIC: static text

text_context

No

String

Text.

font_name

No

String

Font. The following fonts are supported:

  • HarmonyOS_Sans_SC_Black: HarmonyOS bold
  • HarmonyOS_Sans_SC_Regular: HarmonyOS normal
  • HarmonyOS_Sans_SC_Thin: HarmonyOS light
  • fzyouh: Square & lean

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.

  • 0 Display duration rule: If reply_texts and reply_audios are carried, the duration is the same as the voice playback duration.

    If reply_texts and reply_audios are not carried, the duration is the same as the voice playback duration of the matched keyword.

Table 23 ReplyAudioInfo

Parameter

Mandatory

Type

Description

audio_url

No

String

Audio URL.

audio_name

No

String

Audio name.

Table 24 PlayPolicy

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.

  • NONE: Random broadcast is disabled.
  • SCENE: Random broadcast by scene is enabled. Paragraphs in a scene are broadcast in sequence.
  • SCRIPT_ITEM: Random broadcast by paragraph is enabled. Scenes are broadcast in sequence.
  • SCENE_AND_SCRIPT_ITEM: Scenes and paragraphs are broadcast randomly.

need_independent_capture_client

No

Boolean

Whether an independent data collection device is required

Table 25 VideoConfig

Parameter

Mandatory

Type

Description

clip_mode

No

String

Clipping mode of the output video. Default value: RESIZE.

  • RESIZE: video scaling
  • CROP: video cropping

codec

Yes

String

Video encoding format and video file format.

  • H264: H.264 encoding, MP4 file output
  • VP8: VP8 encoding, WebM file output

bitrate

Yes

Integer

Average output bitrate.

Unit: kbit/s

The value ranges from 40 to 30,000.

NOTE:
  • Quality is prioritized for virtual avatar video production, which may exceed the preset bitrate.
  • Bitrate range for virtual avatar video production: [1000, 8000].

width

Yes

Integer

Video width.

Unit: pixel.

NOTE:
  • When clip_mode is set to RESIZE, the following resolutions are supported: 1920 x 1080, 1080 x 1920, 1280 x 720, 720 x 1280, 3840 x 2160, and 2160 x 3840. 4K videos can be used only when the virtual avatar model supports 4K.
  • When clip_mode is set to CROP, (dx, dy) is the origin, and the width is the actual width of the reserved video.
  • Currently, only 1080 x 1920 is supported for virtual avatar livestreaming.

height

Yes

Integer

Video height.

Unit: pixel.

NOTE:
  • When clip_mode is set to RESIZE, the following resolutions are supported: 1920 x 1080, 1080 x 1920, 1280 x 720, 720 x 1280, 3840 x 2160, and 2160 x 3840.
  • When clip_mode is set to CROP, (dx, dy) is the origin, and the height is the actual height of the reserved video.
  • Currently, only 1080 x 1920 is supported for virtual avatar livestreaming.

frame_rate

No

String

Frame rate.

Unit: FPS

NOTE:
  • The frame rate of virtual avatar videos is fixed at 25 FPS.

is_subtitle_enable

No

Boolean

Whether the output video is subtitled. The default value is false.

  • true: Displays the subtitle.
  • false: Hides the subtitle.

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:
  • The canvas size is based on the model resolution. For example, for a model with the resolution of 1920 x 1080, the value of dx ranges from 0 to 1920.

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:
  • The canvas size is based on the model resolution. For example, for a model with the resolution of 1920 x 1080, the value of dy ranges from 0 to 1080.

is_enable_super_resolution

No

Boolean

Whether super resolution is enabled for a video.

NOTE:

true: enable

false: do not enable

Table 26 SubtitleConfig

Parameter

Mandatory

Type

Description

dx

No

Integer

Coordinates of the pixel in the lower left corner of the subtitle.

NOTE:
  • The video resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16).

dy

No

Integer

Coordinates of the pixel in the lower left corner of the subtitle.

NOTE:
  • The video resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16).

font_name

No

String

Font. The following fonts are supported:

  • HarmonyOS_Sans_SC_Black: HarmonyOS bold
  • HarmonyOS_Sans_SC_Regular: HarmonyOS normal
  • HarmonyOS_Sans_SC_Thin: HarmonyOS light

font_size

No

Integer

Font size.

The value ranges from 4 to 120.

h

No

Integer

Subtitle box height

NOTE:
  • The parameter h is used to facilitate the calculation of the coordinates in the upper left corner of the subtitle box by the front end. This parameter is not used in the background.

w

No

Integer

Subtitle box width

NOTE:
  • The subtitle box width is fixed at 80/ %of the screen width.
  • The parameter w is used to facilitate the calculation of the coordinates in the upper left corner of the subtitle box by the front end. This parameter is not used in the background.
Table 27 LiveEventCallBackConfig

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.

  • None: The URL contains authentication.
  • MSS_A: In HMACSHA256 signature mode, the hwSecret and hwTime parameters are added to the URL. Value format: hwSecret=hmac_sha256(Key, URI (live_event_callback_url) + hwTime)&hwTime=hex(timestamp)
  • MSS_A_HEAD: In HMACSHA256 signature mode, the hwSecret and hwTime parameters are placed in Head.

    Value format: x-hw-mss-secret=hmac_sha256(Key, URI (live_event_callback_url) + hwTime)

    x-hw-mss-time=hex(timestamp)

  • MEITUAN_DEFAULT: This parameter is used only for Meituan's API callback.

key

No

String

Key

callback_event_type

No

Array of strings

Live event types in callbacks.

Currently, only the following options are supported:

  • SHOOT_SCRIPT_SWITCH: script paragraph switching event
  • RTMP_STREAM_STATE_CHANGE: RTMP link change callback event
  • REPLY_COMMAND_FINISH: Playback is complete.

    The callback event structure is defined as follows:

  • event_type: event type
  • message: event description

    The SHOOT_SCRIPT_SWITCH event callback is defined as follows:

{
  "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"}"
}
Table 28 RTCLiveEventCallBackConfig

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: message type
  • data: message description

    The LIVE_PROGRESS event callback 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"
  }"
}
Table 29 ReviewConfig

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.

Table 30 SharedConfig

Parameter

Mandatory

Type

Description

shared_type

No

String

Sharing type.

  • PRIVATE: accessible only to the current tenant
  • PUBLIC: accessible to all tenants. Currently, only system assets are accessible to all tenants.
  • SHARED: accessible to specified tenants. The tenants are specified by the owner.

shared_state

No

String

Sharing status.

  • PUBLISHED: published. The template is available.
  • DRAFT: draft. The template is being edited and can be viewed only by the owner.
  • REVIEW: The template is being reviewed. The template cannot be edited and can be viewed only by the owner/reviewer.

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.

Table 31 CoStreamerConfig

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.

  • SILENCE: silent
  • VOLUME_DOWN: decreased volume
Table 32 VoiceConfig

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:
  • The value 100 indicates the normal speaking speed of an adult, which is about 250 words per minute.
  • 50 indicates 0.5x speaking speed, 100 indicates normal speaking speed, and 200 indicates 2x speaking speed.

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

Table 33 Response header parameters

Parameter

Type

Description

X-Request-Id

String

Request ID.

Table 34 Response body parameters

Parameter

Type

Description

room_name

String

Livestreaming room name.

room_description

String

Livestreaming room description.

room_type

String

Live room type.

  • NORMAL: general live room. The room always exists and can start and stop livestreaming at any time.
  • TEMP: temporary live room. After a livestreaming task is complete, the live room is automatically cleared.
  • TEMPLATE: live room template

scene_scripts

Array of LiveVideoScriptInfo objects

Default livestreaming script list.

interaction_rules

Array of LiveRoomInteractionRuleInfo objects

Interaction rule list.

play_policy

PlayPolicy object

Script playback policy.

video_config

VideoConfig object

Video output configuration.

output_urls

Array of strings

Address of the third-party livestreaming platform for RTMP video stream push.

stream_keys

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

Array of strings

Asset ID of the alternative virtual streamer (only image assets, excluding timbre).

live_event_callback_config

LiveEventCallBackConfig object

Live event callback notification configuration.

rtc_callback_config

RTCLiveEventCallBackConfig object

RTC callback event configuration. Compatible processing. If the configuration is not carried, LIVE_PROGRESS is subscribed by default.

review_config

ReviewConfig object

Content review configuration.

shared_config

SharedConfig object

Sharing configuration.

view_mode

String

Landscape or portrait mode. Default value: VERTICAL

  • LANDSCAPE: landscape
  • VERTICAL: portrait

co_streamer_config

CoStreamerConfig object

Co-streamer configuration

priv_data

String

Private data, which is filled in by the user and carried back as it is.

room_id

String

Livestreaming room ID.

create_time

String

Time when a livestreaming room is created. The format complies with RFC 3339, for example, 2021-01-10T08:43:17Z.

update_time

String

Time when a livestreaming room is updated. The format complies with RFC 3339, for example, 2021-01-10T08:43:17Z.

cover_url

String

Livestreaming room thumbnail URL.

thumbnail

String

New URL of the live room thumbnail

room_state

String

Live room status.

  • ENABLE: The live room is available.
  • DISABLE: The live room is unavailable. The cause is described in error_info.
  • BLOCKED: The live room has been blocked. The cause is described in error_info.

error_info

ErrorResponse object

Error messages of a virtual human live room.

Table 35 LiveVideoScriptInfo

Parameter

Type

Description

script_id

String

Script ID.

script_name

String

Script name.

script_description

String

Script description.

dh_id

String

Virtual human ID, which corresponds to the combination of image and timbre.

model_asset_id

String

Asset ID of a virtual human model.

voice_config

VoiceConfig object

Voice configuration parameter.

background_config

Array of BackgroundConfigInfo objects

Background configuration.

layer_config

Array of LayerConfig objects

Layer configuration.

shoot_scripts

Array of LiveShootScriptItem objects

Shooting script list.

Table 36 BackgroundConfigInfo

Parameter

Type

Description

background_type

String

Background type.

  • IMAGE: image, which is used as the image for 3D virtual human demonstration materials or virtual avatar background.
  • IMAGE_2D: image, which is used as the background image in the 2D scene for 3D virtual broadcasters.
  • VIDEO: video
  • AUDIO: audio
NOTE:
  • Only IMAGE is supported for virtual avatar video production.

background_config

String

Background file URL.

NOTE:
  • External URLs are allowed only for livestreaming. For other services, obtain a URL from the asset library.
  • This parameter is mandatory when background_type is set to IMAGE.

background_color_config

String

RGB color value of a solid color background.

NOTE:
  • This parameter is mandatory when background_type is set to COLOR.

background_asset_id

String

Background asset ID.

NOTE:
  • If the background is a background image, set this parameter to the image asset ID.
Table 37 LayerConfig

Parameter

Type

Description

layer_type

String

Layer type.

  • HUMAN: person layer
  • IMAGE: image layer
  • VIDEO: video layer
  • TEXT: material text layer

asset_id

String

ID of the asset overlaid on a video. You do not need to set this parameter for external assets.

group_id

String

Groups materials in multiple scenes. Materials with the same group_id share location information when they are applied globally.

position

LayerPositionConfig object

Layer position configuration.

size

LayerSizeConfig object

Layer size configuration.

image_config

ImageLayerConfig object

Material image layer configuration.

video_config

VideoLayerConfig object

Material video layer configuration.

text_config

TextLayerConfig object

Material text layer configuration.

Table 38 LayerPositionConfig

Parameter

Type

Description

dx

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:
  • The canvas resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16).

dy

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

Integer

Layer sequence of an image, video, or person image.

NOTE:
  • The layer sequence is an integer starting from 1. The sequence of the bottom layer is 1 and incremented by 1.
Table 39 LayerSizeConfig

Parameter

Type

Description

width

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

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).

Table 40 ImageLayerConfig

Parameter

Type

Description

image_url

String

Image file URL.

Table 41 VideoLayerConfig

Parameter

Type

Description

video_url

String

Video file URL.

video_cover_url

String

Video thumbnail file URL.

loop_count

Integer

Number of times that a video is played cyclically.

Table 42 TextLayerConfig

Parameter

Type

Description

text_context

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

String

Font. The following fonts are supported:

  • HarmonyOS_Sans_SC_Black: HarmonyOS bold
  • HarmonyOS_Sans_SC_Regular: HarmonyOS normal
  • HarmonyOS_Sans_SC_Thin: HarmonyOS light
  • fzyouh: Square & lean

font_size

Integer

Font size (pixel).

The value ranges from 4 to 120.

font_color

String

Font color. RGB color value.

Table 43 LiveShootScriptItem

Parameter

Type

Description

sequence_no

Integer

Script No.

title

String

Paragraph title.

text_config

TextConfig object

Script configuration.

audio_config

LiveAudioConfig object

Live audio configuration.

Table 44 TextConfig

Parameter

Type

Description

text

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.

Table 45 LiveAudioConfig

Parameter

Type

Description

asset_id

String

ID of the inserted audio asset. You do not need to set this parameter for external assets.

audio_url

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

String

URL of the subtitle file of the audio. Only the SRT format is supported. The size is less than 1 MB.

Table 46 LiveRoomInteractionRuleInfo

Parameter

Type

Description

rule_index

String

Rule index.

rule_name

String

Rule name.

enabled

Boolean

Whether to enable.

event_type

Integer

Event type. - 1: on-screen comment - 2: users joining a live room - 3: giving likes - 4: sending gifts - 10: preset wording

hit_condition

HitCondition object

Hit condition.

trigger

TriggerProcess object

Trigger

review_config

ReviewConfig object

Content review configuration.

group_id

String

Interaction rule library ID, which is carried when a rule is imported from the interaction rule library.

group_name

String

Interaction rule library name, which is carried when a rule is imported from the interaction rule library.

enabled_scenes

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.

Table 47 HitCondition

Parameter

Type

Description

relation

String

Condition relationship. The value And or Or RESERVED indicates that the general reply does not check other matching conditions.

priority

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

Array of HitConditionTag objects

Matching relationship configuration

Table 48 HitConditionTag

Parameter

Type

Description

tag

String

Key fields in the event content.

operation

String

Field processing.

  • SUM: accumulation
  • AVG: average
  • COUNT: count
  • NONE: no processing

match

String

Match type.

  • EQUAL: completely equal
  • REGEX: regular expression match
  • MATH_GT: greater than
  • MATH_GE: greater than or equal to
  • MATH_LT: less than
  • MATH_LE: less than or equal to
  • MATH_EQ: numerically equal

value

String

Match value

Table 49 TriggerProcess

Parameter

Type

Description

time_window

Integer

Processing suppression duration, in second.

–1 indicates the entire livestreaming.

0 indicates no suppression. It is triggered each time.

reply_mode

String

Reply type.

  • SYSTEM_REPLY: automatic reply based on the preset script
  • CALLBACK: callback to other services, with the preset script
  • SHOW_LAYER: overlaid layer display, which does not affect the script
  • INTELLIGENT_REPLY: script of an intelligent reply

layer_config

SmartLayerConfig object

Intelligent layer configuration.

extra_layer_config

SmartLayerConfig object

Additional layer, which is used together with the second layer when dynamic text needs to be displayed for products.

reply_texts

Array of strings

Reply scripts.

reply_audios

Array of ReplyAudioInfo objects

Reply audio set. Set audio_url.

reply_order

String

Reply sequence.

  • RANDOM: random
  • ORDER: sequential loop

reply_role

String

Reply role. The default value is STREAMER.

  • STREAMER: streamer
  • CO_STREAMER: co-streamer

robot_id

String

Bot ID.

Table 50 SmartLayerConfig

Parameter

Type

Description

layer_type

String

Layer type.

  • IMAGE: image layer
  • VIDEO: video layer
  • TEXT: text layer

asset_id

String

ID of the asset overlaid on a video. You do not need to set this parameter for external assets.

position

LayerPositionConfig object

Layer position configuration.

size

LayerSizeConfig object

Layer size configuration.

image_config

SmartImageLayerConfig object

Image layer configuration.

video_config

SmartVideoLayerConfig object

Video layer configuration.

text_config

SmartTextLayerConfig object

Video layer configuration.

Table 51 SmartImageLayerConfig

Parameter

Type

Description

image_url

String

Image file URL.

display_duration

Integer

Image display duration, in second.

  • 0 Display duration rule: If reply_texts and reply_audios are carried, the duration is the same as the voice playback duration.

    If reply_texts and reply_audios are not carried, the duration is the same as the voice playback duration of the matched keyword.

Table 52 SmartVideoLayerConfig

Parameter

Type

Description

video_url

String

Video file URL.

video_cover_url

String

Video thumbnail file URL.

display_duration

Integer

Video display duration, in second.

  • 0 Display duration rule: If reply_texts and reply_audios are carried, the duration is the same as the voice playback duration.

    If reply_texts and reply_audios are not carried, the duration is the same as the voice playback duration of the matched keyword.

Table 53 SmartTextLayerConfig

Parameter

Type

Description

text_type

String

Text type.

  • DYNAMIC: dynamic text, which requires keyword replacement
  • STATIC: static text

text_context

String

Text.

font_name

String

Font. The following fonts are supported:

  • HarmonyOS_Sans_SC_Black: HarmonyOS bold
  • HarmonyOS_Sans_SC_Regular: HarmonyOS normal
  • HarmonyOS_Sans_SC_Thin: HarmonyOS light
  • fzyouh: Square & lean

font_size

Integer

Font size (pixel).

The value ranges from 4 to 120.

font_color

String

Font color. RGB color value.

display_duration

Integer

Text display duration, in second.

  • 0 Display duration rule: If reply_texts and reply_audios are carried, the duration is the same as the voice playback duration.

    If reply_texts and reply_audios are not carried, the duration is the same as the voice playback duration of the matched keyword.

Table 54 ReplyAudioInfo

Parameter

Type

Description

audio_url

String

Audio URL.

audio_name

String

Audio name.

Table 55 PlayPolicy

Parameter

Type

Description

repeat_count

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

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

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

String

Random broadcast mode.

  • NONE: Random broadcast is disabled.
  • SCENE: Random broadcast by scene is enabled. Paragraphs in a scene are broadcast in sequence.
  • SCRIPT_ITEM: Random broadcast by paragraph is enabled. Scenes are broadcast in sequence.
  • SCENE_AND_SCRIPT_ITEM: Scenes and paragraphs are broadcast randomly.

need_independent_capture_client

Boolean

Whether an independent data collection device is required

Table 56 VideoConfig

Parameter

Type

Description

clip_mode

String

Clipping mode of the output video. Default value: RESIZE.

  • RESIZE: video scaling
  • CROP: video cropping

codec

String

Video encoding format and video file format.

  • H264: H.264 encoding, MP4 file output
  • VP8: VP8 encoding, WebM file output

bitrate

Integer

Average output bitrate.

Unit: kbit/s

The value ranges from 40 to 30,000.

NOTE:
  • Quality is prioritized for virtual avatar video production, which may exceed the preset bitrate.
  • Bitrate range for virtual avatar video production: [1000, 8000].

width

Integer

Video width.

Unit: pixel.

NOTE:
  • When clip_mode is set to RESIZE, the following resolutions are supported: 1920 x 1080, 1080 x 1920, 1280 x 720, 720 x 1280, 3840 x 2160, and 2160 x 3840. 4K videos can be used only when the virtual avatar model supports 4K.
  • When clip_mode is set to CROP, (dx, dy) is the origin, and the width is the actual width of the reserved video.
  • Currently, only 1080 x 1920 is supported for virtual avatar livestreaming.

height

Integer

Video height.

Unit: pixel.

NOTE:
  • When clip_mode is set to RESIZE, the following resolutions are supported: 1920 x 1080, 1080 x 1920, 1280 x 720, 720 x 1280, 3840 x 2160, and 2160 x 3840.
  • When clip_mode is set to CROP, (dx, dy) is the origin, and the height is the actual height of the reserved video.
  • Currently, only 1080 x 1920 is supported for virtual avatar livestreaming.

frame_rate

String

Frame rate.

Unit: FPS

NOTE:
  • The frame rate of virtual avatar videos is fixed at 25 FPS.

is_subtitle_enable

Boolean

Whether the output video is subtitled. The default value is false.

  • true: Displays the subtitle.
  • false: Hides the subtitle.

subtitle_config

SubtitleConfig object

Subtitle configuration.

dx

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:
  • The canvas size is based on the model resolution. For example, for a model with the resolution of 1920 x 1080, the value of dx ranges from 0 to 1920.

dy

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:
  • The canvas size is based on the model resolution. For example, for a model with the resolution of 1920 x 1080, the value of dy ranges from 0 to 1080.

is_enable_super_resolution

Boolean

Whether super resolution is enabled for a video.

NOTE:

true: enable

false: do not enable

Table 57 SubtitleConfig

Parameter

Type

Description

dx

Integer

Coordinates of the pixel in the lower left corner of the subtitle.

NOTE:
  • The video resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16).

dy

Integer

Coordinates of the pixel in the lower left corner of the subtitle.

NOTE:
  • The video resolution is 1920 x 1080 in landscape mode (16:9) and 1080 x 1920 in portrait mode (9:16).

font_name

String

Font. The following fonts are supported:

  • HarmonyOS_Sans_SC_Black: HarmonyOS bold
  • HarmonyOS_Sans_SC_Regular: HarmonyOS normal
  • HarmonyOS_Sans_SC_Thin: HarmonyOS light

font_size

Integer

Font size.

The value ranges from 4 to 120.

h

Integer

Subtitle box height

NOTE:
  • The parameter h is used to facilitate the calculation of the coordinates in the upper left corner of the subtitle box by the front end. This parameter is not used in the background.

w

Integer

Subtitle box width

NOTE:
  • The subtitle box width is fixed at 80/ %of the screen width.
  • The parameter w is used to facilitate the calculation of the coordinates in the upper left corner of the subtitle box by the front end. This parameter is not used in the background.
Table 58 LiveEventCallBackConfig

Parameter

Type

Description

live_event_type_callback_url

String

Live event callback URL. HTTPS URL, which must contain an authentication string.

auth_type

String

Authentication type.

  • None: The URL contains authentication.
  • MSS_A: In HMACSHA256 signature mode, the hwSecret and hwTime parameters are added to the URL. Value format: hwSecret=hmac_sha256(Key, URI (live_event_callback_url) + hwTime)&hwTime=hex(timestamp)
  • MSS_A_HEAD: In HMACSHA256 signature mode, the hwSecret and hwTime parameters are placed in Head.

    Value format: x-hw-mss-secret=hmac_sha256(Key, URI (live_event_callback_url) + hwTime)

    x-hw-mss-time=hex(timestamp)

  • MEITUAN_DEFAULT: This parameter is used only for Meituan's API callback.

key

String

Key

callback_event_type

Array of strings

Live event types in callbacks.

Currently, only the following options are supported:

  • SHOOT_SCRIPT_SWITCH: script paragraph switching event
  • RTMP_STREAM_STATE_CHANGE: RTMP link change callback event
  • REPLY_COMMAND_FINISH: Playback is complete.

    The callback event structure is defined as follows:

  • event_type: event type
  • message: event description

    The SHOOT_SCRIPT_SWITCH event callback is defined as follows:

{
  "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"}"
}
Table 59 RTCLiveEventCallBackConfig

Parameter

Type

Description

rtc_callback_event_type

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: message type
  • data: message description

    The LIVE_PROGRESS event callback 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"
  }"
}
Table 60 ReviewConfig

Parameter

Type

Description

no_need_review

Boolean

Content review whitelist. This feature is available only for users in the whitelist. The auto review policies apply to other users.

Table 61 SharedConfig

Parameter

Type

Description

shared_type

String

Sharing type.

  • PRIVATE: accessible only to the current tenant
  • PUBLIC: accessible to all tenants. Currently, only system assets are accessible to all tenants.
  • SHARED: accessible to specified tenants. The tenants are specified by the owner.

shared_state

String

Sharing status.

  • PUBLISHED: published. The template is available.
  • DRAFT: draft. The template is being edited and can be viewed only by the owner.
  • REVIEW: The template is being reviewed. The template cannot be edited and can be viewed only by the owner/reviewer.

expire_time

String

Time when the sharing expires. If this parameter is left blank, the sharing never expires.

allowed_project_ids

Array of strings

Tenants allowed to access the asset.

Table 62 CoStreamerConfig

Parameter

Type

Description

voice_config

VoiceConfig object

Voice configuration parameter.

streamer_action

String

Behavior of the streamer when the co-streamer speaks.

  • SILENCE: silent
  • VOLUME_DOWN: decreased volume
Table 63 VoiceConfig

Parameter

Type

Description

voice_asset_id

String

Timbre asset ID.

speed

Integer

Speech speed.

The value defaults to 100 and ranges from 50 to 200.

NOTE:
  • The value 100 indicates the normal speaking speed of an adult, which is about 250 words per minute.
  • 50 indicates 0.5x speaking speed, 100 indicates normal speaking speed, and 200 indicates 2x speaking speed.

pitch

Integer

Pitch.

The value defaults to 100 and ranges from 50 to 200.

volume

Integer

Volume.

The value defaults to 140 and ranges from 90 to 240.

Table 64 ErrorResponse

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 400

Table 65 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 401

Table 66 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 500

Table 67 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

PUT https://{endpoint}/v1/70b76xxxxxx34253880af501cdxxxxxx/smart-live-rooms/24bad716-87b1-45e5-8912-6102f7693265

{
  "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."
      }
    } ]
  } ]
}

Example Responses

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.