stormcloud-video-player 0.3.66 → 0.3.68
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 +198 -54
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +8 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.js +199 -55
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +136 -50
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +8 -0
- package/lib/players/HlsPlayer.cjs +136 -50
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +136 -50
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +11 -3
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +198 -54
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -77,9 +77,14 @@ declare class StormcloudVideoPlayer {
|
|
|
77
77
|
private preloadPoolActive;
|
|
78
78
|
private preloadPoolLoopRunning;
|
|
79
79
|
private adDetectSentForCurrentBreak;
|
|
80
|
+
private preAdBreakAudio;
|
|
81
|
+
private detectedLowLatencyStream;
|
|
82
|
+
private latencyProfileApplied;
|
|
80
83
|
constructor(config: StormcloudVideoPlayerConfig);
|
|
81
84
|
private createAdPlayer;
|
|
82
85
|
load(): Promise<void>;
|
|
86
|
+
private applyStreamLatencyProfile;
|
|
87
|
+
private isLowLatencyManifest;
|
|
83
88
|
private attachImaEventListeners;
|
|
84
89
|
private recreateImaController;
|
|
85
90
|
private ensurePlaceholderContainer;
|
|
@@ -150,6 +155,7 @@ declare class StormcloudVideoPlayer {
|
|
|
150
155
|
isShowingAds(): boolean;
|
|
151
156
|
getStreamType(): "hls" | "other";
|
|
152
157
|
shouldShowNativeControls(): boolean;
|
|
158
|
+
isLowLatencyStream(): boolean | undefined;
|
|
153
159
|
private shouldContinueLiveStreamDuringAds;
|
|
154
160
|
private startAdPrefetch;
|
|
155
161
|
private clearPendingAdBreak;
|
|
@@ -184,6 +190,8 @@ declare class StormcloudVideoPlayer {
|
|
|
184
190
|
private resetGamNoFillCounter;
|
|
185
191
|
private enforceGlobalRateLimit;
|
|
186
192
|
private playSingleAd;
|
|
193
|
+
private capturePreAdBreakAudio;
|
|
194
|
+
private getPreAdBreakAdVolume;
|
|
187
195
|
private handleAdPodComplete;
|
|
188
196
|
private handleAdFailure;
|
|
189
197
|
private startAdRequestWatchdog;
|
|
@@ -1783,7 +1783,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1783
1783
|
}
|
|
1784
1784
|
var adElement = xmlDoc.querySelector("Ad");
|
|
1785
1785
|
if (!adElement) {
|
|
1786
|
-
console.warn("[HlsAdPlayer] No Ad element found in VAST XML");
|
|
1786
|
+
console.warn("[HlsAdPlayer] No Ad element found in VAST XML (no fill). Content (first 2000 chars):", xmlString.substring(0, 2e3));
|
|
1787
1787
|
return null;
|
|
1788
1788
|
}
|
|
1789
1789
|
var adId = adElement.getAttribute("id") || "unknown";
|
|
@@ -1879,7 +1879,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1879
1879
|
}
|
|
1880
1880
|
function fetchAndParseVastAd(vastTagUrl) {
|
|
1881
1881
|
return _async_to_generator(function() {
|
|
1882
|
-
var response, vastXml;
|
|
1882
|
+
var response, vastXml, trimmedXml;
|
|
1883
1883
|
return _ts_generator(this, function(_state) {
|
|
1884
1884
|
switch(_state.label){
|
|
1885
1885
|
case 0:
|
|
@@ -1905,8 +1905,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1905
1905
|
];
|
|
1906
1906
|
case 2:
|
|
1907
1907
|
vastXml = _state.sent();
|
|
1908
|
-
console.log("[HlsAdPlayer] VAST XML received");
|
|
1908
|
+
console.log("[HlsAdPlayer] VAST XML received (length=".concat(vastXml.length, ")"));
|
|
1909
1909
|
console.log("[HlsAdPlayer] VAST XML content (first 2000 chars):", vastXml.substring(0, 2e3));
|
|
1910
|
+
trimmedXml = vastXml.trim();
|
|
1911
|
+
if (trimmedXml.length === 0) {
|
|
1912
|
+
console.warn("[HlsAdPlayer] VAST response body is empty (no fill)");
|
|
1913
|
+
return [
|
|
1914
|
+
2,
|
|
1915
|
+
null
|
|
1916
|
+
];
|
|
1917
|
+
}
|
|
1910
1918
|
return [
|
|
1911
1919
|
2,
|
|
1912
1920
|
parseVastXml(vastXml)
|
|
@@ -3346,6 +3354,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3346
3354
|
this.preloadPoolActive = false;
|
|
3347
3355
|
this.preloadPoolLoopRunning = false;
|
|
3348
3356
|
this.adDetectSentForCurrentBreak = false;
|
|
3357
|
+
this.latencyProfileApplied = false;
|
|
3349
3358
|
this.continuousFetchLoopRunning = false;
|
|
3350
3359
|
initializePolyfills();
|
|
3351
3360
|
var browserOverrides = getBrowserConfigOverrides();
|
|
@@ -3462,24 +3471,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3462
3471
|
2
|
|
3463
3472
|
];
|
|
3464
3473
|
case 7:
|
|
3465
|
-
this.hls = new import_hls2.default(
|
|
3474
|
+
this.hls = new import_hls2.default({
|
|
3466
3475
|
enableWorker: true,
|
|
3467
3476
|
backBufferLength: 30,
|
|
3468
3477
|
liveDurationInfinity: true,
|
|
3469
3478
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
3470
|
-
maxLiveSyncPlaybackRate:
|
|
3471
|
-
}, this.config.lowLatencyMode ? {
|
|
3472
|
-
liveSyncDuration: 2
|
|
3473
|
-
} : {}), {
|
|
3479
|
+
maxLiveSyncPlaybackRate: 1.1,
|
|
3474
3480
|
maxBufferLength: 30,
|
|
3475
3481
|
maxMaxBufferLength: 600,
|
|
3476
3482
|
maxBufferSize: 60 * 1e3 * 1e3,
|
|
3477
|
-
maxBufferHole:
|
|
3483
|
+
maxBufferHole: 1,
|
|
3478
3484
|
highBufferWatchdogPeriod: 2,
|
|
3479
|
-
nudgeOffset: 0.
|
|
3480
|
-
nudgeMaxRetry:
|
|
3485
|
+
nudgeOffset: 0.2,
|
|
3486
|
+
nudgeMaxRetry: 5,
|
|
3481
3487
|
startPosition: -1
|
|
3482
|
-
})
|
|
3488
|
+
});
|
|
3483
3489
|
this.hls.on(import_hls2.default.Events.MEDIA_ATTACHED, function() {
|
|
3484
3490
|
var _this_hls;
|
|
3485
3491
|
(_this_hls = _this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.loadSource(_this.config.src);
|
|
@@ -3523,6 +3529,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3523
3529
|
this.bufferedSegmentsCount = 0;
|
|
3524
3530
|
this.hasInitialBufferCompleted = false;
|
|
3525
3531
|
this.shouldAutoplayAfterBuffering = !!this.config.autoplay;
|
|
3532
|
+
this.latencyProfileApplied = false;
|
|
3533
|
+
this.detectedLowLatencyStream = void 0;
|
|
3526
3534
|
minSegments = (_this_config_minSegmentsBeforePlay = this.config.minSegmentsBeforePlay) !== null && _this_config_minSegmentsBeforePlay !== void 0 ? _this_config_minSegmentsBeforePlay : 2;
|
|
3527
3535
|
if (this.config.debugAdTiming) {
|
|
3528
3536
|
console.log("[StormcloudVideoPlayer] Waiting for", minSegments, "segments to buffer before playback");
|
|
@@ -3552,6 +3560,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3552
3560
|
}).call(_this);
|
|
3553
3561
|
});
|
|
3554
3562
|
this.hls.on(import_hls2.default.Events.LEVEL_LOADED, function(_evt, data) {
|
|
3563
|
+
_this.applyStreamLatencyProfile(data === null || data === void 0 ? void 0 : data.details);
|
|
3555
3564
|
if (_this.inAdBreak || _this.pendingAdBreak) {
|
|
3556
3565
|
return;
|
|
3557
3566
|
}
|
|
@@ -3831,6 +3840,64 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3831
3840
|
}).call(this);
|
|
3832
3841
|
}
|
|
3833
3842
|
},
|
|
3843
|
+
{
|
|
3844
|
+
key: "applyStreamLatencyProfile",
|
|
3845
|
+
value: function applyStreamLatencyProfile(details) {
|
|
3846
|
+
if (this.latencyProfileApplied || !this.hls) {
|
|
3847
|
+
return;
|
|
3848
|
+
}
|
|
3849
|
+
if (!details) {
|
|
3850
|
+
return;
|
|
3851
|
+
}
|
|
3852
|
+
if (details.live !== true) {
|
|
3853
|
+
this.latencyProfileApplied = true;
|
|
3854
|
+
this.detectedLowLatencyStream = false;
|
|
3855
|
+
return;
|
|
3856
|
+
}
|
|
3857
|
+
var isLowLatencyManifest = this.isLowLatencyManifest(details);
|
|
3858
|
+
var useLowLatency = isLowLatencyManifest && !!this.config.lowLatencyMode;
|
|
3859
|
+
this.detectedLowLatencyStream = useLowLatency;
|
|
3860
|
+
this.latencyProfileApplied = true;
|
|
3861
|
+
var cfg = this.hls.config;
|
|
3862
|
+
if (useLowLatency) {
|
|
3863
|
+
cfg.maxLiveSyncPlaybackRate = 1.5;
|
|
3864
|
+
cfg.maxBufferHole = 0.5;
|
|
3865
|
+
delete cfg.liveSyncDuration;
|
|
3866
|
+
} else {
|
|
3867
|
+
cfg.maxLiveSyncPlaybackRate = 1.1;
|
|
3868
|
+
cfg.maxBufferHole = 1;
|
|
3869
|
+
delete cfg.liveSyncDuration;
|
|
3870
|
+
cfg.liveSyncDurationCount = 3;
|
|
3871
|
+
}
|
|
3872
|
+
if (this.config.debugAdTiming) {
|
|
3873
|
+
var _details_targetduration;
|
|
3874
|
+
console.log("[StormcloudVideoPlayer] Live latency profile: ".concat(useLowLatency ? "LL-HLS (low latency)" : "standard live (stability)"), {
|
|
3875
|
+
isLowLatencyManifest: isLowLatencyManifest,
|
|
3876
|
+
lowLatencyModeRequested: !!this.config.lowLatencyMode,
|
|
3877
|
+
canBlockReload: details.canBlockReload,
|
|
3878
|
+
partTarget: details.partTarget,
|
|
3879
|
+
partHoldBack: details.partHoldBack,
|
|
3880
|
+
partListLength: Array.isArray(details.partList) ? details.partList.length : 0,
|
|
3881
|
+
targetDuration: (_details_targetduration = details.targetduration) !== null && _details_targetduration !== void 0 ? _details_targetduration : details.targetDuration,
|
|
3882
|
+
maxLiveSyncPlaybackRate: cfg.maxLiveSyncPlaybackRate,
|
|
3883
|
+
maxBufferHole: cfg.maxBufferHole
|
|
3884
|
+
});
|
|
3885
|
+
}
|
|
3886
|
+
}
|
|
3887
|
+
},
|
|
3888
|
+
{
|
|
3889
|
+
key: "isLowLatencyManifest",
|
|
3890
|
+
value: function isLowLatencyManifest(details) {
|
|
3891
|
+
if (!details) {
|
|
3892
|
+
return false;
|
|
3893
|
+
}
|
|
3894
|
+
var hasParts = Array.isArray(details.partList) && details.partList.length > 0;
|
|
3895
|
+
var hasPartTarget = typeof details.partTarget === "number" && details.partTarget > 0;
|
|
3896
|
+
var hasPartHoldBack = typeof details.partHoldBack === "number" && details.partHoldBack > 0;
|
|
3897
|
+
var canBlockReload = details.canBlockReload === true;
|
|
3898
|
+
return hasParts || hasPartTarget || hasPartHoldBack || canBlockReload;
|
|
3899
|
+
}
|
|
3900
|
+
},
|
|
3834
3901
|
{
|
|
3835
3902
|
key: "attachImaEventListeners",
|
|
3836
3903
|
value: function attachImaEventListeners() {
|
|
@@ -3887,10 +3954,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3887
3954
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
3888
3955
|
}
|
|
3889
3956
|
}
|
|
3890
|
-
|
|
3891
|
-
var currentVolume = _this.video.volume;
|
|
3892
|
-
var adVolume = currentMuted ? 0 : currentVolume;
|
|
3893
|
-
_this.ima.setAdVolume(adVolume);
|
|
3957
|
+
_this.ima.setAdVolume(_this.getPreAdBreakAdVolume());
|
|
3894
3958
|
if (_this.isShowingPlaceholder) {
|
|
3895
3959
|
if (_this.config.debugAdTiming) {
|
|
3896
3960
|
console.log("[StormcloudVideoPlayer] Hiding placeholder - new ads starting");
|
|
@@ -4644,6 +4708,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4644
4708
|
{
|
|
4645
4709
|
key: "startScte35AdBreak",
|
|
4646
4710
|
value: function startScte35AdBreak(marker, cueKey, durationMs) {
|
|
4711
|
+
this.capturePreAdBreakAudio();
|
|
4647
4712
|
if (!this.video.muted) {
|
|
4648
4713
|
this.video.muted = true;
|
|
4649
4714
|
this.video.volume = 0;
|
|
@@ -5821,6 +5886,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5821
5886
|
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
|
|
5822
5887
|
}
|
|
5823
5888
|
},
|
|
5889
|
+
{
|
|
5890
|
+
key: "isLowLatencyStream",
|
|
5891
|
+
value: function isLowLatencyStream() {
|
|
5892
|
+
return this.detectedLowLatencyStream;
|
|
5893
|
+
}
|
|
5894
|
+
},
|
|
5824
5895
|
{
|
|
5825
5896
|
key: "shouldContinueLiveStreamDuringAds",
|
|
5826
5897
|
value: function shouldContinueLiveStreamDuringAds() {
|
|
@@ -6325,9 +6396,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6325
6396
|
this.continuousFetchingActive = true;
|
|
6326
6397
|
this.isShowingPlaceholder = false;
|
|
6327
6398
|
this.totalAdRequestsInBreak = 0;
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
this.
|
|
6399
|
+
this.capturePreAdBreakAudio();
|
|
6400
|
+
currentMuted = this.preAdBreakAudio.muted;
|
|
6401
|
+
currentVolume = this.preAdBreakAudio.volume;
|
|
6331
6402
|
if (!this.video.muted) {
|
|
6332
6403
|
this.video.muted = true;
|
|
6333
6404
|
this.video.volume = 0;
|
|
@@ -6802,7 +6873,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6802
6873
|
value: function tryNextAvailableAd() {
|
|
6803
6874
|
var retryCount = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
6804
6875
|
return _async_to_generator(function() {
|
|
6805
|
-
var remaining, preloaded,
|
|
6876
|
+
var remaining, preloaded, error, _ref, _ref1, _this_preAdBreakAudio, _this_preAdBreakAudio1, nextAdUrl, error1, errorMessage, maxRetries;
|
|
6806
6877
|
return _ts_generator(this, function(_state) {
|
|
6807
6878
|
switch(_state.label){
|
|
6808
6879
|
case 0:
|
|
@@ -6874,10 +6945,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6874
6945
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
6875
6946
|
this.scheduleAdStopAtBreakBoundary();
|
|
6876
6947
|
}
|
|
6877
|
-
|
|
6878
|
-
currentVolume = this.video.volume;
|
|
6879
|
-
adVolume = currentMuted ? 0 : currentVolume;
|
|
6880
|
-
this.ima.setAdVolume(adVolume);
|
|
6948
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
6881
6949
|
this.consecutiveFailures = 0;
|
|
6882
6950
|
return [
|
|
6883
6951
|
2
|
|
@@ -6924,9 +6992,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6924
6992
|
if (this.config.debugAdTiming) {
|
|
6925
6993
|
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
6994
|
}
|
|
6927
|
-
|
|
6928
|
-
currentVolume1 = this.video.volume;
|
|
6929
|
-
this.ima.updateOriginalMutedState(currentMuted1, currentVolume1);
|
|
6995
|
+
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
6996
|
this.currentAdIndex++;
|
|
6931
6997
|
this.totalAdRequestsInBreak++;
|
|
6932
6998
|
this.lastAdRequestTime = Date.now();
|
|
@@ -7019,7 +7085,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7019
7085
|
key: "showPlaceholderAndWaitForAds",
|
|
7020
7086
|
value: function showPlaceholderAndWaitForAds() {
|
|
7021
7087
|
return _async_to_generator(function() {
|
|
7022
|
-
var remaining, waitTime, checkInterval, maxChecks, i,
|
|
7088
|
+
var remaining, waitTime, checkInterval, maxChecks, i, _ref, _ref1, _this_preAdBreakAudio, _this_preAdBreakAudio1, nextAdUrl, error, errorMessage;
|
|
7023
7089
|
return _ts_generator(this, function(_state) {
|
|
7024
7090
|
switch(_state.label){
|
|
7025
7091
|
case 0:
|
|
@@ -7115,9 +7181,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7115
7181
|
}
|
|
7116
7182
|
this.isShowingPlaceholder = false;
|
|
7117
7183
|
this.ima.hidePlaceholder();
|
|
7118
|
-
|
|
7119
|
-
currentVolume = this.video.volume;
|
|
7120
|
-
this.ima.updateOriginalMutedState(currentMuted, currentVolume);
|
|
7184
|
+
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
7185
|
this.currentAdIndex++;
|
|
7122
7186
|
this.totalAdRequestsInBreak++;
|
|
7123
7187
|
this.lastAdRequestTime = Date.now();
|
|
@@ -7299,7 +7363,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7299
7363
|
first = tags[0];
|
|
7300
7364
|
rest = tags.slice(1);
|
|
7301
7365
|
this.adPodQueue = rest;
|
|
7302
|
-
this.
|
|
7366
|
+
this.capturePreAdBreakAudio();
|
|
7303
7367
|
this.showAds = true;
|
|
7304
7368
|
this.inAdBreak = true;
|
|
7305
7369
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
@@ -7326,12 +7390,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7326
7390
|
];
|
|
7327
7391
|
case 3:
|
|
7328
7392
|
error = _state.sent();
|
|
7329
|
-
this.adPodQueue = [];
|
|
7330
|
-
this.inAdBreak = false;
|
|
7331
|
-
this.showAds = false;
|
|
7332
7393
|
if (this.config.debugAdTiming) {
|
|
7333
7394
|
console.warn("[StormcloudVideoPlayer] VMAP ad request failed:", error);
|
|
7334
7395
|
}
|
|
7396
|
+
this.handleAdPodComplete();
|
|
7335
7397
|
return [
|
|
7336
7398
|
3,
|
|
7337
7399
|
4
|
|
@@ -7562,7 +7624,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7562
7624
|
key: "playSingleAd",
|
|
7563
7625
|
value: function playSingleAd(vastTagUrl) {
|
|
7564
7626
|
return _async_to_generator(function() {
|
|
7565
|
-
var requestToken,
|
|
7627
|
+
var requestToken, playError, preloadedFallback, fallbackError, error, errorMessage, preloadedFallback1, fallbackError1;
|
|
7566
7628
|
return _ts_generator(this, function(_state) {
|
|
7567
7629
|
switch(_state.label){
|
|
7568
7630
|
case 0:
|
|
@@ -7649,10 +7711,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7649
7711
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7650
7712
|
this.scheduleAdStopAtBreakBoundary();
|
|
7651
7713
|
}
|
|
7652
|
-
|
|
7653
|
-
currentVolume = this.video.volume;
|
|
7654
|
-
adVolume = currentMuted ? 0 : currentVolume;
|
|
7655
|
-
this.ima.setAdVolume(adVolume);
|
|
7714
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7656
7715
|
this.consecutiveFailures = 0;
|
|
7657
7716
|
this.temporaryFailureUrls.delete(vastTagUrl);
|
|
7658
7717
|
return [
|
|
@@ -7699,10 +7758,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7699
7758
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7700
7759
|
this.scheduleAdStopAtBreakBoundary();
|
|
7701
7760
|
}
|
|
7702
|
-
|
|
7703
|
-
currentVolume1 = this.video.volume;
|
|
7704
|
-
adVolume1 = currentMuted1 ? 0 : currentVolume1;
|
|
7705
|
-
this.ima.setAdVolume(adVolume1);
|
|
7761
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7706
7762
|
return [
|
|
7707
7763
|
2
|
|
7708
7764
|
];
|
|
@@ -7776,10 +7832,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7776
7832
|
];
|
|
7777
7833
|
case 14:
|
|
7778
7834
|
_state.sent();
|
|
7779
|
-
|
|
7780
|
-
currentVolume2 = this.video.volume;
|
|
7781
|
-
adVolume2 = currentMuted2 ? 0 : currentVolume2;
|
|
7782
|
-
this.ima.setAdVolume(adVolume2);
|
|
7835
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7783
7836
|
return [
|
|
7784
7837
|
2
|
|
7785
7838
|
];
|
|
@@ -7819,6 +7872,33 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7819
7872
|
}).call(this);
|
|
7820
7873
|
}
|
|
7821
7874
|
},
|
|
7875
|
+
{
|
|
7876
|
+
key: "capturePreAdBreakAudio",
|
|
7877
|
+
value: function capturePreAdBreakAudio() {
|
|
7878
|
+
if (this.preAdBreakAudio) {
|
|
7879
|
+
return;
|
|
7880
|
+
}
|
|
7881
|
+
var captured = {
|
|
7882
|
+
muted: this.video.muted,
|
|
7883
|
+
volume: typeof this.video.volume === "number" && !Number.isNaN(this.video.volume) ? Math.max(0, Math.min(1, this.video.volume)) : 1
|
|
7884
|
+
};
|
|
7885
|
+
this.preAdBreakAudio = captured;
|
|
7886
|
+
this.ima.updateOriginalMutedState(captured.muted, captured.volume);
|
|
7887
|
+
if (this.config.debugAdTiming) {
|
|
7888
|
+
console.log("[StormcloudVideoPlayer] Captured pre-ad-break audio state: muted=".concat(captured.muted, ", volume=").concat(captured.volume));
|
|
7889
|
+
}
|
|
7890
|
+
}
|
|
7891
|
+
},
|
|
7892
|
+
{
|
|
7893
|
+
key: "getPreAdBreakAdVolume",
|
|
7894
|
+
value: function getPreAdBreakAdVolume() {
|
|
7895
|
+
var state = this.preAdBreakAudio;
|
|
7896
|
+
if (state) {
|
|
7897
|
+
return state.muted ? 0 : state.volume;
|
|
7898
|
+
}
|
|
7899
|
+
return this.ima.getOriginalMutedState() ? 0 : this.ima.getOriginalVolume();
|
|
7900
|
+
}
|
|
7901
|
+
},
|
|
7822
7902
|
{
|
|
7823
7903
|
key: "handleAdPodComplete",
|
|
7824
7904
|
value: function handleAdPodComplete() {
|
|
@@ -7852,14 +7932,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7852
7932
|
this.consecutiveFailures = 0;
|
|
7853
7933
|
this.globalConsecutiveNoFills = 0;
|
|
7854
7934
|
this.ima.stop().catch(function() {});
|
|
7855
|
-
var restoredMuted = this.ima.getOriginalMutedState();
|
|
7856
|
-
var restoredVolume = this.ima.getOriginalVolume();
|
|
7935
|
+
var restoredMuted = this.preAdBreakAudio ? this.preAdBreakAudio.muted : this.ima.getOriginalMutedState();
|
|
7936
|
+
var restoredVolume = this.preAdBreakAudio ? this.preAdBreakAudio.volume : this.ima.getOriginalVolume();
|
|
7937
|
+
this.ima.updateOriginalMutedState(restoredMuted, restoredVolume);
|
|
7857
7938
|
if (this.video.muted !== restoredMuted) {
|
|
7858
7939
|
this.video.muted = restoredMuted;
|
|
7859
7940
|
}
|
|
7860
7941
|
if (Math.abs(this.video.volume - restoredVolume) > 0.01) {
|
|
7861
7942
|
this.video.volume = restoredVolume;
|
|
7862
7943
|
}
|
|
7944
|
+
this.preAdBreakAudio = void 0;
|
|
7945
|
+
if (this.config.debugAdTiming) {
|
|
7946
|
+
console.log("[StormcloudVideoPlayer] Restored post-ad-break audio state: muted=".concat(restoredMuted, ", volume=").concat(restoredVolume));
|
|
7947
|
+
}
|
|
7863
7948
|
if (this.shouldContinueLiveStreamDuringAds()) {
|
|
7864
7949
|
if (this.video.paused) {
|
|
7865
7950
|
var _this_video_play;
|
|
@@ -8269,6 +8354,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8269
8354
|
this.clearAdFailsafeTimer();
|
|
8270
8355
|
this.clearAdRequestWatchdog();
|
|
8271
8356
|
this.clearPendingAdBreak();
|
|
8357
|
+
this.preAdBreakAudio = void 0;
|
|
8272
8358
|
if (this.placeholderContainer) {
|
|
8273
8359
|
if (this.placeholderContainer.parentElement) {
|
|
8274
8360
|
this.placeholderContainer.parentElement.removeChild(this.placeholderContainer);
|