Skip to content

Commit

Permalink
fix(ads): Hide the ad container when ads aren't playing.
Browse files Browse the repository at this point in the history
The ad container intervened with native browser controls in Chrome.

Closes shaka-project#3121

Change-Id: I620d3318c8f9e5bed0a83c3de66f746d20c6703e
  • Loading branch information
ismena committed Mar 5, 2021
1 parent 40aa213 commit 23fe712
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ui/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,12 +663,14 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
/** @export */
showAdUI() {
shaka.ui.Utils.setDisplay(this.adPanel_, true);
shaka.ui.Utils.setDisplay(this.clientAdContainer_, true);
this.controlsContainer_.setAttribute('ad-active', 'true');
}

/** @export */
hideAdUI() {
shaka.ui.Utils.setDisplay(this.adPanel_, false);
shaka.ui.Utils.setDisplay(this.clientAdContainer_, false);
this.controlsContainer_.removeAttribute('ad-active');
}

Expand Down Expand Up @@ -947,6 +949,7 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
/** @private {!HTMLElement} */
this.clientAdContainer_ = shaka.util.Dom.createHTMLElement('div');
this.clientAdContainer_.classList.add('shaka-client-side-ad-container');
shaka.ui.Utils.setDisplay(this.clientAdContainer_, false);
this.videoContainer_.appendChild(this.clientAdContainer_);
}

Expand Down

0 comments on commit 23fe712

Please sign in to comment.