From eaa1bda7b8c660bc367d046820f58c2f7e7e04cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Tyczy=C5=84ski?= Date: Thu, 3 Oct 2024 10:15:46 +0200 Subject: [PATCH] fix(UI): Restore missing AirPlay button (#7389) --- lib/player.js | 5 +++++ ui/remote_button.js | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/player.js b/lib/player.js index 41d54bc2e3..cf2a5954ec 100644 --- a/lib/player.js +++ b/lib/player.js @@ -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 diff --git a/ui/remote_button.js b/ui/remote_button.js index a4c8e2a307..a53d441614 100644 --- a/ui/remote_button.js +++ b/ui/remote_button.js @@ -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( @@ -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); }