diff --git a/externs/shaka/ads.js b/externs/shaka/ads.js index cd31134311..116857865f 100644 --- a/externs/shaka/ads.js +++ b/externs/shaka/ads.js @@ -280,6 +280,11 @@ shaka.extern.IAdManager.Factory; * @exportDoc */ shaka.extern.IAd = class { + /** + * @return {boolean} + */ + needsSkipUI() {} + /** * @return {number} */ diff --git a/lib/ads/client_side_ad.js b/lib/ads/client_side_ad.js index 9f1cdd7c0a..668b588152 100644 --- a/lib/ads/client_side_ad.js +++ b/lib/ads/client_side_ad.js @@ -50,6 +50,14 @@ shaka.ads.ClientSideAd = class { }); } + /** + * @override + * @export + */ + needsSkipUI() { + return false; + } + /** * @override * @export diff --git a/lib/ads/interstitial_ad.js b/lib/ads/interstitial_ad.js index 42860c4a01..1247d40591 100755 --- a/lib/ads/interstitial_ad.js +++ b/lib/ads/interstitial_ad.js @@ -41,6 +41,13 @@ shaka.ads.InterstitialAd = class { this.adPosition_ = adPosition; } + /** + * @override + * @export + */ + needsSkipUI() { + return true; + } /** * @override diff --git a/lib/ads/media_tailor_ad.js b/lib/ads/media_tailor_ad.js index b414d2ec6b..ed4e3a84d5 100755 --- a/lib/ads/media_tailor_ad.js +++ b/lib/ads/media_tailor_ad.js @@ -43,6 +43,13 @@ shaka.ads.MediaTailorAd = class { this.isSkipped_ = false; } + /** + * @override + * @export + */ + needsSkipUI() { + return true; + } /** * @override diff --git a/lib/ads/server_side_ad.js b/lib/ads/server_side_ad.js index ff988b9240..35e25e47f0 100644 --- a/lib/ads/server_side_ad.js +++ b/lib/ads/server_side_ad.js @@ -35,6 +35,13 @@ shaka.ads.ServerSideAd = class { this.adProgressData_ = data; } + /** + * @override + * @export + */ + needsSkipUI() { + return true; + } /** * @override diff --git a/test/test/util/fake_ad.js b/test/test/util/fake_ad.js index 5aa61aa33f..858530c0e7 100644 --- a/test/test/util/fake_ad.js +++ b/test/test/util/fake_ad.js @@ -69,6 +69,13 @@ shaka.test.FakeAd = class { this.podIndex_ = 1; } + /** + * @override + */ + needsSkipUI() { + return true; + } + /** * @override */ diff --git a/ui/skip_ad_button.js b/ui/skip_ad_button.js index 595ab358eb..cd8a24896a 100644 --- a/ui/skip_ad_button.js +++ b/ui/skip_ad_button.js @@ -127,7 +127,7 @@ shaka.ui.SkipAdButton = class extends shaka.ui.Element { * @private */ onAdStarted_() { - if (this.ad.isSkippable()) { + if (this.ad.isSkippable() && this.ad.needsSkipUI()) { shaka.ui.Utils.setDisplay(this.button_, true); shaka.ui.Utils.setDisplay(this.counter_, true); this.counter_.textContent = '';