tencent cloud

StreamPackage

Concept Overview

Download
Focus Mode
Font Size
Last updated: 2026-07-31 15:56:43

Introduction

Use StreamPackage ad prefetching for live streams to help reduce peak load on ad decision servers (ADS) and decrease manifest delivery latency at the start of each ad break. When you define a prefetch schedule, StreamPackage follows the schedule to retrieve ads from the ADS and prepare them for ad insertion before they're needed for an ad break. During live streaming, prefetching can help mitigate decreased ad fill rates and missed monetization opportunities caused by request and transcoding timeouts or other network delays.
In the ad prefetching feature, you can create one or more prefetch schedules based on your business needs. A prefetch schedule defines how and when StreamPackage prefetches ads to prepare for upcoming ad breaks.
Single prefetch schedule: If an event has ad avails that are on a predictable schedule, use a single prefetch schedule. Each single prefetch schedule defines a single set of ads for StreamPackage to place in a single ad avail. To prefetch ads for multiple ad avails when you use single prefetch schedules, you must create multiple prefetch schedules (up to 24 hours before the ad avail) that correlate to each ad avail.
Recurring prefetch schedule: If an event has ad avails that aren't on a predictable schedule, use a recurring prefetch schedule. A recurring prefetch schedule automatically creates a schedule and prefetches ads before each ad break in an event. The recurring prefetch schedule retrieves ads for every ad avail within a defined period of time (up to 24 hours before the event ends). You don't need to create a schedule for each ad avail, but you do lose some of the timing control that single prefetch offers.
During program playback, when a client sends a manifest request to StreamPackage, StreamPackage evaluates all prefetch schedules associated with the playback configuration. If no matching prefetch schedule is found, the service reverts to normal ad insertion and does not perform ad prefetching. If a matching prefetch schedule is found, the service executes the plan based on two components: prefetching and delivery. The following sections distinguish between single and recurring prefetch and provide an overview of the prefetching and consumption process.

Single Prefetch Introduction

Prefetch / Retrieval

The prefetch or retrieval window defines the time range during which StreamPackage prefetches ads from the ADS. Be sure to schedule this window for a time that's before the ad break. Within this specified prefetch window, StreamPackage sends requests to the ADS to prefetch and prepare ads for subsequent ad insertion during playback. StreamPackage optionally uses traffic shaping to limit the number of requests sent to the ADS at one time. You can choose between two methods:
Time-window traffic shaping: StreamPackage spreads requests across the specified number of seconds instead of sending requests for all sessions at one time. This dispersed traffic distribution helps to prevent the ADS from becoming overwhelmed, resulting in time outs and low ad fill rates.
TPS-based traffic shaping: StreamPackage limits requests based on transactions per second (TPS) and number of concurrent users. This method provides more intuitive configuration based on your ADS capacity limits.
Additionally, if you set up dynamic variables, StreamPackage includes these variables in the requests to the ADS. StreamPackage uses these variables to match ad avails to prefetch schedules during the consumption window.

Consumption

When StreamPackage encounters SCTE-35 ad break markers, it places the prefetched ads in an ad break.
If you didn't set avail matching criteria, StreamPackage inserts ads in the first break in the consumption window.
If you did set a dynamic variable key for avail matching criteria, StreamPackage evaluates these criteria against the dynamic variables that you set in the retrieval window. An ad break is eligible for prefetched ad insertion only if the avail matching criteria are met. StreamPackage inserts ads in the first break that meets the criteria.

Example

1. Ad prefetching: The live event runs from 7:45 AM to 10:00 AM, with an ad break scheduled for 8:15 AM. You configure StreamPackage to prefetch ads from 7:45 AM to 8:00 AM, with a traffic window of 60 seconds. If there are 500,000 concurrent users, StreamPackage sends requests to the ADS over 60 seconds, at approximately 8,333 requests per second (500,000 users / 60 seconds = 8,333 requests per second), instead of sending all requests simultaneously.
2. Variable configuration: The prefetch configuration includes a dynamic variable (key: scte.event, value: 1234). StreamPackage includes this variable when sending requests to the ADS.
3. Ad delivery: You set the start time for ad breaks and delivery to 8:15 AM and the end time to 8:17 AM. You use scte.event_id in the availability matching conditions. For each ad slot that appears between 8:15 AM and 8:17 AM, StreamPackage analyzes the SCTE event ID of the ad slot. If the ad slot's event ID is 1234, StreamPackage inserts the prefetched ads. If the ad slot's event ID is not 1234, StreamPackage does not insert the prefetched ads and instead follows the standard ad insertion process.

Recurring Prefetch Introduction

Prefetch / Retrieval

The recurring retrieval window defines the time range during which StreamPackage prefetches and inserts ads for a live event (up to 24 hours). After each ad break in the window, StreamPackage automatically retrieves ads for the next ad break. If you set the delay after avail end, StreamPackage waits the specified time before retrieving the next set of ads for the next ad break. StreamPackage optionally uses traffic shaping to limit the number of requests to the ADS at one time. You can choose between two approaches:
Time-window traffic shaping: StreamPackage spreads requests across the specified number of seconds instead of sending requests for all sessions at one time. This dispersed traffic distribution helps to prevent the ADS from becoming overwhelmed, resulting in time outs and low ad fill rates.
TPS-based traffic shaping: StreamPackage limits requests based on transactions per second (TPS) and number of concurrent users. This method provides more intuitive configuration based on your ADS capacity limits.
Additionally, if you set up dynamic variables, StreamPackage includes these variables in the requests to the ADS. StreamPackage uses these variables to match ad avails to prefetch schedules during the consumption window.

Consumption

When StreamPackage encounters SCTE-35 ad break markers, it places the prefetched ads in an ad break.
If you set the retrieved ad expiration, prefetched ads are available for insertion until the specified expiration.
If you didn't set avail matching criteria, StreamPackage inserts ads in the first break in the consumption window.
If you did set a dynamic variable key for avail matching criteria, StreamPackage evaluates these criteria against the dynamic variables that you set in the retrieval window. An ad break is eligible for prefetched ad insertion only if the avail matching criteria are met. StreamPackage inserts ads in the first break that meets the criteria.

Example

1. Ad prefetching: The live event runs from 7:00 PM to 8:45 PM and includes four ad breaks during this period, with their specific timing being unpredictable. You can configure periodic prefetching from 7:00 PM to 8:45 PM, with a traffic shaping window of 60 seconds and a delay time of 10 minutes. Based on the 60-second traffic shaping window and 500,000 concurrent users, StreamPackage sends requests to the ADS over 60 seconds at an average rate of 8,333 requests per second (500,000 users / 60 seconds = 8,333 requests per second), instead of sending all requests simultaneously. Furthermore, after each successful ad insertion, StreamPackage waits for ten minutes before sending another prefetch request to the ADS.
2. Variable configuration: The prefetch configuration includes a dynamic variable (key: scte.event, value: 1234). StreamPackage includes this variable when sending requests to the ADS.
3. Ad delivery: During ad delivery, you use scte.event_id in the availability matching conditions. For each ad slot detected by StreamPackage, StreamPackage analyzes the SCTE event ID of the ad slot. If the ad slot's event ID is 1234, StreamPackage inserts the prefetched ads. If the ad slot's event ID is not 1234, StreamPackage does not insert the prefetched ads and instead follows the standard ad insertion process.
4. Set expiration time: You can set the expiration time for prefetched ads to 2700 seconds. This makes the prefetched ads available for use within 45 minutes, after which they expire.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback