You can use CDN service to improve the efficiency of StreamPackage ad replacement service. The benefits of CDN include content and ad caching, consistent domain names in personalized manifests, and CDN DNS resolution.
When using CDN, the request and response process of StreamPackage SSAI service is as follows:
1. The player sends a request to the CDN to obtain the playback manifest. The CDN forwards the request to StreamPackage.
2. StreamPackage retrieves the source stream manifest from the source stream server, performs ad replacement, and replaces the source stream content prefix and ad segment prefix with the source stream CDN prefix and SSAI service CDN prefix, respectively. The personalized manifest is sent to the CDN, which returns it to the player.
3. The player initiates a request to the segment URL in the manifest.
4. The CDN sends the source stream segment request to the source server and sends the ad request to the StreamPackage SSAI service.
5. The source server returns the source stream segment; when the SSAI service receives the ad request, it triggers the reporting of tracking data and redirects to obtain the actual ad segment as the return.
6. The player starts playing.
Use Tencent Cloud Streaming Services (CSS)
In CSS > Domain > Origin server mode > Select StreamPackage as the origin server type > Select the needed ad insertion configuration, the required configuration will be automatically distributed for the domain. Use Tencent Cloud CDN
Configuration Content
1. Main manifest request, the path starting with /v1/ssai/master
, not cached, directly transparent.
GET <StreamPackageURL>/v1/ssai/master/<uniq_id>/xxx.m3u8?xxx1=p1&xxx2=p2
2. Sub-manifest request, the path starting with /v1/ssai/manifest
, can be configured as a normal manifest. For example, in the HLS live scenario, refer to the cache configuration of the live .m3u8
file; in the HLS on-demand scenario, refer to the cache configuration of the on-demand .m3u8
file.
GET <StreamPackageURL>/v1/ssai/manifest/<uniq_id>/<session_id>/xxx.m3u8
3. Personalized ad request, the path starting with /v1/ssai/segment
, can be configured as a normal .ts
file.
GET <StreamPackageURL>/v1/ssai/segment/<uniq_id>/<session_id>/<asset_id>/<seq_num>
4. All request parameters are fully passed through.
Operation Process
1. In Tencent Cloud Console > CDN > Domain Management > Basic Configuration > Origin Server, configure the Origin-pull address and Origin Domain for the playback domain.You need to set it to the playback domain of the StreamPackage ad insertion configuration, which is the domain name in Playback endpoint prefix, in the format: {appid}.{region}.streampackage.srclivepull.myqcloud.com. 2. In Cache Configuration, set it to not ignore parameters, that is, all request parameters are completely transparent.
3. In Node Cache Validity Configuration, configure the cache separately for different requests based on the path.
Use Third-Party CDN
To use a third-party CDN to implement personalized ad replacement, you need to configure the following at the external CDN:
1. Main manifest request, the path starting with /v1/ssai/master
, not cached, directly transparent.
GET <StreamPackageURL>/v1/ssai/master/<uniq_id>/xxx.m3u8?xxx1=p1&xxx2=p2
2. Sub-manifest request, the path starting with /v1/ssai/manifest
, can be configured as a normal manifest. For example, in the HLS live scenario, refer to the cache configuration of the live .m3u8
file; in the HLS on-demand scenario, refer to the cache configuration of the on-demand .m3u8
file.
GET <StreamPackageURL>/v1/ssai/manifest/<uniq_id>/<session_id>/xxx.m3u8
3. Personalized ad request, the path starting with /v1/ssai/segment
, can be configured as a normal .ts
file.
GET <StreamPackageURL>/v1/ssai/segment/<uniq_id>/<session_id>/<asset_id>/<seq_num>
4. All request parameters are completely transparent.
Was this page helpful?