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
|
@@ -77,6 +77,7 @@ declare class StormcloudVideoPlayer {
|
|
|
77
77
|
private preloadPoolActive;
|
|
78
78
|
private preloadPoolLoopRunning;
|
|
79
79
|
private adDetectSentForCurrentBreak;
|
|
80
|
+
private preAdBreakAudio;
|
|
80
81
|
constructor(config: StormcloudVideoPlayerConfig);
|
|
81
82
|
private createAdPlayer;
|
|
82
83
|
load(): Promise<void>;
|
|
@@ -184,6 +185,8 @@ declare class StormcloudVideoPlayer {
|
|
|
184
185
|
private resetGamNoFillCounter;
|
|
185
186
|
private enforceGlobalRateLimit;
|
|
186
187
|
private playSingleAd;
|
|
188
|
+
private capturePreAdBreakAudio;
|
|
189
|
+
private getPreAdBreakAdVolume;
|
|
187
190
|
private handleAdPodComplete;
|
|
188
191
|
private handleAdFailure;
|
|
189
192
|
private startAdRequestWatchdog;
|
|
@@ -3887,10 +3887,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3887
3887
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
3888
3888
|
}
|
|
3889
3889
|
}
|
|
3890
|
-
|
|
3891
|
-
var currentVolume = _this.video.volume;
|
|
3892
|
-
var adVolume = currentMuted ? 0 : currentVolume;
|
|
3893
|
-
_this.ima.setAdVolume(adVolume);
|
|
3890
|
+
_this.ima.setAdVolume(_this.getPreAdBreakAdVolume());
|
|
3894
3891
|
if (_this.isShowingPlaceholder) {
|
|
3895
3892
|
if (_this.config.debugAdTiming) {
|
|
3896
3893
|
console.log("[StormcloudVideoPlayer] Hiding placeholder - new ads starting");
|
|
@@ -4644,6 +4641,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4644
4641
|
{
|
|
4645
4642
|
key: "startScte35AdBreak",
|
|
4646
4643
|
value: function startScte35AdBreak(marker, cueKey, durationMs) {
|
|
4644
|
+
this.capturePreAdBreakAudio();
|
|
4647
4645
|
if (!this.video.muted) {
|
|
4648
4646
|
this.video.muted = true;
|
|
4649
4647
|
this.video.volume = 0;
|
|
@@ -6325,9 +6323,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6325
6323
|
this.continuousFetchingActive = true;
|
|
6326
6324
|
this.isShowingPlaceholder = false;
|
|
6327
6325
|
this.totalAdRequestsInBreak = 0;
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
this.
|
|
6326
|
+
this.capturePreAdBreakAudio();
|
|
6327
|
+
currentMuted = this.preAdBreakAudio.muted;
|
|
6328
|
+
currentVolume = this.preAdBreakAudio.volume;
|
|
6331
6329
|
if (!this.video.muted) {
|
|
6332
6330
|
this.video.muted = true;
|
|
6333
6331
|
this.video.volume = 0;
|
|
@@ -6802,7 +6800,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6802
6800
|
value: function tryNextAvailableAd() {
|
|
6803
6801
|
var retryCount = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
6804
6802
|
return _async_to_generator(function() {
|
|
6805
|
-
var remaining, preloaded,
|
|
6803
|
+
var remaining, preloaded, error, _ref, _ref1, _this_preAdBreakAudio, _this_preAdBreakAudio1, nextAdUrl, error1, errorMessage, maxRetries;
|
|
6806
6804
|
return _ts_generator(this, function(_state) {
|
|
6807
6805
|
switch(_state.label){
|
|
6808
6806
|
case 0:
|
|
@@ -6874,10 +6872,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6874
6872
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6875
6873
|
this.scheduleAdStopAtBreakBoundary();
|
|
6876
6874
|
}
|
|
6877
|
-
|
|
6878
|
-
currentVolume = this.video.volume;
|
|
6879
|
-
adVolume = currentMuted ? 0 : currentVolume;
|
|
6880
|
-
this.ima.setAdVolume(adVolume);
|
|
6875
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
6881
6876
|
this.consecutiveFailures = 0;
|
|
6882
6877
|
return [
|
|
6883
6878
|
2
|
|
@@ -6924,9 +6919,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6924
6919
|
if (this.config.debugAdTiming) {
|
|
6925
6920
|
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)"));
|
|
6926
6921
|
}
|
|
6927
|
-
|
|
6928
|
-
currentVolume1 = this.video.volume;
|
|
6929
|
-
this.ima.updateOriginalMutedState(currentMuted1, currentVolume1);
|
|
6922
|
+
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);
|
|
6930
6923
|
this.currentAdIndex++;
|
|
6931
6924
|
this.totalAdRequestsInBreak++;
|
|
6932
6925
|
this.lastAdRequestTime = Date.now();
|
|
@@ -7019,7 +7012,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7019
7012
|
key: "showPlaceholderAndWaitForAds",
|
|
7020
7013
|
value: function showPlaceholderAndWaitForAds() {
|
|
7021
7014
|
return _async_to_generator(function() {
|
|
7022
|
-
var remaining, waitTime, checkInterval, maxChecks, i,
|
|
7015
|
+
var remaining, waitTime, checkInterval, maxChecks, i, _ref, _ref1, _this_preAdBreakAudio, _this_preAdBreakAudio1, nextAdUrl, error, errorMessage;
|
|
7023
7016
|
return _ts_generator(this, function(_state) {
|
|
7024
7017
|
switch(_state.label){
|
|
7025
7018
|
case 0:
|
|
@@ -7115,9 +7108,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7115
7108
|
}
|
|
7116
7109
|
this.isShowingPlaceholder = false;
|
|
7117
7110
|
this.ima.hidePlaceholder();
|
|
7118
|
-
|
|
7119
|
-
currentVolume = this.video.volume;
|
|
7120
|
-
this.ima.updateOriginalMutedState(currentMuted, currentVolume);
|
|
7111
|
+
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);
|
|
7121
7112
|
this.currentAdIndex++;
|
|
7122
7113
|
this.totalAdRequestsInBreak++;
|
|
7123
7114
|
this.lastAdRequestTime = Date.now();
|
|
@@ -7299,7 +7290,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7299
7290
|
first = tags[0];
|
|
7300
7291
|
rest = tags.slice(1);
|
|
7301
7292
|
this.adPodQueue = rest;
|
|
7302
|
-
this.
|
|
7293
|
+
this.capturePreAdBreakAudio();
|
|
7303
7294
|
this.showAds = true;
|
|
7304
7295
|
this.inAdBreak = true;
|
|
7305
7296
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
@@ -7326,12 +7317,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7326
7317
|
];
|
|
7327
7318
|
case 3:
|
|
7328
7319
|
error = _state.sent();
|
|
7329
|
-
this.adPodQueue = [];
|
|
7330
|
-
this.inAdBreak = false;
|
|
7331
|
-
this.showAds = false;
|
|
7332
7320
|
if (this.config.debugAdTiming) {
|
|
7333
7321
|
console.warn("[StormcloudVideoPlayer] VMAP ad request failed:", error);
|
|
7334
7322
|
}
|
|
7323
|
+
this.handleAdPodComplete();
|
|
7335
7324
|
return [
|
|
7336
7325
|
3,
|
|
7337
7326
|
4
|
|
@@ -7562,7 +7551,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7562
7551
|
key: "playSingleAd",
|
|
7563
7552
|
value: function playSingleAd(vastTagUrl) {
|
|
7564
7553
|
return _async_to_generator(function() {
|
|
7565
|
-
var requestToken,
|
|
7554
|
+
var requestToken, playError, preloadedFallback, fallbackError, error, errorMessage, preloadedFallback1, fallbackError1;
|
|
7566
7555
|
return _ts_generator(this, function(_state) {
|
|
7567
7556
|
switch(_state.label){
|
|
7568
7557
|
case 0:
|
|
@@ -7649,10 +7638,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7649
7638
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7650
7639
|
this.scheduleAdStopAtBreakBoundary();
|
|
7651
7640
|
}
|
|
7652
|
-
|
|
7653
|
-
currentVolume = this.video.volume;
|
|
7654
|
-
adVolume = currentMuted ? 0 : currentVolume;
|
|
7655
|
-
this.ima.setAdVolume(adVolume);
|
|
7641
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7656
7642
|
this.consecutiveFailures = 0;
|
|
7657
7643
|
this.temporaryFailureUrls.delete(vastTagUrl);
|
|
7658
7644
|
return [
|
|
@@ -7699,10 +7685,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7699
7685
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7700
7686
|
this.scheduleAdStopAtBreakBoundary();
|
|
7701
7687
|
}
|
|
7702
|
-
|
|
7703
|
-
currentVolume1 = this.video.volume;
|
|
7704
|
-
adVolume1 = currentMuted1 ? 0 : currentVolume1;
|
|
7705
|
-
this.ima.setAdVolume(adVolume1);
|
|
7688
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7706
7689
|
return [
|
|
7707
7690
|
2
|
|
7708
7691
|
];
|
|
@@ -7776,10 +7759,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7776
7759
|
];
|
|
7777
7760
|
case 14:
|
|
7778
7761
|
_state.sent();
|
|
7779
|
-
|
|
7780
|
-
currentVolume2 = this.video.volume;
|
|
7781
|
-
adVolume2 = currentMuted2 ? 0 : currentVolume2;
|
|
7782
|
-
this.ima.setAdVolume(adVolume2);
|
|
7762
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7783
7763
|
return [
|
|
7784
7764
|
2
|
|
7785
7765
|
];
|
|
@@ -7819,6 +7799,33 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7819
7799
|
}).call(this);
|
|
7820
7800
|
}
|
|
7821
7801
|
},
|
|
7802
|
+
{
|
|
7803
|
+
key: "capturePreAdBreakAudio",
|
|
7804
|
+
value: function capturePreAdBreakAudio() {
|
|
7805
|
+
if (this.preAdBreakAudio) {
|
|
7806
|
+
return;
|
|
7807
|
+
}
|
|
7808
|
+
var captured = {
|
|
7809
|
+
muted: this.video.muted,
|
|
7810
|
+
volume: typeof this.video.volume === "number" && !Number.isNaN(this.video.volume) ? Math.max(0, Math.min(1, this.video.volume)) : 1
|
|
7811
|
+
};
|
|
7812
|
+
this.preAdBreakAudio = captured;
|
|
7813
|
+
this.ima.updateOriginalMutedState(captured.muted, captured.volume);
|
|
7814
|
+
if (this.config.debugAdTiming) {
|
|
7815
|
+
console.log("[StormcloudVideoPlayer] Captured pre-ad-break audio state: muted=".concat(captured.muted, ", volume=").concat(captured.volume));
|
|
7816
|
+
}
|
|
7817
|
+
}
|
|
7818
|
+
},
|
|
7819
|
+
{
|
|
7820
|
+
key: "getPreAdBreakAdVolume",
|
|
7821
|
+
value: function getPreAdBreakAdVolume() {
|
|
7822
|
+
var state = this.preAdBreakAudio;
|
|
7823
|
+
if (state) {
|
|
7824
|
+
return state.muted ? 0 : state.volume;
|
|
7825
|
+
}
|
|
7826
|
+
return this.ima.getOriginalMutedState() ? 0 : this.ima.getOriginalVolume();
|
|
7827
|
+
}
|
|
7828
|
+
},
|
|
7822
7829
|
{
|
|
7823
7830
|
key: "handleAdPodComplete",
|
|
7824
7831
|
value: function handleAdPodComplete() {
|
|
@@ -7852,14 +7859,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7852
7859
|
this.consecutiveFailures = 0;
|
|
7853
7860
|
this.globalConsecutiveNoFills = 0;
|
|
7854
7861
|
this.ima.stop().catch(function() {});
|
|
7855
|
-
var restoredMuted = this.ima.getOriginalMutedState();
|
|
7856
|
-
var restoredVolume = this.ima.getOriginalVolume();
|
|
7862
|
+
var restoredMuted = this.preAdBreakAudio ? this.preAdBreakAudio.muted : this.ima.getOriginalMutedState();
|
|
7863
|
+
var restoredVolume = this.preAdBreakAudio ? this.preAdBreakAudio.volume : this.ima.getOriginalVolume();
|
|
7864
|
+
this.ima.updateOriginalMutedState(restoredMuted, restoredVolume);
|
|
7857
7865
|
if (this.video.muted !== restoredMuted) {
|
|
7858
7866
|
this.video.muted = restoredMuted;
|
|
7859
7867
|
}
|
|
7860
7868
|
if (Math.abs(this.video.volume - restoredVolume) > 0.01) {
|
|
7861
7869
|
this.video.volume = restoredVolume;
|
|
7862
7870
|
}
|
|
7871
|
+
this.preAdBreakAudio = void 0;
|
|
7872
|
+
if (this.config.debugAdTiming) {
|
|
7873
|
+
console.log("[StormcloudVideoPlayer] Restored post-ad-break audio state: muted=".concat(restoredMuted, ", volume=").concat(restoredVolume));
|
|
7874
|
+
}
|
|
7863
7875
|
if (this.shouldContinueLiveStreamDuringAds()) {
|
|
7864
7876
|
if (this.video.paused) {
|
|
7865
7877
|
var _this_video_play;
|
|
@@ -8269,6 +8281,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8269
8281
|
this.clearAdFailsafeTimer();
|
|
8270
8282
|
this.clearAdRequestWatchdog();
|
|
8271
8283
|
this.clearPendingAdBreak();
|
|
8284
|
+
this.preAdBreakAudio = void 0;
|
|
8272
8285
|
if (this.placeholderContainer) {
|
|
8273
8286
|
if (this.placeholderContainer.parentElement) {
|
|
8274
8287
|
this.placeholderContainer.parentElement.removeChild(this.placeholderContainer);
|