Skip to content

Commit

Permalink
fix(FEC-9075): resume ad from toolbar doesn't work (#7)
Browse files Browse the repository at this point in the history
Do not remove non-exists child
  • Loading branch information
yairans authored May 6, 2019
1 parent 26cc1d5 commit 4bd0883
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ima-dai.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class ImaDAI extends BasePlugin implements IAdsControllerProvider, IEngineDecora
_rejectLoad: Function;
_adStartedDispatched: boolean;
_playbackRate: number;
_adsCoverDivExists: boolean;

static IMA_DAI_SDK_LIB_URL: string = '//imasdk.googleapis.com/js/sdkloader/ima3_dai.js';

Expand Down Expand Up @@ -234,6 +235,7 @@ class ImaDAI extends BasePlugin implements IAdsControllerProvider, IEngineDecora
if (this._streamManager) {
this._streamManager.reset();
}
this._setToggleAdsCover(false);
this._initMembers();
this._attachListeners();
}
Expand Down Expand Up @@ -310,6 +312,7 @@ class ImaDAI extends BasePlugin implements IAdsControllerProvider, IEngineDecora
this._adBreak = false;
this._savedSeekTime = null;
this._adStartedDispatched = false;
this._adsCoverDivExists = false;
this._playbackRate = 1;
}

Expand Down Expand Up @@ -575,7 +578,13 @@ class ImaDAI extends BasePlugin implements IAdsControllerProvider, IEngineDecora

_setToggleAdsCover(enable: boolean): void {
this.logger.debug('Set toggle ads cover', enable);
enable ? this._adsContainerDiv.appendChild(this._adsCoverDiv) : this._adsContainerDiv.removeChild(this._adsCoverDiv);
if (enable) {
Utils.Dom.appendChild(this._adsContainerDiv, this._adsCoverDiv);
this._adsCoverDivExists = true;
} else if (this._adsCoverDivExists) {
Utils.Dom.removeChild(this._adsContainerDiv, this._adsCoverDiv);
this._adsCoverDivExists = false;
}
}

_showAdsContainer(): void {
Expand Down

0 comments on commit 4bd0883

Please sign in to comment.