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.
@@ -45,6 +45,7 @@ declare class StormcloudVideoPlayer {
45
45
  private pendingAdBreak;
46
46
  private prefetchTimerId;
47
47
  private savedMutedStateBeforeAd;
48
+ private adLayerInitialized;
48
49
  private consecutiveFailures;
49
50
  private readonly maxConsecutiveFailures;
50
51
  private lastAdRequestTime;
@@ -80,6 +81,8 @@ declare class StormcloudVideoPlayer {
80
81
  getRemainingAdSeconds(): number;
81
82
  isAdPlaying(): boolean;
82
83
  isShowingAds(): boolean;
84
+ private initializeAdLayer;
85
+ setDisableAds(disabled: boolean): void;
83
86
  private syncMainContentAudioWhenVisible;
84
87
  getStreamType(): "hls" | "other";
85
88
  shouldShowNativeControls(): boolean;
@@ -2767,6 +2767,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2767
2767
  this.maxTotalAdRequestsPerBreak = 20;
2768
2768
  this.pendingAdBreak = null;
2769
2769
  this.savedMutedStateBeforeAd = null;
2770
+ this.adLayerInitialized = false;
2770
2771
  this.consecutiveFailures = 0;
2771
2772
  this.maxConsecutiveFailures = 5;
2772
2773
  this.lastAdRequestTime = 0;
@@ -3415,12 +3416,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3415
3416
  this.video.autoplay = !!this.config.autoplay;
3416
3417
  this.video.muted = !!this.config.muted;
3417
3418
  if (!this.config.disableAds) {
3418
- this.adLayer.initialize();
3419
- if (!this.config.disableFiller) {
3420
- this.ensureFillerVideo();
3421
- }
3422
- this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
3423
- this.attachAdLayerEventListeners();
3419
+ this.initializeAdLayer();
3424
3420
  }
3425
3421
  this.timeUpdateHandler = function() {
3426
3422
  _this.onTimeUpdate(_this.video.currentTime);
@@ -3521,6 +3517,31 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3521
3517
  return this.showAds;
3522
3518
  }
3523
3519
  },
3520
+ {
3521
+ key: "initializeAdLayer",
3522
+ value: function initializeAdLayer() {
3523
+ if (this.adLayerInitialized) return;
3524
+ this.adLayer.initialize();
3525
+ if (!this.config.disableFiller) {
3526
+ this.ensureFillerVideo();
3527
+ }
3528
+ this.adLayer.updateOriginalMutedState(this.video.muted, this.video.volume);
3529
+ this.attachAdLayerEventListeners();
3530
+ this.adLayerInitialized = true;
3531
+ }
3532
+ },
3533
+ {
3534
+ key: "setDisableAds",
3535
+ value: function setDisableAds(disabled) {
3536
+ this.config.disableAds = disabled;
3537
+ if (!disabled && this.attached) {
3538
+ this.initializeAdLayer();
3539
+ }
3540
+ if (this.config.debugAdTiming) {
3541
+ console.log("[StormcloudVideoPlayer] setDisableAds:", disabled);
3542
+ }
3543
+ }
3544
+ },
3524
3545
  {
3525
3546
  key: "syncMainContentAudioWhenVisible",
3526
3547
  value: function syncMainContentAudioWhenVisible() {