Prefetch the next segment

Edge servers can only serve from cache what they've already fetched. On a cold path, the first request for every segment pays a trip to your origin, and the player feels it as startup delay or a rebuffer. Prefetching puts the next segment at the edge before the player asks for it.

Adaptive Media Delivery offers two ways to decide what "next" means. Both are off by default.

MethodWho decides what to prefetchAdd it when
CMCD segment prefetchingYour player, via Common Media Client Data hintsYour player can emit CMCD and you want the player's view of its own buffer to drive prefetching
Origin-assist prefetchingYour origin, via a response headerYour origin knows the segment sequence and can add a header to each response
🚧

They don't compose

If you configure both, CMCD prefetching overrides origin-assist prefetching.


Origin-assist prefetching

When edge servers fetch an object from your origin, the response carries a header naming the next object in the sequence. Edge servers read it and fetch that object too.

How it works

  1. The player requests {object-1}.
  2. Edge servers forward the request to your origin.
  3. Your origin returns {object-1} — plus a header telling Akamai to prefetch {object-2}. The header value is an absolute or relative URL path.
  4. {object-1} goes back to the player.
  5. Because the response carried a prefetch header, edge servers issue a prefetch request for {object-2}, marked with a request header so your origin can tell it apart.
  6. Your origin returns {object-2}, optionally with a header pointing at {object-3}.
  7. Edge servers cache {object-2}. They do not prefetch {object-3} at this point — {object-2} was itself prefetched, and recursive prefetching would never end.
  8. The player requests {object-2}.
  9. Edge servers serve it from cache. Now the {object-3} header is acted on, and the cycle continues.

What's supported

Streaming formatsHLS, DASH
Live or VODBoth
Origin typesYour Origin — no limitations.
Media Services Live — HLS only.
NetStorage — not supported.

What gets prefetched in an HLS stream

Object requestedWhat's prefetched nextNotes
Master playlist (.m3u8)One or more variant playlists (.m3u8)—
Variant playlist (.m3u8)One or more segments from that variantWhich segment depends on playhead position — hard to determine for VOD. For live it's typically one of the last three segments in the variant playlist. Typical extensions: .ts for video or video+audio; .aac, .ac3, .ec3 for audio-only; .vtt, .webvtt, .mp4 for subtitles. With CMAF segments: .mp4, .m4v for video, .mp4, .m4a for audio.
Variant playlist (.m3u8)Zero or one init segment (#EXT-X-MAP) from that variantAlmost exclusively CMAF. Typically .mp4, .m4v, .m4a.
SegmentThe next segment in presentation time—

What gets prefetched in a DASH stream

Object requestedWhat's prefetched next
Manifest (.mpd)init segments for audio and video, then the audio and video segments themselves. DASH has no bitrate-specific playlists and content is always demuxed, so after the MPD the player typically requests two segments — one video, one audio.
Init segmentOne or more content segments
SegmentThe next segment in presentation time

1 - Set up your origin

Akamai tells your origin that prefetching is enabled

Edge servers send this request header:

CDN-Origin-Assist-Prefetch-Enabled: 1

Your origin responds with what to prefetch

Your origin returns a prefetch response header holding the absolute or relative path of the next object, plus Content-Length:

CDN-Origin-Assist-Prefetch-Path: <absolute|relative path of the prefetchable object's URL>
Content-Length: x

Akamai builds the full prefetch URL from the player-requested URL of the current object plus the path in this header.

Absolute paths start with a forward slash, and are used exactly as given:

Player request URLPrefetch header valuePrefetched URL
https://property-hostname/some/1234/video-100k/pl.m3u8/hls/live/1234/video-100k/seg1.tshttps://property-hostname/hls/live/1234/video-100k/seg1.ts
https://property-hostname/thing/1234/video-100k/seg1.ts/hls/live/1234/video-100k/seg2.tshttps://property-hostname/hls/live/1234/video-100k/seg2.ts

Relative paths omit the leading slash. Akamai uses the current request's forward path minus the filename as the base:

Player request URLPrefetch header valuePrefetched URL
https://property-hostname/some/1234/video-100k/pl.m3u8video-100k/seg1.tshttps://property-hostname/some/1234/video-100k/seg1.ts
https://property-hostname/thing/1234/video-100k/seg1.tsseg2.tshttps://property-hostname/thing/1234/video-100k/seg2.ts

In both tables, property-hostname is the HTTP/1.1 Host header as seen by Akamai.

One path per header, repeated — order determines fetch order, and all headers must use the same name:

CDN-Origin-Assist-Prefetch-Path: /hls/live-streaming/fifa/france-croatia/video-1000k/pl.m3u8
CDN-Origin-Assist-Prefetch-Path: /hls/live-streaming/fifa/france-croatia/audio/pl.m3u8
Content-Length: x
📘

Middle-layer proxies may not preserve header ordering, so content may not be fetched in the order you intended.

Or multiple paths in one header, comma-separated — order still determines fetch order, and the proxy ordering problem doesn't apply:

CDN-Origin-Assist-Prefetch-Path: /hls/live-streaming/fifa/france-croatia/video-1000k/pl.m3u8,/hls/live-streaming/fifa/france-croatia/audio/pl.m3u8
Content-Length: x

Akamai makes the prefetch request

Every prefetch request carries this header, so your origin can distinguish it from a real player request:

CDN-Origin-Assist-Prefetch-Request: 1

The object is then cached until the player asks for it. Your origin can include another prefetch header on this response to continue the chain.

2 - Add the behavior

Add the Segmented Media Streaming - Prefetch behavior and set Enable Origin-Assisted Prefetch to On.


CMCD segment prefetching

Here the player supplies the hints. Your media player sends Common Media Client Data with each request, including where its buffer stands and what it will ask for next; edge servers use that to prefetch. See Collect player telemetry with CMCD for the full picture of what CMCD does.

Client-side data you need

To drive prefetching, the player's CMCD payload has to include the buffer length key plus a next-object key:

KeyPurpose
Buffer length (bl)The player's current buffer. Akamai uses it to keep prefetching proportionate to buffer fill — if bl is exceeded, CMCD prefetching is disabled for that player, leaving it with a comfortable buffer.
Next object request (nor)The relative path to the next object. Use this when your segments are stored as individual objects. Akamai builds the prefetch URL relative to the requested segment.
Next range request (nrr)The byte range of the next request. Use this when the media sits in one large contiguous object and byte-range requests fetch individual segments.

Rules for nor:

  • URL backtracking is supported with advanced metadata.
  • The extension in the triggering request URL and the nor prefetch URL must match, and the filename in nor should match the triggering request's filename.
  • Prefetch applies only to HLS and DASH URLs.
  • Multiple-URL prefetch in nor is supported in CMCD v2.

Rules for nrr:

  • CMCD v1: nrr must accompany nor, with the same filename in nor as in the triggering request.

  • CMCD v2: nrr is merged into nor and is no longer required. Range information is expressed with the r parameter inside nor:

    nor=("segment8.ts";r="2000000-4000000" "segment8.ts";r="2000000-8000000" "segment8.ts";r="2000000-10000000")
📘

Partial object caching limits

The minimum object size for partial object caching is 10 MB — anything smaller and the whole object is prefetched, defeating the purpose. And there's a 10-fragment limit: if your request's byte range exceeds it, prefetching isn't applied.

Delivery-side setup

CMCD data arrives either as custom HTTP request headers or as a query argument — never both in the same request, and if both are present the query argument is ignored. Set your environment up for whichever your player uses. See Collect player telemetry with CMCD for the CORS and cache key configuration this needs.

Add the behavior

Add the Common Media Client Data support behavior and set CMCD Segment Prefetch to On. Place it in the same rule tree as your other CMCD settings:

  • The same rule — one match criterion governs all your CMCD settings together.
  • A child rule — the parent carries the header or query string support, and the child narrows prefetching to its own criterion.

Test it

Confirm your player supports CMCD and test the prefetching configuration thoroughly on staging. Verify the player-to-origin interactions before you activate on production.

Caveats and known issues

IssueDetail
CMCD prefetching overrides origin-assistConfigure one or the other.
Log sizes growEntries can go from about 300 bytes to 512. Account for it in DataStream 2 collection and storage.
Custom prefetch solutions can collideA custom implementation through advanced metadata plus CMCD prefetching can produce duplicate prefetch requests, raising origin load and slowing delivery. Talk to your account team if you have one.
Prefetches can amplify a denial of service attackIf a byte range isn't properly specified, a range request can prefetch a full VOD asset instead of a segment. Make sure your player requests ranges correctly.
Not supported with media encryption for DASHSee Encrypt media segments at the edge.
Not recommended with watermarkingEdge servers can't apply Segmented Media Streaming - Prefetch and Watermarking to a single request. Keep them out of the same rule, and don't put one in the default rule set while the other sits in a lower rule. See Trace leaked content with forensic watermarking.

Related


Did this page help you?