此文档,描述的是VAML协议。使用者可以通过VAML协议,控制数字人一段时间内的:播报内容,动作,卡片等。
一、协议示例
<?xml version="1.0" encoding="utf-8"?>
<scene interrupt="false" unique_code="${uuid}">
<section>
<avatar ai_action="true">
<action begin_index="2" code="动作code1" interrupt="true"/>
<action begin_index="12" code="动作code2" interrupt="true"/>
<action begin_index="17" code="动作code3" interrupt="false"/>
</avatar>
<frame>
<card begin_index="1" end_index="8" code="bizspace::subtitle" data="家用大功率吹风机,"/>
<card begin_index="9" end_index="15" code="bizspace::subtitle" data="不伤发快速干发。"/>
<card begin_index="15" end_index="26" code="bizspace::subtitle" data="然后它的附加功能是速干的。"/>
</frame>
<speech>
家用大功率吹风机,不伤发快速干发。然后它的附加功能是速干的。
</speech>
</section>
</scene>
二、详细结构介绍
Element | Description | Section |
<scene> | 描述播报的一个场景 | 2.1 |
<section> | 描述场景的一个片段 | 2.2 |
<avatar> | 描述片段中的数字人 | 2.2.1 |
<frame> | 描述片段中的卡片信息 | 2.2.2 |
<speech> | 描述片段中的数字人播报文本内容 | 2.2.3 |
2.1 <scene>
示例
<scene unique_code="${uuid}">
<section>
<speech> 大家好, 接下来我为大家介绍一下这款口红,厉害了, 它可是杨幂同款哦 </speech>
</section>
<section>
<speech> 现在有福利了, 外面买要988,我的直播间只要688 </speech>
</section>
</scene>
Attributes
Attribute | Type | Description |
unique_code | String | 尽量保证不重复,可以使用UUID,或者时间戳+随机数 |
interrupt | Boolean | 是否打断前一个未播报完成的场景, true: 打断,立即播报 false: 不打断,等待前一个场景播报完成再播报 默认值:false |
Children
Children | Type | Description |
section | List | 一个场景下需要播报的片段,支持传入多个片段,会按顺序执行 |
2.2 <section>
示例
<section>
<avatar>
...
</avatar>
<frame>
...
</frame>
<speech>
大家好, 接下来我为大家介绍一下这款口红,厉害了,它可是杨幂同款哦
</speech>
</section>
Attributes
无
Children
Children | Type | Description |
avatar | Object | 描述该片段数字人的信息,目前支持自定义数字人的动作 |
frame | Object | 描述该片段的需要显示的卡片信息 |
speech | Object | 描述该片段数字人的播报内容 |
2.2.1 <avatar>
示例
<avatar ai_action="true">
<action begin_index="2" code="动作code1" interrupt="true"/>
<action begin_index="12" code="动作code2" interrupt="true"/>
<action begin_index="17" code="动作code3" interrupt="false"/>
</avatar>
Attributes
Attribute | Values | Description |
ai_action | Boolean | 是否启用智能动作,true: 启用/false: 不启用。 启用智能动作,则将会在用户自定义的动作基础上通过AI智能添加部分动作进行融合,保障动作的丰富度,原则优先保留自定义动作; 不启用智能动作,则用户需要通过<action>标签添加自定义动作,避免出现数字人无动作的情况。 默认值:false |
Children
Children | Type | Description |
action | List | 描述数字人的动作信息,目前支持指定动作code |
2.2.1.1 <action>
示例
<action begin_index="2" code="动作code1" interrupt="false"/>
Attributes
Attribute | Values | Description |
begin_index | Integer | 描述该动作的起始位置,位置为speech中文本的下标,从0开始计算 |
code | String | 动作code,从数字人开放平台控制台的资产中心获取。 详细请参考1.2 获取数字人动作code。 |
interrupt | Boolean | 该动作播放的时候是否打断前一个未播放完成的动作,不打断则当前一个动作未播放完成则直接丢弃该动作,打断则直接打断前一个动作。 true:打断前一个动作 false:不打断前一个动作 默认值:true |
Children
无
2.2.2 <frame>
卡片目前仅支持在容器内渲染,通过推流方式输出到视频流中,不支持在客户拉流端渲染,即无法支持用户交互。
示例
<frame>
<card begin_index="1" end_index="8" code="bizspace::subtitle" data="家用大功率吹风机,"/>
<card begin_index="9" end_index="15" code="bizspace::subtitle" data="不伤发快速干发。"/>
<card begin_index="15" end_index="26" code="bizspace::subtitle" data="然后它的附加功能是速干的。"/>
</frame>
Attributes
Attribute | Values | Description |
begin_index | Integer | 描述该卡片的起始位置,位置为speech中文本的下标,从0开始计算 |
end_index | Integer | 描述该卡片的结束位置,位置为speech中文本的下标,从0开始计算 |
code | String | 卡片code |
data | String | 卡片的信息 |
Children
Children | Type | Description |
card | List | 描述播报时同步显示的卡片信息 |
2.2.2.1 <card>
不同业务场景下自定义卡片。 此处code为卡片平台上唯一身份,data为卡片渲染需要的业务数据,数据格式由卡片自己定义,如果是JSON数据需要做一次base64。
示例
<card begin_index="15" end_index="26" code="bizspace::subtitle" data="然后它的附加功能是速干的。"/>
Attributes
Attribute | Values | Description |
begin_index | Integer | 描述该卡片的起始位置,位置为speech中文本的下标,从0开始计算 |
end_index | Integer | 描述该卡片的结束位置,位置为speech中文本的下标,从0开始计算 |
code | String | 卡片code |
data | String | 卡片显示需要的数据 |
Children
无
2.2.3 <speech>
示例
<speech>
家用大功率吹风机,不伤发快速干发。
</speech>
Attributes
无
Children
Children | Type | Description |
文本 | String | 数字人播报的文本,最大1000个字,包含标点符号等字符 |
三、常用Case
3.1 我要指定播报文本的动作,如何实现?
通过SendMessage接口,发送VAML播报请求,可参考文档:数字人播报API接入指南
从虚拟数字人开放平台获取数字人动作code,具体参考1.2 获取数字人动作code
VAML文本内容参考下方,修改对应的<action>标签调整为自己想要的动作信息即可
<?xml version="1.0" encoding="utf-8"?>
<scene interrupt="false" unique_code="${uuid}">
<section>
<avatar ai_action="true">
<action begin_index="2" code="动作code1" interrupt="true"/>
<action begin_index="12" code="动作code2" interrupt="true"/>
<action begin_index="17" code="动作code3" interrupt="false"/>
</avatar>
<speech>
家用大功率吹风机,不伤发快速干发。然后它的附加功能是速干的。
</speech>
</section>
</scene>