Skip to content

Commit

Permalink
fix(UI): Restore missing AirPlay button (#7389)
Browse files Browse the repository at this point in the history
  • Loading branch information
tykus160 authored and avelad committed Oct 18, 2024
1 parent 07504db commit eaa1bda
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -2977,6 +2977,11 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
}
}
mediaElement.src = playbackUri;
// If ManagedMediaSource exists, we've disabled remote playback on our own.
// Reenable it so AirPlay can be used via RemotePlayback API.
if (this.mediaSourceEngine_ && window.ManagedMediaSource) {
mediaElement.disableRemotePlayback = false;
}

// Tizen 3 / WebOS won't load anything unless you call load() explicitly,
// no matter the value of the preload attribute. This is harmful on some
Expand Down
5 changes: 3 additions & 2 deletions ui/remote_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ shaka.ui.RemoteButton = class extends shaka.ui.Element {

shaka.ui.Utils.setDisplay(this.remoteButton_, false);

if (!this.video.remote || this.video.disableRemotePlayback) {
if (!this.video.remote) {
this.remoteButton_.classList.add('shaka-hidden');
} else {
this.eventManager.listen(
Expand Down Expand Up @@ -138,10 +138,11 @@ shaka.ui.RemoteButton = class extends shaka.ui.Element {
} else if (this.video.remote.state == 'disconnected') {
const handleAvailabilityChange = (availability) => {
if (this.player) {
const disableRemote = this.video.disableRemotePlayback;
const loadMode = this.player.getLoadMode();
const srcMode = loadMode == shaka.Player.LoadMode.SRC_EQUALS;
shaka.ui.Utils.setDisplay(
this.remoteButton_, srcMode && availability);
this.remoteButton_, srcMode && availability && !disableRemote);
} else {
shaka.ui.Utils.setDisplay(this.remoteButton_, false);
}
Expand Down

0 comments on commit eaa1bda

Please sign in to comment.