Local reproduction and solution — 18 November 2026#
Status: Five actual-source audio-selection regressions reproduced and fixed.
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#
Exercise empty native IDs, absent roles, duplicate rendition metadata, repeated A→B→A selection and recovery from an already multiple-enabled active set.
All five fail against parent aba5ba58221e7a9bf039ae928dc59dd95ce363a8 and pass against 773eb27dc69e5ceaab83b2042134524bc581384d. The harness AST-extracts actual pinned Player/StreamUtils methods rather than copying predicates.
Solution / guideline#
Use/backport the verified commit: resolve Shaka-generated identity, normalize fallback metadata, and explicitly disable every other native audio-track object before enabling the selected one. Cite the commit instead of relying on an unavailable PR page.
Limits / remaining work#
Native AudioTrackList and Player collaborators are mocked. Physical-iPhone audible output and full browser Player lifecycle were not tested.
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
Verification update — 17 November 2026#
Status: reproducible upstream case; corrective commit and regression tests verified. The pinned fix commit 773eb27dc69e5ceaab83b2042134524bc581384d explicitly fixes upstream #10551.
- Reproduction: repeated native-HLS audio selection with empty/non-unique HTML5 track IDs, including same-language renditions. Existing upstream unit fixtures exercise empty IDs and stable Shaka track identity.
- Solution: select by the Shaka-generated track identity; normalize missing fallback metadata; explicitly disable every other native audio-track object before enabling the selected one.
- Action: use a build containing the pinned commit and verify that exactly one native audio track is enabled after each completed switch.
- Link correction: the commit message names PR #10568, but both GraphQL and REST lookup of that PR returned not found during this review. Cite the verified commit and diff as the available patch evidence rather than treating the PR page as independently verified.
- Scope: source and upstream regression tests inspected; this review did not run a physical-iPhone playback test or rerun the earlier synthetic model. The original clear-HLS report does not establish a FairPlay or native AVPlayer defect.
This update supersedes older statements below about missing fix verification; the historical investigation and prompt are retained.
Source#
- Original report (8 Sep 2026): shaka-project/shaka-player#10551
- Merged fix (11 Sep 2026): shaka-project/shaka-player#10568
- Exact pinned patch: shaka-project/shaka-player@773eb27
Problem / environment#
On iPhone SE (3rd generation), iOS Safari 26.6 / 26.6.1, Shaka Player v5.2.9 / v4.16.47 with streaming.preferNativeHls: true, repeated alternate-audio switching could make the Shaka UI display a different selection from the actual active audio. The original test asset was clear HLS (angel-one-hls/hls.m3u8), not FairPlay. The reporter did not reproduce on macOS Safari.
First proven causal divergence#
The merged Shaka fix establishes two application-side bugs in the native-HLS src= path, not a confirmed WebKit, AVPlayer decoder, or DRM defect.
A. Non-unique HTML5 IDs prevented deactivation. Before the fix, switchHtml5Track_() set the target's enabled = true and only disabled the previous track if target.id !== currentTrack.id. When both native HTML5 AudioTrack IDs were empty strings, the comparison was false. The previous track remained enabled; Shaka had incorrectly assumed activating one audio track automatically disabled others. The patch in lib/player.js:8743–8751 explicitly disables all other native track objects and then enables the selected track.
B. Incomplete metadata lost track identity. The earlier selectAudioTrack() matched language/label plus track.kind == audioTrack.roles[0]. With empty kind and no role, "" == undefined failed; duplicate same-language/label renditions could resolve to the first match rather than the selected rendition. The patch in lib/player.js:6400–6420 first matches a Shaka-generated html5TrackId, then normalizes the metadata fallback. lib/util/stream_utils.js:1575–1580 exports the synthetic ID. The Shaka ID is not proof that native AudioTrack.id is unique.
Shaka added tests at test/player_unit.js:3278–3338 for empty IDs, distinct Shaka IDs, and same-language track selection. The PR was merged on 11 September 2026, with release references for v5.1.23 and v5.2.10.
Evidence grading#
| Claim | Grade | Evidence |
|---|---|---|
| iOS Safari audio/UI mismatch | Reported observation | Issue #10551 |
| Old code failed to deactivate previous track when both IDs empty | Pinned implementation, verified | Commit 773eb27 lib/player.js |
| Old metadata matching could fail or select wrong duplicate | Pinned implementation, verified | Same commit |
| Corrective logic merged with tests | Verified upstream change | PR #10568 |
| Fix eliminates all physical-device cases | Not independently tested here | Requires iPhone A/B |
| Native AVPlayer shares the bug | Not established | Different selection API |
| FairPlay caused the original issue | Contradicted by report | Original asset is clear |
Protocol/API boundary#
- HTML5
AudioTrack.enabledcontrols a single track and is not an exclusive selection transaction: https://developer.mozilla.org/en-US/docs/Web/API/AudioTrack/enabled AudioTrackList.changecan help verify post-selection state: https://developer.mozilla.org/en-US/docs/Web/API/AudioTrackList/change_event- Native AVFoundation uses mutually exclusive
AVMediaSelectionOptionobjects withinAVMediaSelectionGroup; select onAVPlayerItem: https://developer.apple.com/documentation/avfoundation/selecting-subtitles-and-alternative-audio-tracks
Controlled experiment completed#
A standalone, dependency-free JavaScript synthetic model of the old/new predicates was executed on 30 October 2026. 9/9 checks passed: empty IDs leave multiple tracks enabled in the old model; fixed model enforces exactly one; missing roles and duplicate metadata are handled; A→B→A and pre-existing multi-enabled states recover. Limit: this is not a Shaka browser run, physical iPhone reproduction, or native AVPlayer/FairPlay test.
Verification matrix#
Compare affected Shaka v5.2.9 against fixed v5.2.10 (or pinned patched build), same iPhone/iOS and HLS bytes. Exercise English stereo→English surround, English→Spanish, A→B→A, repeated rapid switches, and AirPlay route changes separately. Capture the requested Shaka ID, native track object identity/id/kind/label/language, each enabled flag, AudioTrackList.change, and independently verified audible track. Verify enabledTrackCount === 1 after each completed selection. Run native AVPlayerItem.select(_:in:) as a separate control; never infer a native regression from Safari.
Solution / guideline#
Upgrade the affected Shaka native-HLS path to a build containing PR #10568. If maintaining a fork, select by stable app-level identity and explicitly disable all other native track objects. Never key a rendition only by language/label or assume HTML5 IDs are populated. Do not introduce FairPlay license retries or unconditional player recreation for this clear-HLS UI/selection defect.
Reusable rule: UI selection state is not proof of playback-engine media selection. Measure the requested rendition, its mapped native track object, and the post-switch active set independently.