Skip to content

Commit

Permalink
fix: Fix audio language switching while using AirPlay (shaka-project#…
Browse files Browse the repository at this point in the history
…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 shaka-project#3125
  • Loading branch information
baseballbrad3 committed Jun 22, 2021
1 parent 9afa4eb commit f9c289e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Expand Up @@ -59,6 +59,7 @@ Rostislav Hejduk <Ross-cz@users.noreply.github.com>
SameGoal Inc. <*@samegoal.com>
Sanborn Hilland <sanbornh@rogers.com>
Sander Saares <sander@saares.eu>
Swank Motion Pictures Inc. <*@swankmp.com>
TalkTalk Plc <*@talktalkplc.com>
Tatsiana Gelahova <tatsiana.gelahova@gmail.com>
Tomas Tichy <mr.tichyt@gmail.com>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Expand Up @@ -33,6 +33,7 @@ Ashutosh Kumar Mukhiya <ashukm4@gmail.com>
Benjamin Wallberg <me@bwallberg.com>
Benjamin Wallberg <benjamin.wallberg@bonnierbroadcasting.com>
Boris Cupac <borisrt2309@gmail.com>
Brad Nadler <bnadler@swankmp.com>
Bryan Huh <bhh1988@gmail.com>
Chad Assareh <assareh@google.com>
Chris Fillmore <fillmore.chris@gmail.com>
Expand Down
6 changes: 6 additions & 0 deletions lib/player.js
Expand Up @@ -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 =
Expand Down

0 comments on commit f9c289e

Please sign in to comment.