Source#
Apple Developer Forums: https://developer.apple.com/forums/thread/818465
Problem#
An HLS/CMAF stream exposes English, German, and French alternate audio renditions. English is DEFAULT=YES. The same stream switches normally on iOS 17/18, but on iOS 26 a manual selection can be ignored, fall back to English, or fail to switch back to English.
The strongest discriminator is that changing only the order of the EXT-X-MEDIA entries changes the result. Putting the default English rendition last was reported to restore reliable switching for both VOD and live playback.
same media
same attributes
same device / OS
same player
only EXT-X-MEDIA ordering changes
↓
selection behavior changes
Symptoms#
- User selects French but English remains audible.
- Switching to another language can work, but switching back to English can fail.
- The issue reproduces in native Safari as well as a third-party player.
- Reordering
EXT-X-MEDIAchanges the outcome.
Evidence level#
Apple forum report + inferred implementation behavior.
The ordering sensitivity is observed behavior. A positional/index-based rendition-mapping defect is plausible, but is not publicly confirmed by Apple.
Investigation#
Treat the failure as three separate layers:
User selects French
↓
1. AVFoundation selection state
↓
2. HLS rendition actually requested
↓
3. Audio actually decoded
For AVPlayer, inspect the current selection after each switch:
if let group = try? await playerItem.asset.loadMediaSelectionGroup(for: .audible) {
let selected = playerItem.currentMediaSelection
.selectedMediaOption(in: group)
print("selected:", selected?.displayName ?? "nil")
}Then correlate it with the requested audio playlist and segments.
The key matrix is:
currentMediaSelection = French
network requests = French
heard audio = French
versus:
currentMediaSelection = French
network requests = English
heard audio = English
The second pattern moves the failure below the public media-selection state and into rendition resolution / playback internals.
Verification#
Generate manifests where all media, attributes, and device conditions stay fixed and only the order changes:
A EN(default), DE, FR
B DE, FR, EN(default)
C FR, EN(default), DE
D DE, EN(default), FR
For every permutation record:
requested language
currentMediaSelection immediately
selected option after 100 ms / 1 s / 5 s
first audio playlist requested
first audio segment requested
actual audible language
Run the same matrix on:
iOS 18 control
iOS 26 affected version
latest iOS 26.x available
Also isolate explicit selection from automatic language criteria:
player.appliesMediaSelectionCriteriaAutomatically = false
playerItem.select(option, in: audioGroup)If ordering sensitivity remains, automatic media-selection policy becomes a much weaker explanation.
Solution / Guideline#
Do not treat a working manifest order as an HLS authoring rule.
The safe engineering conclusion is:
Playback on the affected iOS version appears unexpectedly sensitive to
EXT-X-MEDIAordering even though the semantic rendition metadata is unchanged.
If testing confirms that placing DEFAULT=YES last avoids the issue across the affected device matrix, it can be used as a temporary, version-scoped packaging workaround.
Client-side:
- Resolve the requested option from the current
AVMediaSelectionGroup. - Explicitly call
select(_:in:)for an app-owned audio picker. - Verify
currentMediaSelectionafter each change. - Correlate the selection with the actual rendition requests.
- Retain telemetry for requested language, selected language, OS version, and stall/failure state.
Engineering rule#
If changing only the order of semantically equivalent HLS entries changes playback behavior, use ordering as an experimental variable to expose an identity-mapping bug. Do not promote the working order into an authoring contract.
The debugging boundary is the first divergence in:
requested option
↓
AVFoundation selected option
↓
requested rendition
↓
decoded media
References#
- Apple Developer Forums: https://developer.apple.com/forums/thread/818465
- Apple — Adding alternate media to a playlist: https://developer.apple.com/documentation/http-live-streaming/adding-alternate-media-to-a-playlist
- AVPlayerItem / media selection: https://developer.apple.com/documentation/avfoundation/avplayeritem