AD insertion
With the advancement of streaming media technology and applications on internet, it is apparent that ad-supported streaming media delivery has become a major monetization strategy. By using Tencent Cloud's Stream Service, you can implement dynamic ad insertion based on SCTE-35 ad markers and SSAI. The complete general process of SSAI is as follows:
1)The publisher pushes the live stream to StreamLive for transcoding, packaging, and inserting SCTE-35 ad markers, and then transmits it to StreamPackage. If there are no subsequent processes, step 1) has already completed all server-side steps in CSAI.
2)The player requests the manifest (m3u8/mpd), and StreamPackage fetches the origin manifest while parsing the manifest and checking the SCTE-35 ad markers.
3)StreamPackage send the request to the Ad Decision Server, parses the VAST/VMAP response, and obtains the ad video address.
4)StreamPackage downloads the ad video, transcodes and stores it.
5)StreamPackage updates the transcoded ad segment url in the manifest by inserting and replacing, and then distribute it.
6)After the ad is played on the client-side, StreamPackage reports to the ad Tracking service for tracking the event.
1. Enabling AD Configuration
Click the channel name or Info on the right to go to the channel details page. In the endponts tab, you can enable Ad Configuration for the endpoints:
Click AD Configuration to enter the configuration page which includes:
Ad decision server:The URL for the ad decision server (ADS).
Configuration aliases:Configuration aliases are used for dynamic variable replacement.
Personalization details:Optional settings for ad break personalization.
Advanced settings:Advanced settings allow you to fine-tune properties related to your content delivery network (CDN) prefix, DASH.
2. Configuring URL for the ADS
The ad decision server (ADS) is the origin server that’s providing content to StreamPackage. It determines which ads StreamPackage will insert in ad breaks in the manifest. The URL for the ad decision server (ADS) is an address starting with http:// or https://. Maximum 25,000 characters. 3. Configuring aliases
Player parameters and aliases used for dynamic variable replacement. Click Add player parameter, Edit, Delete on the right to maintain player parameters. Parameter name can contain up to 32 letters, digits, underscores(_), and hythens(-).
Enter alias key name and alias value in the parameter. You'll use the alias key as a player parameter variable during dynamic variable replacement. StreamPackage will replace the alias key with the mapped alias value.
An example:
1)URL for the ADS
https://my.ads.com/path?ad_type=[player_params.ad_type]®ion=[player_params.region]
2)Aliases for dynamic variable replacement
"ConfigurationAliases": {
"player_params.ad_type": {
"customized": "abc",
"default": "default"
},
"player_params.region": {
"india": "ap-mumbai",
"japan": "ap-tokyo"
},
}
3)Add key-value in the request to StreamPackage
<master>.m3u8?ad_type=customized®ion=india
4)StreamPackage will pass the parameters to ADS
https://my.ads.com/path?ad_type=abc®ion=ap-mumbai
4. Setting default slate ad
The slate ad is a default ad that’s used if an ad break isn’t filled by an ad replacement. It lets you define what happens when an ad break isn’t completely filled by the ads dictated by the ad decision server (ADS). This way, if an ad is unavailable or too short, or if network conditions prevent the ad decision server from responding to StreamPackage, you know exactly what will be played instead. If an ad slate isn’t specified, then the default is to show the underlying content stream. The URL for the slate ad is an address starting with http:// or https://. Maximum 25,000 characters.
The personalization threshold sets the maximum duration (in seconds) of underfilled ad time allowed in an ad break. If the duration of underfilled ad time exceeds the personalization threshold, then personalization of the ad break is abandoned and the underlying content is shown.
5. Advanced settings
Ad marker passthrough:Enable or disable ad marker passthrough.
DASH mpd location:Enable or disable DASH support for sticky HTTP redirect behavior in players that don't support sticky.
SCTE-35 ad message type:Specify how ad markers are packaged in the output.
6. Generating playback URL with inserted ad
After completing the configurations above, add txType=ssai to the Endpoint Url to generate the corresponding playback Url with inserted ad. For example:
Original Endpoint Url:
http://xxx.mediapackage.srclivepull.myqcloud.com/v1/<channel_id>/<stream_id>/ssai_test.m3u8
Corresponding Url with inserted ad:
http://xxx.mediapackage.srclivepull.myqcloud.com/v1/<channel_id>/<stream_id>/ssai_test.m3u8?txType=ssai
7. Origin manifest and personalized manifest after replacement
The following examples provide a comparison between the origin manifest and the personalized manifest after replacement.
Origin manifest
Here is an example of the HLS master manifest obtained by StreamPackage from the original stream:
tx_ssai_temp1.m3u8
tx_ssai_temp2.m3u8
tx_ssai_temp3.m3u8
Here is an example of the HLS media manifest obtained by StreamPackage from the original stream, which includes inserted SCTE-35 markers:
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907362016.ts?&3835223
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907368016.ts?&3835224
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907370349.ts?&3835225
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907374016.ts?&3835226
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907380016.ts?&3835227
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907380349.ts?&3835228
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907386016.ts?&3835229
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907392016.ts?&3835230
Personalized manifest
Here is an example of the personalized HLS master manifest generated by StreamPackage:
tx_ssai_temp1.m3u8?txSessionID=fd320a4d99ba7df952f5a214ed901935&txType=manifest
tx_ssai_temp2.m3u8?txSessionID=fd320a4d99ba7df952f5a214ed901935&txType=manifest
tx_ssai_temp3.m3u8?txSessionID=fd320a4d99ba7df952f5a214ed901935&txType=manifest
Here is an example of the personalized HLS media manifest generated by StreamPackage:
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907362016.ts?&3835223
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907368016.ts?&3835224
segment.ts?txType=segment&txSessionID=fd320a4d99ba7df952f5a214ed901935&txManifestName=tx_ssai_temp3.m3u8&txSeqNum=3835224
segment.ts?txType=segment&txSessionID=fd320a4d99ba7df952f5a214ed901935&txManifestName=tx_ssai_temp3.m3u8&txSeqNum=3835225
segment.ts?txType=segment&txSessionID=fd320a4d99ba7df952f5a214ed901935&txManifestName=tx_ssai_temp3.m3u8&txSeqNum=3835226
segment.ts?txType=segment&txSessionID=fd320a4d99ba7df952f5a214ed901935&txManifestName=tx_ssai_temp3.m3u8&txSeqNum=3835227
segment.ts?txType=segment&txSessionID=fd320a4d99ba7df952f5a214ed901935&txManifestName=tx_ssai_temp3.m3u8&txSeqNum=3835228
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907380349.ts?&3835228
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907386016.ts?&3835229
64998DFC00006B56A7AF-p0_tmplav9601_av9601-1689907392016.ts?&3835230
Was this page helpful?