开启 SSAI
以下是在 StreamPackage Endpoint 上挂载 SSAI 的实际操作步骤。地域以 ap-seoul 为准进行配置。
请求示例
创建 Endpoint 后,通过修改 API 启用 SSAI。
text
1. CreateStreamPackageChannelEndpoint 创建通用端点
2. ModifyStreamPackageChannelEndpoint SSAIEnable True
3. DescribeStreamPackageChannel 确认是否生效第 1 步. 创建 Endpoint
bash
tccli mdp CreateStreamPackageChannelEndpoint --region ap-seoul \
--Id 6AA6****32BF \
--Name justinkim_ssai_hls \
--AuthInfo '{"WhiteIpList":,"BlackIpList":,"AuthKey":""}' \
--Protocol HLS \
--Manifest index创建 Endpoint 后,通过修改 API 启用 SSAI。
创建后确认 URL。
bash
tccli mdp DescribeStreamPackageChannel --region ap-seoul --Id 6AA6****32BF \
| python3 -c "
import sys,json
for e in json.load(sys.stdin)['Info']['Points']['Endpoints']:
print(e['Name'], e['Url'])
"第 2 步. 启用 SSAI
将配置准备为 JSON 文件。
bash
cat > /tmp/ssai.json <<'EOF'
{
"AdsUrl": "https://ads.example.com/vast?cid=****",
"SlateAd": "https://cdn.example.com/slate.mp4",
"Threshold": 12,
"DashMPDLocation": true,
"AdMarkerPassthrough": false,
"SCTE35AdType": 1,
"AdTriggers": [1, 2, 4, 5],
"DeliveryRestrictions": 4
}
EOF发送修改调用。
bash
tccli mdp ModifyStreamPackageChannelEndpoint --region ap-seoul \
--Id 6AA6****32BF \
--Url "https://13******46.ap-seoul.streampackage.srclivepull.myqcloud.com/v1/01a0****6005/01a0****86d9/index.m3u8" \
--Name justinkim_ssai_hls \
--AuthInfo '{"WhiteIpList":,"BlackIpList":,"AuthKey":""}' \
--Protocol HLS \
--SSAIEnable True \
--SSAIInfo "$(cat /tmp/ssai.json)"成功时仅返回 RequestId。
json
{
"RequestId": "c77cc472-5db2-46b1-9df7-47a7c1a766dd"
}第 3 步. 确认生效
修改后,用 Describe API 确认已生效的配置。
bash
tccli mdp DescribeStreamPackageChannel --region ap-seoul --Id 6AA6****32BF \
| python3 -c "
import sys,json
for e in json.load(sys.stdin)['Info']['Points']['Endpoints']:
print(e['Name'], 'SSAIEnable =', e.get('SSAIEnable'))
print(' ', json.dumps(e.get('SSAIInfo'), ensure_ascii=False))
"实际生效结果如下。
text
justinkim_quickstart_hls SSAIEnable = False
justinkim_ssai_hls SSAIEnable = True
{"AdsUrl": "https://ads.example.com/vast?cid=****",
"SlateAd": "https://cdn.example.com/slate.mp4",
"Threshold": 12,
"DashMPDLocation": true,
"AdMarkerPassthrough": false,
"SCTE35AdType": 1,
"AdTriggers": [1, 2, 4, 5],
"DeliveryRestrictions": 4}字段说明
| 字段 | 值 | 说明 |
|---|---|---|
AdsUrl | URL | 广告决策服务器。必须以 VAST 响应 |
SlateAd | MP4 URL | 广告未填充时播放的默认视频 |
Threshold | 秒 | 等待广告响应的秒数。超时则播放垫播片 |
DashMPDLocation | bool | 使用 DASH MPD location |
AdMarkerPassthrough | bool | 是否将 Marker 原样透传 |
SCTE35AdType | 1 / 2 | 1 全量处理,2 enhanced(仅部分类型) |
AdTriggers | [1,8] 数组 | 视为广告的 Marker 类型 |
DeliveryRestrictions | [1,4] | 分发限制条件 |
tccli 书写说明
CLI 顶层的布尔值写作 True / False,JSON 内的布尔值写作 true / false。
ADS 参数替换
使用 ConfigAliases 可以向 ADS URL 动态追加取值。适用于按观众地区或设备请求不同广告的场景。
json
"ConfigAliases": [
{
"ParamName": "region",
"AliasValueList": [
{ "Alias": "seoul", "Value": "kr" },
{ "Alias": "tokyo", "Value": "jp" }
]
}
]