Second-title playback failure may originate in MediaCapabilities before license acquisition

GitHub source

Inferred. This page is generated from GitHub Issue #36; GitHub remains the canonical authoring and discussion source.

Local reproduction and solution — 18 November 2026#

Status: Original second-title failure remains unverified; real licensed A→B control passes.

Source and evidence#

Upstream case · local report and evidence · portable reproduction instructions

Observed results are Reproduced only within the stated seam. Implementation explanations remain Inferred, not Apple Confirmed.

Reconstruct the scene#

Use reported Shaka 4.14.10 with explicit legacy EME, load public SingleKey, unload, then load public MultiKey on the same page with the correct per-asset public entitlement.

The second title plays to approximately 9.769 s without errors. This is a real Safari/FairPlay control, not the original release-versus-debug failure reproduction.

Solution / guideline#

Do not apply an unproven timeout or KSM retry patch. Capture the first difference in decodingInfo, keySystemAccess, createMediaKeys/setMediaKeys and player generation for the original A→B failure. Missing MediaKeys is upstream of license delivery; the separate demo HTTP403 is not the same proven chain.

All pinned patches and results

Limits / remaining work#

Original assets/provider config, matched release/debug trace and first causal divergence are still missing.

This update supersedes earlier no-local-run statements below only within the stated scope. Historical source reports are retained; no unresolved issue is closed by this publication.


Earlier investigation and source history

Source and evidence status#

  • Original report (6–9 May 2025): shaka-project/shaka-player#8550
  • Environment: Safari/macOS + Shaka Player 4.14.x + FairPlay via EME. Not a native AVPlayer reproduction.
  • Pinned Shaka v4.14.10 commit: c373b414af268e5a8289acba61dafd76fa56340b.
  • Status: source-level causal dependency verified; field root cause unresolved.

Debugging question#

The reporter could play one FairPlay title but sometimes failed when switching to another title without reloading the page. The release build failed where the debug build reportedly succeeded. On the failing second playback the reporter observed no new onEncryptedEvent, missing mediaKeys_, and application error ENCRYPTED_CONTENT_WITHOUT_DRM_INFO (Shaka 6010). The reporter temporarily downgraded to v4.13.3; the issue was closed without a proven root cause.

Separate symptom, not the same proven chain: A Shaka demo also produced a FairPlay license HTTP 403 with a vendor message that the DRM message was expired. The reporter cautioned that the demo and application failures might differ. Do not use the demo 403 to explain an application run where MediaKeys was never created.

Verified implementation sequence#

The pinned Shaka source establishes:

  1. DrmEngine.init_ awaits StreamUtils.getDecodingInfosForVariants(...) before queryMediaKeys_: drm_engine.js L476–489.
  2. StreamUtils calls asynchronous navigator.mediaCapabilities.decodingInfo(copy), and a rejected batch yields a null result: stream_utils.js L641–692.
  3. getKeySystemAccessFromVariants_ requires a decoding result with supported === true and non-null keySystemAccess: drm_engine.js L1104–1131.
  4. queryMediaKeys_ requires MediaKeySystemAccess before calling createMediaKeys(): drm_engine.js L967–1030.
  5. attach(video) has an explicit missing-mediaKeys_ branch: drm_engine.js L562–578.

The W3C Media Capabilities specification defines decodingInfo() as an asynchronous capability query. Its keySystemAccess is not an SPC/CKC response.

HLS DRM metadata / selected variant
  → MediaCapabilities.decodingInfo
  → supported + keySystemAccess
  → DrmEngine.queryMediaKeys_
  → createMediaKeys / setMediaKeys
  → encrypted event / initData
  → SPC → KSM license POST → CKC
  → protected sample decoding

Critical inference: A missing mediaKeys_ is upstream of license delivery. Before changing the KSM, inspect the first difference in variant decoding-info and EME initialization state.

Historical source difference, not proven cause#

At v4.13.3, stream_utils.js wraps decodingInfo() with a one-second timeout on all platforms. At v4.14.10, the timeout wrapper is Android-only and Safari uses the direct promise. This is a verified change, not proof that the timeout removal caused the second-title failure. There are many other DRM/HLS/polyfill changes between releases.

Competing hypotheses#

Hypothesis Decisive evidence
decodingInfo returns unsupported/rejects on second title Log exact input, result/error, supported, and presence of keySystemAccess
EME polyfill global state changes between titles Record native/prefixed EME mode and install/uninstall ordering
Teardown or stale async completion Correlate player-generation IDs and monotonic timestamps
Second-title DRM metadata differs Compare selected variants, EXT-X-KEY, KEYFORMAT, SKD identifiers
KSM rejects expired SPC Show license POST + HTTP 403 in the same failing application session
Native AVFoundation regression Reproduce independently with AVPlayer + AVContentKeySession

Controlled verification#

Run A→A, A→B, B→A, B→B; fresh page versus same page; release versus debug; v4.13.3 versus v4.14.10; native versus prefixed EME where supported. Keep OS/browser, media, and license policy fixed. Repeat trials.

For each playback generation, record monotonic time, selected variant, DRM info, decodingInfo input/outcome, queryMediaKeys_, createMediaKeys, setMediaKeys, encrypted events, license POST status, CKC processing outcome, and terminal error. Avoid leaking keys, SPC/CKC payloads, tokens, or certificates. Instrumentation itself can perturb races; cross-check with minimally invasive traces.

Engineering rule#

A terminal DRM error does not prove a license-server failure. Capability negotiation and MediaKeys initialization can fail before any FairPlay license request is sent.

Root cause: unverified. The next decisive artifact is a matched release/debug trace for the same A→B sequence showing the first difference in decodingInfo, keySystemAccess, or MediaKeys state.