Skip to content

Conversation

@johnpc
Copy link
Contributor

@johnpc johnpc commented Jan 24, 2026

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():

if (!isSafari) {
    const prefLang = this.getPreferenceString("hl", "en").substr(0, 2);
    if (player.getAudioLanguages().includes(prefLang)) lang = prefLang;
    player.selectAudioLanguage(lang);
}

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):

  • Language correctly defaults to user preference (English - after this fix is made 🎉) instead of first
    track (German - which its stuck on before this fix 😢)
  • Video playback works without freezing

If issues arise on older iOS versions, we could consider a version-targeted
check instead of a blanket Safari exclusion.

Fixes #4090

Removes the Safari-specific check that was preventing selectAudioLanguage()
from being called. This was causing:
1. Videos defaulting to first audio track instead of preferred language
2. Language menu not appearing in player overflow menu

Fixes TeamPiped#4090
@johnpc johnpc changed the title fix: enable audio language selection on Safari fix: fix audio language selection on Safari Jan 24, 2026
@FireMasterK FireMasterK merged commit c4e6f40 into TeamPiped:master Jan 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Player picks audio language automatically, and it can't be change anymore Videos won’t play at all on iPad os 16

2 participants