Migrating from SSAI to SGAI in AWS Elemental MediaTailor: A Practical Field Guide
A practical guide to migrating from SSAI to SGAI in AWS Elemental MediaTailor: the key differences, how to enable SGAI, and the real-world gotchas (X-RESUME-OFFSET, preconditioned ads, preroll/midroll, player support) with diagnosis steps and a migration checklist.
AWS Elemental MediaTailor supports two ways to insert ads: Server-Side Ad Insertion (SSAI) and Server-Guided Ad Insertion (SGAI). If you already run SSAI and are evaluating SGAI, the trap is assuming SGAI is "SSAI with a flag flipped." It isn't - the responsibility for assembling the stream moves from the server to the player, and that shift surfaces a handful of issues that are easy to miss until you're debugging a black screen.
This guide is written for two audiences:
- If you're new to ad insertion, Part 1 explains the concept from scratch.
- If you're migrating SSAI → SGAI, Parts 2–4 are the field notes: the real gotchas, how to diagnose them, and a pre-migration checklist.
For the authoritative feature-by-feature comparison, see AWS's official SGAI feature compatibility matrix. This guide complements that with practical, field-tested troubleshooting that isn't consolidated in one place.
Part 1 - The concept in two minutes
The mental model:
- SSAI = the server builds one stream. MediaTailor calls your ad server, transcodes the ads to match your content, and stitches them directly into the media timeline. The player receives a single continuous stream and literally cannot tell content from ads.
- SGAI = the server gives the player directions. MediaTailor leaves the content stream untouched and instead signals the player - using HLS interstitials (
EXT-X-DATERANGEtags withCLASS="com.apple.hls.interstitial") - where the ad breaks are and where to fetch the ad assets. The player fetches and presents the ads itself.
Figure 1 - SSAI (left): MediaTailor stitches ads into one continuous stream. SGAI (right): MediaTailor signals; the player fetches and presents ads.
Why two approaches exist:
| SSAI (stitched) | SGAI (guided) | |
|---|---|---|
| Who assembles the stream | MediaTailor (server) | The player (client) |
| Device compatibility | Broadest - player-agnostic | Needs an interstitial-aware player |
| Ad-blocker resistance | High (ads are part of the stream) | Lower (client fetches ads separately) |
| Interactive ad UX (overlays, clickable, companions) | Limited | Strong |
| Manifest caching | Personalized per session | More cacheable |
| Best for | Broad-reach FAST / live / VOD, legacy devices | Premium apps on modern players, interactive ads |
A common real-world pattern: run SSAI for broad-reach inventory (legacy devices, FAST channels) and SGAI for premium app experiences where you control the player.
How you actually turn SGAI on (this is documented, and worth getting right):
- Set the playback configuration's
InsertionModetoPLAYER_SELECT. (SSAI is the default,STITCHED_ONLY.) - The player opts into guided mode at session start, either:
- Implicitly - append
aws.insertionMode=GUIDEDto the HLS multivariant playlist request URL, or - Explicitly - include
"insertionMode": "GUIDED"in the JSON body of the session-initializationPOST.
- Implicitly - append
PLAYER_SELECT is the key: it lets the same configuration serve stitched or guided sessions depending on what the player asks for. (Source: SGAI overview.)
Part 2 - Why "it works in SSAI" tells you almost nothing about SGAI
In SSAI, MediaTailor does the hard part: it assembles a finished stream and hands it over. The player just plays bytes.
In SGAI, MediaTailor hands the player a to-do list (the interstitial signaling). The player must:
- Understand HLS interstitials,
- Fetch the content from your origin/CDN,
- Fetch the ad assets from wherever they live,
- Present the ads at the right time, and
- Resume content correctly.
Every one of those steps is a new place for things to go wrong - and none of them were exercised by your working SSAI setup. So treat an SSAI→SGAI migration as a new integration to test end-to-end, not a config tweak. The rest of this guide is the list of things that actually break.
Part 3 - The migration gotchas (field notes)
Gotcha 1 - X-RESUME-OFFSET decides insertion vs replacement
Symptom: In SGAI, an ad break that inserted correctly under SSAI now replaces a span of your content - the program jumps forward by the ad's duration instead of resuming where it paused.
Why: SGAI interstitials carry an X-RESUME-OFFSET attribute (defined by Apple's HLS Interstitials specification) that tells the player where to resume primary content after the interstitial, relative to the interstitial's START-DATE:
- Insertion:
X-RESUME-OFFSETset to0- content resumes exactly where it paused; the ad is additive. - Replacement:
X-RESUME-OFFSETequal to the ad/interstitial duration - the content timeline advances past the break, so the ad takes the place of that content span.
Figure 2 - With X-RESUME-OFFSET=0 the ad is additive (insertion); with the offset equal to the ad duration the content timeline skips ahead (replacement).
The trap: markers authored for insertion (e.g., CUE-OUT/CUE-IN pairs added via MediaConvert ESAM) can come through SGAI as a replacement-style interstitial with X-RESUME-OFFSET set to the ad duration - even though the same markers insert correctly in SSAI.
How to diagnose: Pull the SGAI manifest and inspect the EXT-X-DATERANGE interstitial. Read the X-RESUME-OFFSET value and compare it to the ad/break duration. If they're equal, you're getting replacement.
Fix: Decide explicitly whether each break is insertion (content continues after the ad) or replacement (ad fills a content span - e.g., live-to-VOD blackout fills). Author your SCTE-35 / ad markers so the resulting X-RESUME-OFFSET matches that intent, and validate it on a live session.
Gotcha 2 - Preconditioned ads: the preconditioned-ads/ path and 403/404 on segments
Symptom: Ads play perfectly in SSAI, but in SGAI the player gets 403/404 on ad segments - while the ad manifests (.m3u8) load fine.
Why: Preconditioned ads are ads you transcode yourself (so MediaTailor skips dynamic transcoding); your ADS returns direct .m3u8/.mpd links in the VAST. In SGAI, MediaTailor can rewrite that ad URL into a path namespaced under your account, e.g.:
https://cdn.example.com/preconditioned-ads/<account_id>/<uuid>/stream_480p.m3u8
The ad manifests get placed at that path, but the ad segments (.ts/.mp4) only resolve if your CDN routes that path to the correct MediaTailor segments origin. If the segment routing isn't set up, manifests load and segments 403/404.
(The preconditioned-ads/<account_id>/<uuid>/ path rewrite is a field observation from real SGAI integrations; the preconditioned-ads concept itself is documented at the link above. Validate the exact path against your own session.)
How to diagnose: Open the asset-list / ad manifest the player fetched. Confirm the ad .m3u8 loads (200) but a child segment returns 403/404. Check whether the segment path includes the preconditioned-ads/ prefix and whether your CDN has a behavior/origin for it.
Fix: Make sure your ad-segment CDN prefix (the AdSegmentUrlPrefix in the playback config) routes the preconditioned-ads/ path to the correct MediaTailor segments origin, and confirm the mapping covers both manifests and segments. See Troubleshoot MediaTailor SSAI with CDNs and CDN troubleshooting.
Gotcha 3 - Preroll vs midroll misclassification at stream start
Symptom: A live event that opens with a midroll-style break is treated as a preroll by the player, which then applies the wrong UX rules - e.g., "no scrubbing during preroll" incorrectly blocks forward seek for the rest of the session.
Why: MediaTailor signals a pre-roll by adding a CUE attribute to the interstitial's EXT-X-DATERANGE tag - CUE="PRE,ONCE". Interstitial-aware players honor that cue: a PRE interstitial plays once before primary content, and the player applies pre-roll UX rules such as blocking scrubbing. If a break you intended as a mid-roll comes through signaled with CUE="PRE,ONCE", the player treats it as a pre-roll for the rest of the session.
How to diagnose: Pull the SGAI manifest and inspect the interstitial's EXT-X-DATERANGE. Look at the CUE attribute: PRE (typically PRE,ONCE) means the player will treat the break as a pre-roll; a mid-roll should not carry a PRE cue.
Fix: Make sure breaks you intend as mid-rolls are not being signaled with CUE="PRE,ONCE". Confirm the CUE attribute matches your intent for each break, and verify your specific player's pre-roll handling (scrubbing, skip, frequency capping) against your business rules.
Gotcha 4 - Player support is mandatory (and not universal)
Symptom: On some devices, SGAI plays content with no ads (or breaks entirely), while the same stream works on others.
Why: SSAI is player-agnostic because the ads are baked into the stream. SGAI is not - the client must understand HLS interstitials. A player that doesn't support the interstitial schema simply ignores the signaling.
How to diagnose: Reproduce on the failing device class and confirm the player supports HLS interstitials (Apple AVPlayer on iOS/tvOS does; recent hls.js does; many others vary by version). Check the player's interstitial/ads capability for that exact version.
Fix: Validate your entire device matrix for interstitial support before shifting inventory. For device classes that don't support SGAI, keep them on SSAI - PLAYER_SELECT lets the same config serve both, so those players just request STITCHED.
Part 4 - Pre-migration checklist
Before moving any inventory from SSAI to SGAI:
- [ ] Playback config
InsertionModeset toPLAYER_SELECT(notSTITCHED_ONLY). - [ ] Players append
aws.insertionMode=GUIDED(implicit) or send"insertionMode": "GUIDED"in the session POST (explicit). - [ ] Every target device/player version verified for HLS interstitial support.
- [ ] CDN routes the ad-segment path (including
preconditioned-ads/if you use preconditioned ads) to the correct MediaTailor segments origin - manifests and segments. - [ ] Insertion vs replacement intent confirmed per break;
X-RESUME-OFFSETvalidated on a live session. - [ ] Avail
START-DATEalignment checked against content start (preroll/midroll classification). - [ ] Client-side tracking/beaconing validated if you rely on it (SGAI uses a different, sessionless server-side beaconing model - see references).
- [ ] Devices without interstitial support left on SSAI (served via the same
PLAYER_SELECTconfig). - [ ] End-to-end playback tested on real devices, not just a manifest diff.
References
The basics are well documented. Use these for authoritative detail; this guide adds the migration gotchas on top.
- SGAI overview & how to enable it — https://docs.aws.amazon.com/mediatailor/latest/ug/server-guided.html
- SGAI feature compatibility matrix (official SSAI vs SGAI comparison) — https://docs.aws.amazon.com/mediatailor/latest/ug/sgai-feature-compatibility.html
- Using preconditioned ads — https://docs.aws.amazon.com/mediatailor/latest/ug/precondition-ads.html
- Troubleshoot SSAI with CDNs — https://docs.aws.amazon.com/mediatailor/latest/ug/troubleshooting-ssai-cdn.html
- Server-side tracking with SGAI — https://docs.aws.amazon.com/mediatailor/latest/ug/ad-reporting-server-side-sgai.html
- AWS M&E blog: Support for HLS Interstitials in MediaTailor — https://aws.amazon.com/blogs/media/support-for-hls-interstitials-in-aws-elemental-mediatailor/
- Language
- English
Relevant content
asked 3 years ago
asked 3 years ago
