Insert ads into a livestream with Pod Serving API

  • Server-side ad insertion (SSAI) with HLS or DASH livestreams uses the Pod Serving API to request adaptive bitrate ad pods.

  • Implementing this requires configuring a livestream event with the Pod serving redirect DAI type, a client app, a manifest manipulator, and a Google Ad Manager account with Pod serving DAI enabled.

  • The basic serving flow involves registering a session, polling ad metadata, requesting the manifest, constructing and stitching ad segment URLs into the manifest, and sending media verification pings.

  • The advanced serving flow, recommended for the manifest service, includes making an ad pod timing metadata request to retrieve precise timing for constructing and stitching ad segment URLs.

  • Both HLS and DASH protocols have specific steps for integrating with the Pod Serving API for livestream ad insertion.

To implement server-side ad insertion (SSAI) with HLS or DASH livestream, use the Pod Serving API to request adaptive bitrate ad pods. For supported resolutions and bitrates, see Video and audio formats and transcoding.

This page covers using the Pod Serving API for livestream.

Prerequisites

Before you continue, you must have the following:

  • Configure a livestream event with the Pod serving redirect Dynamic Ad Insertion (DAI) type. Choose either of the following options:

  • A client app running in a web browser, mobile device or TV, to load the stream and handle events, such as play, pause, click, or tap.

  • A manifest manipulator to handle stream requests from the client app. Important: For your manifest service, we recommend the advanced serving flow.

  • A Google Ad Manager account with Pod serving DAI enabled.

Basic serving flow

To deliver your stream, choose a streaming protocol and do the following:

HLS

  1. To register a session, make a stream request from your video player to Google Ad Manager.

  2. Start polling ad metadata for upcoming ad events.

  3. Request the livestream manifest from your manifest manipulator.

  4. Optional: Send an early ad break notification to Google Ad Manager. Important: We recommend this step for enhanced fill rate.

  5. When your manifest manipulator detects an ad break marker, construct the ad segment URLs and stitch them into the manifest.

    • During an ad break, your client video player requests an ad segment and follows the segment redirect URL to download the ad segment file.
  6. Extract the ad event IDs from ID3 tags to find and send media verification pings to Google.

Pod serving redirect with HLS - Basic serving
flow

DASH

  1. Follow all steps in the HLS tab.

  2. Request a DASH period template once and cache the template. This approach builds the periods for all ad breaks of the session.

Pod serving redirect with DASH - Basic serving
flow

Advanced serving flow

To deliver your stream, choose a streaming protocol:

HLS

  1. To register a session, make a stream request from your client video player to Google Ad Manager.

  2. Start polling ad metadata for upcoming ad events.

  3. Request the livestream manifest from your manifest manipulator.

  4. Optional: Send an early ad break notification to Google Ad Manager for enhanced fill rate.

  5. Make an ad pod timing metadata (ATM) request to Google Ad Manager.

  6. Retrieve the precise ad pod and slate time to construct the ad segment URLs.

  7. Stitch the ad segment URLs into the manifest.

  8. When your manifest manipulator detects an ad break marker, construct the ad segment URLs and stitch the URLs into the manifest.

    • During an ad break, your client video player requests an ad segment and follows the segment redirect URL to download the ad segment file.
  9. Extract the ad event IDs from ID3 tags to find and send media verification pings to Google.

Pod serving redirect with HLS - Advanced serving
flow

DASH

  1. Follow all steps in the HLS tab.

  2. Use the Ad pod Timing Metadata (ATM) responses for additional required fields to build the DASH periods.

Pod serving redirect with DASH - Advanced serving
flow

Step by step instructions

For details on API endpoints, example request and response data, see Client video player app for livestreams and Manifest manipulator for livestreams.