Skip to content

Commit

Permalink
fix(Ads): Don't show duplicate SKIP UI in IMA CS (#7084)
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored Jul 23, 2024
1 parent 22a7c49 commit 9337143
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 1 deletion.
5 changes: 5 additions & 0 deletions externs/shaka/ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ shaka.extern.IAdManager.Factory;
* @exportDoc
*/
shaka.extern.IAd = class {
/**
* @return {boolean}
*/
needsSkipUI() {}

/**
* @return {number}
*/
Expand Down
8 changes: 8 additions & 0 deletions lib/ads/client_side_ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ shaka.ads.ClientSideAd = class {
});
}

/**
* @override
* @export
*/
needsSkipUI() {
return false;
}

/**
* @override
* @export
Expand Down
7 changes: 7 additions & 0 deletions lib/ads/interstitial_ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ shaka.ads.InterstitialAd = class {
this.adPosition_ = adPosition;
}

/**
* @override
* @export
*/
needsSkipUI() {
return true;
}

/**
* @override
Expand Down
7 changes: 7 additions & 0 deletions lib/ads/media_tailor_ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ shaka.ads.MediaTailorAd = class {
this.isSkipped_ = false;
}

/**
* @override
* @export
*/
needsSkipUI() {
return true;
}

/**
* @override
Expand Down
7 changes: 7 additions & 0 deletions lib/ads/server_side_ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ shaka.ads.ServerSideAd = class {
this.adProgressData_ = data;
}

/**
* @override
* @export
*/
needsSkipUI() {
return true;
}

/**
* @override
Expand Down
7 changes: 7 additions & 0 deletions test/test/util/fake_ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ shaka.test.FakeAd = class {
this.podIndex_ = 1;
}

/**
* @override
*/
needsSkipUI() {
return true;
}

/**
* @override
*/
Expand Down
2 changes: 1 addition & 1 deletion ui/skip_ad_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down

0 comments on commit 9337143

Please sign in to comment.