Media delivery
Media delivery is mostly caching and mostly solved, until access control enters and the usual approach of long-lived public URLs stops being acceptable. The tension between cacheability and authorisation is the real design problem.
Method
- Serve from a CDN with long cache lifetimes. Media is large and usually immutable, which is the ideal caching case (see cdn-strategy).
- Make URLs content-addressed or versioned. Immutable URLs mean a change is a new URL, so caches never serve stale media (see http-caching).
- Support range requests. Seeking in audio and video depends on them, and without range support a player must download everything before playing.
- Use signed, expiring URLs for private media. They keep the CDN in the path while limiting access in time, which is the usual compromise between cacheability and control (see realtime-permissions).
- Never rely on unguessable URLs as access control. Links leak through referrers, screenshots, and sharing, and an unguessable URL is public with extra steps.
- Preload deliberately. The first visible image and the first video segment benefit; preloading everything competes with what the user actually needs now.
- Measure start time, not just throughput. Time to first frame is what users perceive, and it depends on segment size and connection setup as much as bandwidth.
Boundaries
Delivery optimisation cannot fix oversized source media, which is an encoding problem (see image-optimization). Signed URLs still permit sharing within their validity window. Regional performance varies, and edge coverage is a property of the provider rather than the configuration.