From 84c1186c8fb50cf4e4d5ff298a0ad76d73d15ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81lvaro=20Velad=20Galva=CC=81n?= Date: Mon, 2 Dec 2024 11:28:16 +0100 Subject: [PATCH] fix(UI): Allow pause non-linear video ads --- ui/controls.js | 8 +++++--- ui/play_button.js | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ui/controls.js b/ui/controls.js index 8d1e00195a..280566e2d9 100644 --- a/ui/controls.js +++ b/ui/controls.js @@ -1638,11 +1638,13 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget { /** @private */ onPlayPauseClick_() { - if (this.ad_ && this.ad_.isLinear()) { + if (this.ad_) { this.playPauseAd(); - } else { - this.playPausePresentation(); + if (this.ad_.isLinear()) { + return; + } } + this.playPausePresentation(); } /** @private */ diff --git a/ui/play_button.js b/ui/play_button.js index 5eea9b4099..b2b062c98d 100644 --- a/ui/play_button.js +++ b/ui/play_button.js @@ -77,11 +77,13 @@ shaka.ui.PlayButton = class extends shaka.ui.Element { }); this.eventManager.listen(this.button, 'click', () => { - if (this.ad && this.ad.isLinear()) { + if (this.ad) { this.controls.playPauseAd(); - } else { - this.controls.playPausePresentation(); + if (this.ad.isLinear()) { + return; + } } + this.controls.playPausePresentation(); }); if (this.ad) {