stormcloud-video-player 0.3.66 → 0.3.67
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.
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +113 -42
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +3 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +114 -43
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +51 -38
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +3 -0
- package/lib/players/HlsPlayer.cjs +51 -38
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +51 -38
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +113 -42
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -3835,10 +3835,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3835
3835
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
3836
3836
|
}
|
|
3837
3837
|
}
|
|
3838
|
-
|
|
3839
|
-
var currentVolume = _this.video.volume;
|
|
3840
|
-
var adVolume = currentMuted ? 0 : currentVolume;
|
|
3841
|
-
_this.ima.setAdVolume(adVolume);
|
|
3838
|
+
_this.ima.setAdVolume(_this.getPreAdBreakAdVolume());
|
|
3842
3839
|
if (_this.isShowingPlaceholder) {
|
|
3843
3840
|
if (_this.config.debugAdTiming) {
|
|
3844
3841
|
console.log("[StormcloudVideoPlayer] Hiding placeholder - new ads starting");
|
|
@@ -4592,6 +4589,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4592
4589
|
{
|
|
4593
4590
|
key: "startScte35AdBreak",
|
|
4594
4591
|
value: function startScte35AdBreak(marker, cueKey, durationMs) {
|
|
4592
|
+
this.capturePreAdBreakAudio();
|
|
4595
4593
|
if (!this.video.muted) {
|
|
4596
4594
|
this.video.muted = true;
|
|
4597
4595
|
this.video.volume = 0;
|
|
@@ -6273,9 +6271,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6273
6271
|
this.continuousFetchingActive = true;
|
|
6274
6272
|
this.isShowingPlaceholder = false;
|
|
6275
6273
|
this.totalAdRequestsInBreak = 0;
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
this.
|
|
6274
|
+
this.capturePreAdBreakAudio();
|
|
6275
|
+
currentMuted = this.preAdBreakAudio.muted;
|
|
6276
|
+
currentVolume = this.preAdBreakAudio.volume;
|
|
6279
6277
|
if (!this.video.muted) {
|
|
6280
6278
|
this.video.muted = true;
|
|
6281
6279
|
this.video.volume = 0;
|
|
@@ -6750,7 +6748,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6750
6748
|
value: function tryNextAvailableAd() {
|
|
6751
6749
|
var retryCount = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
6752
6750
|
return _async_to_generator(function() {
|
|
6753
|
-
var remaining, preloaded,
|
|
6751
|
+
var remaining, preloaded, error, _ref, _ref1, _this_preAdBreakAudio, _this_preAdBreakAudio1, nextAdUrl, error1, errorMessage, maxRetries;
|
|
6754
6752
|
return _ts_generator(this, function(_state) {
|
|
6755
6753
|
switch(_state.label){
|
|
6756
6754
|
case 0:
|
|
@@ -6822,10 +6820,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6822
6820
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6823
6821
|
this.scheduleAdStopAtBreakBoundary();
|
|
6824
6822
|
}
|
|
6825
|
-
|
|
6826
|
-
currentVolume = this.video.volume;
|
|
6827
|
-
adVolume = currentMuted ? 0 : currentVolume;
|
|
6828
|
-
this.ima.setAdVolume(adVolume);
|
|
6823
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
6829
6824
|
this.consecutiveFailures = 0;
|
|
6830
6825
|
return [
|
|
6831
6826
|
2
|
|
@@ -6872,9 +6867,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6872
6867
|
if (this.config.debugAdTiming) {
|
|
6873
6868
|
console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC Requesting next ad via IMA SDK (".concat(this.currentAdIndex + 1, "/").concat(this.totalAdsInBreak, ", ").concat(this.adRequestQueue.length, " remaining in queue)"));
|
|
6874
6869
|
}
|
|
6875
|
-
|
|
6876
|
-
currentVolume1 = this.video.volume;
|
|
6877
|
-
this.ima.updateOriginalMutedState(currentMuted1, currentVolume1);
|
|
6870
|
+
this.ima.updateOriginalMutedState((_ref = (_this_preAdBreakAudio = this.preAdBreakAudio) === null || _this_preAdBreakAudio === void 0 ? void 0 : _this_preAdBreakAudio.muted) !== null && _ref !== void 0 ? _ref : this.video.muted, (_ref1 = (_this_preAdBreakAudio1 = this.preAdBreakAudio) === null || _this_preAdBreakAudio1 === void 0 ? void 0 : _this_preAdBreakAudio1.volume) !== null && _ref1 !== void 0 ? _ref1 : this.video.volume);
|
|
6878
6871
|
this.currentAdIndex++;
|
|
6879
6872
|
this.totalAdRequestsInBreak++;
|
|
6880
6873
|
this.lastAdRequestTime = Date.now();
|
|
@@ -6967,7 +6960,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6967
6960
|
key: "showPlaceholderAndWaitForAds",
|
|
6968
6961
|
value: function showPlaceholderAndWaitForAds() {
|
|
6969
6962
|
return _async_to_generator(function() {
|
|
6970
|
-
var remaining, waitTime, checkInterval, maxChecks, i,
|
|
6963
|
+
var remaining, waitTime, checkInterval, maxChecks, i, _ref, _ref1, _this_preAdBreakAudio, _this_preAdBreakAudio1, nextAdUrl, error, errorMessage;
|
|
6971
6964
|
return _ts_generator(this, function(_state) {
|
|
6972
6965
|
switch(_state.label){
|
|
6973
6966
|
case 0:
|
|
@@ -7063,9 +7056,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7063
7056
|
}
|
|
7064
7057
|
this.isShowingPlaceholder = false;
|
|
7065
7058
|
this.ima.hidePlaceholder();
|
|
7066
|
-
|
|
7067
|
-
currentVolume = this.video.volume;
|
|
7068
|
-
this.ima.updateOriginalMutedState(currentMuted, currentVolume);
|
|
7059
|
+
this.ima.updateOriginalMutedState((_ref = (_this_preAdBreakAudio = this.preAdBreakAudio) === null || _this_preAdBreakAudio === void 0 ? void 0 : _this_preAdBreakAudio.muted) !== null && _ref !== void 0 ? _ref : this.video.muted, (_ref1 = (_this_preAdBreakAudio1 = this.preAdBreakAudio) === null || _this_preAdBreakAudio1 === void 0 ? void 0 : _this_preAdBreakAudio1.volume) !== null && _ref1 !== void 0 ? _ref1 : this.video.volume);
|
|
7069
7060
|
this.currentAdIndex++;
|
|
7070
7061
|
this.totalAdRequestsInBreak++;
|
|
7071
7062
|
this.lastAdRequestTime = Date.now();
|
|
@@ -7247,7 +7238,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7247
7238
|
first = tags[0];
|
|
7248
7239
|
rest = tags.slice(1);
|
|
7249
7240
|
this.adPodQueue = rest;
|
|
7250
|
-
this.
|
|
7241
|
+
this.capturePreAdBreakAudio();
|
|
7251
7242
|
this.showAds = true;
|
|
7252
7243
|
this.inAdBreak = true;
|
|
7253
7244
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
@@ -7274,12 +7265,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7274
7265
|
];
|
|
7275
7266
|
case 3:
|
|
7276
7267
|
error = _state.sent();
|
|
7277
|
-
this.adPodQueue = [];
|
|
7278
|
-
this.inAdBreak = false;
|
|
7279
|
-
this.showAds = false;
|
|
7280
7268
|
if (this.config.debugAdTiming) {
|
|
7281
7269
|
console.warn("[StormcloudVideoPlayer] VMAP ad request failed:", error);
|
|
7282
7270
|
}
|
|
7271
|
+
this.handleAdPodComplete();
|
|
7283
7272
|
return [
|
|
7284
7273
|
3,
|
|
7285
7274
|
4
|
|
@@ -7510,7 +7499,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7510
7499
|
key: "playSingleAd",
|
|
7511
7500
|
value: function playSingleAd(vastTagUrl) {
|
|
7512
7501
|
return _async_to_generator(function() {
|
|
7513
|
-
var requestToken,
|
|
7502
|
+
var requestToken, playError, preloadedFallback, fallbackError, error, errorMessage, preloadedFallback1, fallbackError1;
|
|
7514
7503
|
return _ts_generator(this, function(_state) {
|
|
7515
7504
|
switch(_state.label){
|
|
7516
7505
|
case 0:
|
|
@@ -7597,10 +7586,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7597
7586
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7598
7587
|
this.scheduleAdStopAtBreakBoundary();
|
|
7599
7588
|
}
|
|
7600
|
-
|
|
7601
|
-
currentVolume = this.video.volume;
|
|
7602
|
-
adVolume = currentMuted ? 0 : currentVolume;
|
|
7603
|
-
this.ima.setAdVolume(adVolume);
|
|
7589
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7604
7590
|
this.consecutiveFailures = 0;
|
|
7605
7591
|
this.temporaryFailureUrls.delete(vastTagUrl);
|
|
7606
7592
|
return [
|
|
@@ -7647,10 +7633,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7647
7633
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7648
7634
|
this.scheduleAdStopAtBreakBoundary();
|
|
7649
7635
|
}
|
|
7650
|
-
|
|
7651
|
-
currentVolume1 = this.video.volume;
|
|
7652
|
-
adVolume1 = currentMuted1 ? 0 : currentVolume1;
|
|
7653
|
-
this.ima.setAdVolume(adVolume1);
|
|
7636
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7654
7637
|
return [
|
|
7655
7638
|
2
|
|
7656
7639
|
];
|
|
@@ -7724,10 +7707,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7724
7707
|
];
|
|
7725
7708
|
case 14:
|
|
7726
7709
|
_state.sent();
|
|
7727
|
-
|
|
7728
|
-
currentVolume2 = this.video.volume;
|
|
7729
|
-
adVolume2 = currentMuted2 ? 0 : currentVolume2;
|
|
7730
|
-
this.ima.setAdVolume(adVolume2);
|
|
7710
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7731
7711
|
return [
|
|
7732
7712
|
2
|
|
7733
7713
|
];
|
|
@@ -7767,6 +7747,33 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7767
7747
|
}).call(this);
|
|
7768
7748
|
}
|
|
7769
7749
|
},
|
|
7750
|
+
{
|
|
7751
|
+
key: "capturePreAdBreakAudio",
|
|
7752
|
+
value: function capturePreAdBreakAudio() {
|
|
7753
|
+
if (this.preAdBreakAudio) {
|
|
7754
|
+
return;
|
|
7755
|
+
}
|
|
7756
|
+
var captured = {
|
|
7757
|
+
muted: this.video.muted,
|
|
7758
|
+
volume: typeof this.video.volume === "number" && !Number.isNaN(this.video.volume) ? Math.max(0, Math.min(1, this.video.volume)) : 1
|
|
7759
|
+
};
|
|
7760
|
+
this.preAdBreakAudio = captured;
|
|
7761
|
+
this.ima.updateOriginalMutedState(captured.muted, captured.volume);
|
|
7762
|
+
if (this.config.debugAdTiming) {
|
|
7763
|
+
console.log("[StormcloudVideoPlayer] Captured pre-ad-break audio state: muted=".concat(captured.muted, ", volume=").concat(captured.volume));
|
|
7764
|
+
}
|
|
7765
|
+
}
|
|
7766
|
+
},
|
|
7767
|
+
{
|
|
7768
|
+
key: "getPreAdBreakAdVolume",
|
|
7769
|
+
value: function getPreAdBreakAdVolume() {
|
|
7770
|
+
var state = this.preAdBreakAudio;
|
|
7771
|
+
if (state) {
|
|
7772
|
+
return state.muted ? 0 : state.volume;
|
|
7773
|
+
}
|
|
7774
|
+
return this.ima.getOriginalMutedState() ? 0 : this.ima.getOriginalVolume();
|
|
7775
|
+
}
|
|
7776
|
+
},
|
|
7770
7777
|
{
|
|
7771
7778
|
key: "handleAdPodComplete",
|
|
7772
7779
|
value: function handleAdPodComplete() {
|
|
@@ -7800,14 +7807,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7800
7807
|
this.consecutiveFailures = 0;
|
|
7801
7808
|
this.globalConsecutiveNoFills = 0;
|
|
7802
7809
|
this.ima.stop().catch(function() {});
|
|
7803
|
-
var restoredMuted = this.ima.getOriginalMutedState();
|
|
7804
|
-
var restoredVolume = this.ima.getOriginalVolume();
|
|
7810
|
+
var restoredMuted = this.preAdBreakAudio ? this.preAdBreakAudio.muted : this.ima.getOriginalMutedState();
|
|
7811
|
+
var restoredVolume = this.preAdBreakAudio ? this.preAdBreakAudio.volume : this.ima.getOriginalVolume();
|
|
7812
|
+
this.ima.updateOriginalMutedState(restoredMuted, restoredVolume);
|
|
7805
7813
|
if (this.video.muted !== restoredMuted) {
|
|
7806
7814
|
this.video.muted = restoredMuted;
|
|
7807
7815
|
}
|
|
7808
7816
|
if (Math.abs(this.video.volume - restoredVolume) > 0.01) {
|
|
7809
7817
|
this.video.volume = restoredVolume;
|
|
7810
7818
|
}
|
|
7819
|
+
this.preAdBreakAudio = void 0;
|
|
7820
|
+
if (this.config.debugAdTiming) {
|
|
7821
|
+
console.log("[StormcloudVideoPlayer] Restored post-ad-break audio state: muted=".concat(restoredMuted, ", volume=").concat(restoredVolume));
|
|
7822
|
+
}
|
|
7811
7823
|
if (this.shouldContinueLiveStreamDuringAds()) {
|
|
7812
7824
|
if (this.video.paused) {
|
|
7813
7825
|
var _this_video_play;
|
|
@@ -8217,6 +8229,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8217
8229
|
this.clearAdFailsafeTimer();
|
|
8218
8230
|
this.clearAdRequestWatchdog();
|
|
8219
8231
|
this.clearPendingAdBreak();
|
|
8232
|
+
this.preAdBreakAudio = void 0;
|
|
8220
8233
|
if (this.placeholderContainer) {
|
|
8221
8234
|
if (this.placeholderContainer.parentElement) {
|
|
8222
8235
|
this.placeholderContainer.parentElement.removeChild(this.placeholderContainer);
|