fix: fix audio language selection on Safari #4138
Merged
+4
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix audio language selection on Safari
Problem
On Safari, videos with multiple audio languages would default to the first audio track (often not the user's preferred language) instead of respecting the interface language preference
Root Cause
The code had a Safari-specific check that skipped calling
player.selectAudioLanguage():This caused Shaka Player to use the first available audio track.
History
This Safari check was added in commit 69eef12 (Dec 2022) to fix #1793 and #
1748, where selectAudioLanguage() was causing videos to not play or freeze on
iOS/iPadOS 16 beta.
That was 3+ years ago, and both Safari and Shaka Player have received
significant updates since. Testing on Safari 18 (macOS) confirms that
selectAudioLanguage()now works correctly without causing playback issues.Fix
Remove the Safari check so audio language selection works consistently across
all browsers.
Testing
Tested on Safari 18 (macOS) with videos containing multiple audio tracks (eg
/watch?v=WmqbDYXCYRc):track (German - which its stuck on before this fix 😢)
If issues arise on older iOS versions, we could consider a version-targeted
check instead of a blanket Safari exclusion.
Fixes #4090