Skip to content

Commit

Permalink
fix(Ads): Fix ad pausing when using customPlayheadTracker (#6444)
Browse files Browse the repository at this point in the history
When using customPlayheadTracker the content of video could have been
replaced by the advertisement (case of SmartTVs where only one video
element is supported at a time), so we want to prevent actions from
being taken on the advertisement.
  • Loading branch information
avelad authored and joeyparrish committed May 7, 2024
1 parent b051bfa commit 0bbdb00
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ads/client_side_ad_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,9 @@ shaka.ads.ClientSideAdManager = class {
shaka.ads.AdManager.AD_STARTED, data));
if (this.ad_.isLinear()) {
this.adContainer_.setAttribute('ad-active', 'true');
this.video_.pause();
if (!this.config_.customPlayheadTracker) {
this.video_.pause();
}
if (this.video_.muted) {
this.ad_.setInitialMuted(this.video_.volume);
} else {
Expand All @@ -551,7 +553,7 @@ shaka.ads.ClientSideAdManager = class {
(new Map()).set('originalEvent', e)));
if (this.ad_ && this.ad_.isLinear()) {
this.adContainer_.removeAttribute('ad-active');
if (!this.video_.ended) {
if (!this.config_.customPlayheadTracker && !this.video_.ended) {
this.video_.play();
}
}
Expand Down

0 comments on commit 0bbdb00

Please sign in to comment.