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 authored 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
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Rostislav Hejduk <[email protected]>
SameGoal Inc. <*@samegoal.com>
Sanborn Hilland <[email protected]>
Sander Saares <[email protected]>
Swank Motion Pictures Inc. <*@swankmp.com>
TalkTalk Plc <*@talktalkplc.com>
Tatsiana Gelahova <[email protected]>
Tomas Tichy <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Ashutosh Kumar Mukhiya <[email protected]>
Benjamin Wallberg <[email protected]>
Benjamin Wallberg <[email protected]>
Boris Cupac <[email protected]>
Brad Nadler <[email protected]>
Bryan Huh <[email protected]>
Chad Assareh <[email protected]>
Chris Fillmore <[email protected]>
Expand Down
6 changes: 6 additions & 0 deletions lib/player.js
Original file line number Diff line number Diff line change
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.