stormcloud-video-player 0.7.14 → 0.7.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2715,6 +2715,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2715
2715
  this.maxTotalAdRequestsPerBreak = 20;
2716
2716
  this.pendingAdBreak = null;
2717
2717
  this.savedMutedStateBeforeAd = null;
2718
+ this.adLayerInitialized = false;
2718
2719
  this.consecutiveFailures = 0;
2719
2720
  this.maxConsecutiveFailures = 5;
2720
2721
  this.lastAdRequestTime = 0;
@@ -3363,12 +3364,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3363
3364
  this.video.autoplay = !!this.config.autoplay;
3364
3365
  this.video.muted = !!this.config.muted;
3365
3366
  if (!this.config.disableAds) {
3366
- this.adLayer.initialize();
3367
- if (!this.config.disableFiller) {
3368
- this.ensureFillerVideo();
3369
- }
3370
- this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
3371
- this.attachAdLayerEventListeners();
3367
+ this.initializeAdLayer();
3372
3368
  }
3373
3369
  this.timeUpdateHandler = function() {
3374
3370
  _this.onTimeUpdate(_this.video.currentTime);
@@ -3469,6 +3465,31 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3469
3465
  return this.showAds;
3470
3466
  }
3471
3467
  },
3468
+ {
3469
+ key: "initializeAdLayer",
3470
+ value: function initializeAdLayer() {
3471
+ if (this.adLayerInitialized) return;
3472
+ this.adLayer.initialize();
3473
+ if (!this.config.disableFiller) {
3474
+ this.ensureFillerVideo();
3475
+ }
3476
+ this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
3477
+ this.attachAdLayerEventListeners();
3478
+ this.adLayerInitialized = true;
3479
+ }
3480
+ },
3481
+ {
3482
+ key: "setDisableAds",
3483
+ value: function setDisableAds(disabled) {
3484
+ this.config.disableAds = disabled;
3485
+ if (!disabled && this.attached) {
3486
+ this.initializeAdLayer();
3487
+ }
3488
+ if (this.config.debugAdTiming) {
3489
+ console.log("[StormcloudVideoPlayer] setDisableAds:", disabled);
3490
+ }
3491
+ }
3492
+ },
3472
3493
  {
3473
3494
  key: "syncMainContentAudioWhenVisible",
3474
3495
  value: function syncMainContentAudioWhenVisible() {