Managing the ad break duration provides you uninterrupted streams for your
users. When you call Google Dynamic Ad Insertion (DAI) Ad Break API and set the
expectedDuration parameter, Google DAI manages the ad break durations to
prevent ad-related playback errors, such as underfilled or overfilled ad pods.
Set the ad break expected duration
Set the expectedDuration parameter to the expected length of the ad break in
seconds, with up to nine fractional digits and ending with an s value, for
example: 30s or 29.899999999s.
Set the expectedDuration parameter close to the actual length of the ad break.
Avoid the following ad playback errors:
- Setting the duration too long: If the expected duration is longer than the actual ad break, the remaining time fills with a blank slate, creating a pause in the content.
- Setting the duration too short: If the expected duration is shorter than the actual ad break, the ad might cut off before finishing.
When the ad break begins to serve, Google DAI updates this duration value to match the actual duration of the ad break from the manifest, pod segment request or pod manifest request.
Understand ad segment duration
Google DAI determines the segment duration based on the type of your stream settings and the content segments.
Google DAI determines segment duration as follows:
- By default: If no duration is specified, Google DAI sets the ad segment duration to two seconds.
- HLS streams: The duration is the smaller of the stream's target duration, or five seconds.
- DASH streams: Google DAI sets the duration to the
MPD@maxSegmentDurationvalue from the manifest. If that value is not present, Google DAI uses the default duration.
After Google DAI determines the segment duration for an ad break, Google DAI uses that duration for all subsequent ad breaks in the same livestream.