stormcloud-video-player 0.5.19 → 0.5.21

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.
@@ -1173,17 +1173,10 @@ function createPrebidAdLayer(contentVideo, options) {
1173
1173
  if (debug) console.log("".concat(LOG, " Handling ad completion"));
1174
1174
  adPlaying = false;
1175
1175
  setAdPlayingFlag(false);
1176
- contentVideo.muted = originalMutedState;
1177
- contentVideo.volume = originalMutedState ? 0 : originalVolume;
1178
1176
  if (adContainerEl) {
1179
1177
  adContainerEl.style.display = "none";
1180
1178
  adContainerEl.style.pointerEvents = "none";
1181
1179
  }
1182
- contentVideo.style.visibility = "visible";
1183
- contentVideo.style.opacity = "1";
1184
- if (continueLiveStreamDuringAds) {
1185
- contentVideo.play().catch(function() {});
1186
- }
1187
1180
  emit("ad_impression");
1188
1181
  emit("content_resume");
1189
1182
  }
@@ -1192,8 +1185,6 @@ function createPrebidAdLayer(contentVideo, options) {
1192
1185
  if (debug) console.log("".concat(LOG, " Handling ad error"));
1193
1186
  adPlaying = false;
1194
1187
  setAdPlayingFlag(false);
1195
- contentVideo.muted = originalMutedState;
1196
- contentVideo.volume = originalMutedState ? 0 : originalVolume;
1197
1188
  if (adContainerEl) {
1198
1189
  adContainerEl.style.display = "none";
1199
1190
  adContainerEl.style.pointerEvents = "none";
@@ -2876,13 +2867,25 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2876
2867
  }
2877
2868
  if (!(this.bufferedSegmentsCount >= minSegments)) return [
2878
2869
  3,
2879
- 2
2870
+ 3
2880
2871
  ];
2881
2872
  this.hasInitialBufferCompleted = true;
2882
2873
  if (!this.shouldAutoplayAfterBuffering) return [
2883
2874
  3,
2884
- 2
2875
+ 3
2876
+ ];
2877
+ if (!(this.inAdBreak || this.adLayer.isAdPlaying())) return [
2878
+ 3,
2879
+ 1
2880
+ ];
2881
+ if (this.config.debugAdTiming) {
2882
+ console.log("[StormcloudVideoPlayer] Initial buffer complete (".concat(this.bufferedSegmentsCount, " segments). Ad break active — deferring play() to handleAdPodComplete()."));
2883
+ }
2884
+ return [
2885
+ 3,
2886
+ 3
2885
2887
  ];
2888
+ case 1:
2886
2889
  if (this.config.debugAdTiming) {
2887
2890
  console.log("[StormcloudVideoPlayer] Initial buffer complete (".concat(this.bufferedSegmentsCount, " segments). Starting playback."));
2888
2891
  }
@@ -2894,10 +2897,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2894
2897
  }
2895
2898
  })
2896
2899
  ];
2897
- case 1:
2898
- _state.sent();
2899
- _state.label = 2;
2900
2900
  case 2:
2901
+ _state.sent();
2902
+ _state.label = 3;
2903
+ case 3:
2901
2904
  return [
2902
2905
  2
2903
2906
  ];
@@ -3122,6 +3125,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3122
3125
  _this.activeAdRequestToken = null;
3123
3126
  _this.showAds = false;
3124
3127
  if (!_this.inAdBreak) {
3128
+ _this.video.style.visibility = "visible";
3129
+ _this.video.style.opacity = "1";
3125
3130
  _this.syncMainContentAudioWhenVisible();
3126
3131
  return;
3127
3132
  }
@@ -4732,11 +4737,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4732
4737
  if (Math.abs(this.video.volume - restoredVolume) > 0.01) {
4733
4738
  this.video.volume = restoredVolume;
4734
4739
  }
4735
- var isTizen = detectBrowser().tizenVersion !== void 0;
4736
- if (isTizen && this.hls) {
4740
+ var browser = detectBrowser();
4741
+ var isSmartTV = browser.tizenVersion !== void 0 || browser.webOSVersion !== void 0;
4742
+ if (isSmartTV && this.hls) {
4743
+ if (!restoredMuted) {
4744
+ var hlsRef = this.hls;
4745
+ var savedMuted = restoredMuted;
4746
+ var savedVolume = restoredVolume;
4747
+ var onManifestParsedRestore = function onManifestParsedRestore1() {
4748
+ hlsRef.off(import_hls2.default.Events.MANIFEST_PARSED, onManifestParsedRestore);
4749
+ if (!_this.inAdBreak && !_this.adLayer.isAdPlaying()) {
4750
+ if (_this.video.muted !== savedMuted) _this.video.muted = savedMuted;
4751
+ if (Math.abs(_this.video.volume - savedVolume) > 0.01) _this.video.volume = savedVolume;
4752
+ if (_this.config.debugAdTiming) {
4753
+ console.log("[StormcloudVideoPlayer] Smart TV: audio state restored on MANIFEST_PARSED after re-attach");
4754
+ }
4755
+ }
4756
+ };
4757
+ hlsRef.on(import_hls2.default.Events.MANIFEST_PARSED, onManifestParsedRestore);
4758
+ }
4737
4759
  this.hls.attachMedia(this.video);
4738
4760
  if (this.config.debugAdTiming) {
4739
- console.log("[StormcloudVideoPlayer] Tizen: re-attached HLS to video element after ad break to restore audio");
4761
+ console.log("[StormcloudVideoPlayer] Smart TV: re-attached HLS to video element after ad break to restore media pipeline");
4740
4762
  }
4741
4763
  }
4742
4764
  if (this.shouldContinueLiveStreamDuringAds()) {
@@ -4771,6 +4793,22 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
4771
4793
  _this.syncMainContentAudioWhenVisible();
4772
4794
  }, 150);
4773
4795
  }
4796
+ if (isSmartTV && !restoredMuted) {
4797
+ [
4798
+ 500,
4799
+ 1e3,
4800
+ 2e3,
4801
+ 3e3,
4802
+ 5e3
4803
+ ].forEach(function(delay) {
4804
+ setTimeout(function() {
4805
+ if (!_this.inAdBreak && !_this.adLayer.isAdPlaying()) {
4806
+ if (_this.video.muted !== restoredMuted) _this.video.muted = restoredMuted;
4807
+ if (Math.abs(_this.video.volume - restoredVolume) > 0.01) _this.video.volume = restoredVolume;
4808
+ }
4809
+ }, delay);
4810
+ });
4811
+ }
4774
4812
  this.savedMutedStateBeforeScte = null;
4775
4813
  }
4776
4814
  },