From 4e89d8305dee61aa247792082b07a2b085f096e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Fri, 25 Oct 2024 11:11:33 +0200 Subject: [PATCH] fix(AirPlay): Prefer Playback Remote API for closeOpenSessions (#7500) --- lib/media/drm_engine.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/media/drm_engine.js b/lib/media/drm_engine.js index 22d3c6d5ad..a971f6a39a 100644 --- a/lib/media/drm_engine.js +++ b/lib/media/drm_engine.js @@ -506,7 +506,14 @@ shaka.media.DrmEngine = class { this.video_ = video; this.eventManager_.listenOnce(this.video_, 'play', () => this.onPlay_()); - if ('webkitCurrentPlaybackTargetIsWireless' in this.video_) { + if (this.video_.remote) { + this.eventManager_.listen(this.video_.remote, 'connect', + () => this.closeOpenSessions_()); + this.eventManager_.listen(this.video_.remote, 'connecting', + () => this.closeOpenSessions_()); + this.eventManager_.listen(this.video_.remote, 'disconnect', + () => this.closeOpenSessions_()); + } else if ('webkitCurrentPlaybackTargetIsWireless' in this.video_) { this.eventManager_.listen(this.video_, 'webkitcurrentplaybacktargetiswirelesschanged', () => this.closeOpenSessions_());