Skip to content

Turning On SSAI โ€‹

Updated

This is the actual procedure for attaching SSAI to a StreamPackage endpoint. The region is configured based on ap-seoul.

Request Example โ€‹

After creating the endpoint, enable SSAI with the modify API.

text
1. CreateStreamPackageChannelEndpoint   Create a general endpoint
2. ModifyStreamPackageChannelEndpoint   SSAIEnable True
3. DescribeStreamPackageChannel         Verify the change is applied

Step 1. Create an Endpoint โ€‹

bash
tccli mdp CreateStreamPackageChannelEndpoint --region ap-seoul \
  --Id 6AA6****32BF \
  --Name justinkim_ssai_hls \
  --AuthInfo '{"WhiteIpList":,"BlackIpList":,"AuthKey":""}' \
  --Protocol HLS \
  --Manifest index

After creating the endpoint, enable SSAI with the modify API.

After creation, check the 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'])
"

Step 2. Enable SSAI โ€‹

Prepare the settings as a JSON file.

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

Send the modify call.

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

On success, only RequestId is returned.

json
{
  "RequestId": "c77cc472-5db2-46b1-9df7-47a7c1a766dd"
}

Step 3. Confirm Application โ€‹

After the modification, check the applied settings with the 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))
"

This is the actual applied result.

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}

Field Description โ€‹

FieldValueDescription
AdsUrlURLAd decision server. Must respond with VAST
SlateAdMP4 URLDefault video played when the ad is not filled
ThresholdSecondsHow many seconds to wait for the ad response. If exceeded, slate
DashMPDLocationboolUse DASH MPD location
AdMarkerPassthroughboolWhether to pass markers through as-is
SCTE35AdType1 / 21 processes all, 2 enhanced (some types only)
AdTriggers[1,8] arrayMarker types to treat as ads
DeliveryRestrictions[1,4]Distribution restriction conditions

tccli Notation Guide โ€‹

Top-level booleans in the CLI are written as True / False, and booleans inside JSON are written as true / false.

ADS Parameter Substitution โ€‹

Using ConfigAliases lets you dynamically append values to the ADS URL. It is used when requesting different ads by viewer region or device.

json
"ConfigAliases": [
  {
    "ParamName": "region",
    "AliasValueList": [
      { "Alias": "seoul", "Value": "kr" },
      { "Alias": "tokyo", "Value": "jp" }
    ]
  }
]

Next Steps โ€‹

Built with VitePress ยท Deployed on Tencent EdgeOne Pages