From f9c289efd1086417d33f515ef481113fe36ce662 Mon Sep 17 00:00:00 2001 From: Brad Nadler Date: Tue, 22 Jun 2021 17:56:09 -0500 Subject: [PATCH] fix: Fix audio language switching while using AirPlay (#3472) When sending a video to an AirPlay target, such as an Apple TV or a TV with AirPlay built in, it can become impossible to change from one audio language, to a second audio language, then return to the first audio language. When enabling a new audio track, it is assumed that all other tracks will be disabled. However, while sending media to the AirPlay target, no tracks are automatically disabled. As a result, it would become impossible to reselect certain audio tracks as the player would keep playing an enabled track, even if it isn't the most recently enabled track. Closes #3125 --- AUTHORS | 1 + CONTRIBUTORS | 1 + lib/player.js | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/AUTHORS b/AUTHORS index 089a37c56b..90c5870cf3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -59,6 +59,7 @@ Rostislav Hejduk SameGoal Inc. <*@samegoal.com> Sanborn Hilland Sander Saares +Swank Motion Pictures Inc. <*@swankmp.com> TalkTalk Plc <*@talktalkplc.com> Tatsiana Gelahova Tomas Tichy diff --git a/CONTRIBUTORS b/CONTRIBUTORS index de40a37713..c405fe532e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -33,6 +33,7 @@ Ashutosh Kumar Mukhiya Benjamin Wallberg Benjamin Wallberg Boris Cupac +Brad Nadler Bryan Huh Chad Assareh Chris Fillmore diff --git a/lib/player.js b/lib/player.js index 2bd7e2d9bc..f539b3338d 100644 --- a/lib/player.js +++ b/lib/player.js @@ -5176,6 +5176,12 @@ shaka.Player = class extends shaka.util.FakeEventTarget { // This will reset the "enabled" of other tracks to false. track.enabled = true; + // AirPlay does not reset the "enabled" of other tracks to false, so + // it must be changed by hand. + if (track.id !== currentTrack.id) { + currentTrack.enabled = false; + } + const oldTrack = shaka.util.StreamUtils.html5AudioTrackToTrack(currentTrack); const newTrack =