Source and observed behavior#
Original report: shaka-project/shaka-player#6932 (Safari 16.3, Shaka 4.3.3, FairPlay HLS). The reporter uses expiring CDN URL tokens and can refresh DASH requests through Shaka networking filters, but cannot observe or intercept recurring HLS manifest requests in Safari. They also report being unable to catch HTTP 410 responses through the same player API.
Evidence level: reporter observation only. No reproduced packet capture, Shaka source audit, or native AVPlayer trace has been performed for this article. Root cause unverified.
Engineering question#
Who owns HLS playlist fetching in the actual playback path: Shaka's JavaScript networking engine, Safari's native HLS loader, or application-controlled URL loading? A request filter can modify only requests routed through the layer that invokes it. The fact that a DASH filter runs does not establish that native HLS playlist requests pass through the same API.
Causal boundary#
Shaka configuration → native src= versus MSE selection → manifest URL supplied to video element → playlist refresh owner → HTTP 410 from expiring CDN token → player-observable error / playback failure.
The first boundary to prove is request ownership. An HTTP 410 and lack of Shaka filter callback are not, by themselves, evidence that Safari ignored a callback it was supposed to invoke.
Competing hypotheses and falsification#
- Native Safari HLS owns playlist refreshes, bypassing Shaka's networking filters. Verify actual
src=/MSE mode and correlate network requests against filter invocation. - Shaka filters are installed too late or on the wrong player instance. Install before
load(), log player/load generation and verify with a controlled application-owned request. - Signed URL expires for playlist reload but segment URLs remain valid (or vice versa). Correlate exact request type, expiry and final HTTP status without logging credentials.
- Redirects or CDN cache behavior change the effective signed URL. Record redacted redirect chains, final response status and timing.
- FairPlay key renewal is failing independently of CDN token expiry. Investigate only if key-session events or authorized KSM metadata demonstrate a distinct failure.
Controlled client-side experiment#
- Pin Safari/iOS/macOS build, Shaka version, exact configuration, native-HLS/MSE selection and manifest hashes.
- Test clear HLS versus authorized FairPlay HLS; compare native
src=and MSE only where the platform actually supports the selected mode. - Use a test CDN endpoint with a short-lived signed playlist URL and reproducible 410 responses. Log initial playlist, reload, segment and key requests separately with monotonic timestamps and sanitized URL identities.
- Instrument Shaka request/response filters, player errors,
HTMLMediaElementevents, and network captures. Do not assume JavaScript can intercept requests owned by native Safari media loading. - Compare a long-lived token, expiring token, and application-controlled manifest proxy where permitted. Change one variable at a time.
- In a separate native AVPlayer harness, capture
AVPlayerItemaccess/error logs, full NSError chains and actual network traffic. Do not assumeAVAssetResourceLoaderDelegatecan transparently intercept every HLS segment or playlist fetch.
Client-only guidance (conditional, not a proven fix)#
If native HLS owns refresh requests, avoid designing token renewal around Shaka networking filters alone. Evaluate an application-controlled stable playback URL or bounded player reinitialization with refreshed authorization where permitted, documenting playback continuity tradeoffs. CDN/origin token policy, redirect behavior and URL signing changes are separate server-side proposals. Do not claim any option works until tested against the actual Safari build.
Reusable engineering rule#
Network request observability depends on which playback layer owns the request. A filter attached to a JavaScript player cannot be assumed to govern native HLS fetching.
Evidence gaps and publication status#
No byte-verified playlist, synchronized HTTP trace, pinned Shaka source inspection, or physical-device A/B experiment. This is a falsifiable investigation plan, not a verified root-cause diagnosis.
References#
- shaka-project/shaka-player#6932
- https://shaka-player-demo.appspot.com/docs/api/tutorial-network-and-buffering-config.html
- https://developer.apple.com/documentation/avfoundation
- https://www.rfc-editor.org/rfc/rfc8216
Extended investigation prompt#
Copy the specialized second-AI investigation prompt
Act as a senior iOS/tvOS reverse engineer, AVFoundation/CoreMedia investigator, Safari/WebKit HLS specialist, and FairPlay DRM security expert.
CASE: https://github.com/shaka-project/shaka-player/issues/6932
SYMPTOM: Safari FairPlay HLS playlist reloads reportedly bypass Shaka request filters; expiring CDN URL tokens produce HTTP 410, while the same application can intercept DASH requests. The actual first causal divergence is UNKNOWN.
OBJECTIVE: Find the first PROVEN divergence between expected and actual request ownership, token renewal, and player error propagation. Distinguish Safari native HLS src= behavior from Shaka MSE/JavaScript fetching and native AVPlayer.
STRICT EVIDENCE HIERARCHY:
T1: Official Apple Developer Documentation, Apple HLS Authoring Specification, FairPlay Streaming SDK, Apple engineering statements, IETF RFC 8216/HTTP semantics and W3C EME/MSE specifications.
T2: Version-pinned Shaka and verified WebKit source code, Apple open-source code where applicable, symbolicated AVFoundation/CoreMedia/CFNetwork diagnostics and independently verified security research. For EVERY source-level claim provide repository URL, commit SHA, file, function, exact line range and control-flow explanation. WebKit is NOT native AVPlayer implementation evidence.
T3: Byte-preserved manifests, sanitized HTTP/redirect traces, reproducible physical-device A/B experiments, time-aligned client event logs and authorized KSM metadata.
T4: Explicitly labeled hypotheses, each with a falsification test.
Never fabricate source citations, private symbols, measurements, platform guarantees or experiments.
INVESTIGATE:
1. Pin Shaka release and Safari build. Trace player.load, native src= versus MSE selection, initial manifest loading, playlist refresh ownership, networking filters and error propagation.
2. Inspect HLS master/media playlists: EXT-X-STREAM-INF, MEDIA-SEQUENCE, TARGETDURATION, DISCONTINUITY, EXT-X-KEY, signed query parameters, redirects, reload cadence and cache headers.
3. Capture HTTP request owner, final URL, redacted token identity/expiry, response status 410, response body, timing, redirect chain, and whether a Shaka filter callback occurred.
4. Separate FairPlay EXT-X-KEY/SKD identity, AVContentKeySession or EME key request, SPC, authorized KSM, CKC and key usability ONLY when key-specific evidence warrants it. Never expose keys, SPC/CKC payloads, certificates, signed credentials or bypass DRM.
5. Independently test native AVPlayer. Compare its public access/error logs and observable network behavior; never infer internal AVFoundation implementation from WebKit.
6. Construct controls: clear vs FairPlay, long-lived vs expiring token, native src= vs verified supported MSE path, initial request vs reload, controlled 410 vs 200, and alternate redirect/cache policies. Change one variable per test.
REPORT: Executive finding; evidence ledger; source-code audit with pinned lines; manifest and HTTP timeline; first proven divergence; falsified alternatives; client-only mitigation candidates; separately labeled CDN/origin proposals; regression tests; remaining unknowns; exact source URLs; and publication-ready article.
ROOT CAUSE may be declared only after reproducible failure, a demonstrated first divergence, controlled intervention that reverses the outcome, and tests excluding major alternatives. Otherwise state ROOT CAUSE UNVERIFIED.