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
package/lib/index.cjs
CHANGED
|
@@ -2002,7 +2002,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2002
2002
|
}
|
|
2003
2003
|
var adElement = xmlDoc.querySelector("Ad");
|
|
2004
2004
|
if (!adElement) {
|
|
2005
|
-
console.warn("[HlsAdPlayer] No Ad element found in VAST XML");
|
|
2005
|
+
console.warn("[HlsAdPlayer] No Ad element found in VAST XML (no fill). Content (first 2000 chars):", xmlString.substring(0, 2e3));
|
|
2006
2006
|
return null;
|
|
2007
2007
|
}
|
|
2008
2008
|
var adId = adElement.getAttribute("id") || "unknown";
|
|
@@ -2098,7 +2098,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2098
2098
|
}
|
|
2099
2099
|
function fetchAndParseVastAd(vastTagUrl) {
|
|
2100
2100
|
return _async_to_generator(function() {
|
|
2101
|
-
var response, vastXml;
|
|
2101
|
+
var response, vastXml, trimmedXml;
|
|
2102
2102
|
return _ts_generator(this, function(_state) {
|
|
2103
2103
|
switch(_state.label){
|
|
2104
2104
|
case 0:
|
|
@@ -2124,8 +2124,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2124
2124
|
];
|
|
2125
2125
|
case 2:
|
|
2126
2126
|
vastXml = _state.sent();
|
|
2127
|
-
console.log("[HlsAdPlayer] VAST XML received");
|
|
2127
|
+
console.log("[HlsAdPlayer] VAST XML received (length=".concat(vastXml.length, ")"));
|
|
2128
2128
|
console.log("[HlsAdPlayer] VAST XML content (first 2000 chars):", vastXml.substring(0, 2e3));
|
|
2129
|
+
trimmedXml = vastXml.trim();
|
|
2130
|
+
if (trimmedXml.length === 0) {
|
|
2131
|
+
console.warn("[HlsAdPlayer] VAST response body is empty (no fill)");
|
|
2132
|
+
return [
|
|
2133
|
+
2,
|
|
2134
|
+
null
|
|
2135
|
+
];
|
|
2136
|
+
}
|
|
2129
2137
|
return [
|
|
2130
2138
|
2,
|
|
2131
2139
|
parseVastXml(vastXml)
|
|
@@ -3586,6 +3594,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3586
3594
|
this.preloadPoolActive = false;
|
|
3587
3595
|
this.preloadPoolLoopRunning = false;
|
|
3588
3596
|
this.adDetectSentForCurrentBreak = false;
|
|
3597
|
+
this.latencyProfileApplied = false;
|
|
3589
3598
|
this.continuousFetchLoopRunning = false;
|
|
3590
3599
|
initializePolyfills();
|
|
3591
3600
|
var browserOverrides = getBrowserConfigOverrides();
|
|
@@ -3702,24 +3711,21 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3702
3711
|
2
|
|
3703
3712
|
];
|
|
3704
3713
|
case 7:
|
|
3705
|
-
this.hls = new import_hls2.default(
|
|
3714
|
+
this.hls = new import_hls2.default({
|
|
3706
3715
|
enableWorker: true,
|
|
3707
3716
|
backBufferLength: 30,
|
|
3708
3717
|
liveDurationInfinity: true,
|
|
3709
3718
|
lowLatencyMode: !!this.config.lowLatencyMode,
|
|
3710
|
-
maxLiveSyncPlaybackRate:
|
|
3711
|
-
}, this.config.lowLatencyMode ? {
|
|
3712
|
-
liveSyncDuration: 2
|
|
3713
|
-
} : {}), {
|
|
3719
|
+
maxLiveSyncPlaybackRate: 1.1,
|
|
3714
3720
|
maxBufferLength: 30,
|
|
3715
3721
|
maxMaxBufferLength: 600,
|
|
3716
3722
|
maxBufferSize: 60 * 1e3 * 1e3,
|
|
3717
|
-
maxBufferHole:
|
|
3723
|
+
maxBufferHole: 1,
|
|
3718
3724
|
highBufferWatchdogPeriod: 2,
|
|
3719
|
-
nudgeOffset: 0.
|
|
3720
|
-
nudgeMaxRetry:
|
|
3725
|
+
nudgeOffset: 0.2,
|
|
3726
|
+
nudgeMaxRetry: 5,
|
|
3721
3727
|
startPosition: -1
|
|
3722
|
-
})
|
|
3728
|
+
});
|
|
3723
3729
|
this.hls.on(import_hls2.default.Events.MEDIA_ATTACHED, function() {
|
|
3724
3730
|
var _this_hls;
|
|
3725
3731
|
(_this_hls = _this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.loadSource(_this.config.src);
|
|
@@ -3763,6 +3769,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3763
3769
|
this.bufferedSegmentsCount = 0;
|
|
3764
3770
|
this.hasInitialBufferCompleted = false;
|
|
3765
3771
|
this.shouldAutoplayAfterBuffering = !!this.config.autoplay;
|
|
3772
|
+
this.latencyProfileApplied = false;
|
|
3773
|
+
this.detectedLowLatencyStream = void 0;
|
|
3766
3774
|
minSegments = (_this_config_minSegmentsBeforePlay = this.config.minSegmentsBeforePlay) !== null && _this_config_minSegmentsBeforePlay !== void 0 ? _this_config_minSegmentsBeforePlay : 2;
|
|
3767
3775
|
if (this.config.debugAdTiming) {
|
|
3768
3776
|
console.log("[StormcloudVideoPlayer] Waiting for", minSegments, "segments to buffer before playback");
|
|
@@ -3792,6 +3800,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3792
3800
|
}).call(_this);
|
|
3793
3801
|
});
|
|
3794
3802
|
this.hls.on(import_hls2.default.Events.LEVEL_LOADED, function(_evt, data) {
|
|
3803
|
+
_this.applyStreamLatencyProfile(data === null || data === void 0 ? void 0 : data.details);
|
|
3795
3804
|
if (_this.inAdBreak || _this.pendingAdBreak) {
|
|
3796
3805
|
return;
|
|
3797
3806
|
}
|
|
@@ -4071,6 +4080,64 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4071
4080
|
}).call(this);
|
|
4072
4081
|
}
|
|
4073
4082
|
},
|
|
4083
|
+
{
|
|
4084
|
+
key: "applyStreamLatencyProfile",
|
|
4085
|
+
value: function applyStreamLatencyProfile(details) {
|
|
4086
|
+
if (this.latencyProfileApplied || !this.hls) {
|
|
4087
|
+
return;
|
|
4088
|
+
}
|
|
4089
|
+
if (!details) {
|
|
4090
|
+
return;
|
|
4091
|
+
}
|
|
4092
|
+
if (details.live !== true) {
|
|
4093
|
+
this.latencyProfileApplied = true;
|
|
4094
|
+
this.detectedLowLatencyStream = false;
|
|
4095
|
+
return;
|
|
4096
|
+
}
|
|
4097
|
+
var isLowLatencyManifest = this.isLowLatencyManifest(details);
|
|
4098
|
+
var useLowLatency = isLowLatencyManifest && !!this.config.lowLatencyMode;
|
|
4099
|
+
this.detectedLowLatencyStream = useLowLatency;
|
|
4100
|
+
this.latencyProfileApplied = true;
|
|
4101
|
+
var cfg = this.hls.config;
|
|
4102
|
+
if (useLowLatency) {
|
|
4103
|
+
cfg.maxLiveSyncPlaybackRate = 1.5;
|
|
4104
|
+
cfg.maxBufferHole = 0.5;
|
|
4105
|
+
delete cfg.liveSyncDuration;
|
|
4106
|
+
} else {
|
|
4107
|
+
cfg.maxLiveSyncPlaybackRate = 1.1;
|
|
4108
|
+
cfg.maxBufferHole = 1;
|
|
4109
|
+
delete cfg.liveSyncDuration;
|
|
4110
|
+
cfg.liveSyncDurationCount = 3;
|
|
4111
|
+
}
|
|
4112
|
+
if (this.config.debugAdTiming) {
|
|
4113
|
+
var _details_targetduration;
|
|
4114
|
+
console.log("[StormcloudVideoPlayer] Live latency profile: ".concat(useLowLatency ? "LL-HLS (low latency)" : "standard live (stability)"), {
|
|
4115
|
+
isLowLatencyManifest: isLowLatencyManifest,
|
|
4116
|
+
lowLatencyModeRequested: !!this.config.lowLatencyMode,
|
|
4117
|
+
canBlockReload: details.canBlockReload,
|
|
4118
|
+
partTarget: details.partTarget,
|
|
4119
|
+
partHoldBack: details.partHoldBack,
|
|
4120
|
+
partListLength: Array.isArray(details.partList) ? details.partList.length : 0,
|
|
4121
|
+
targetDuration: (_details_targetduration = details.targetduration) !== null && _details_targetduration !== void 0 ? _details_targetduration : details.targetDuration,
|
|
4122
|
+
maxLiveSyncPlaybackRate: cfg.maxLiveSyncPlaybackRate,
|
|
4123
|
+
maxBufferHole: cfg.maxBufferHole
|
|
4124
|
+
});
|
|
4125
|
+
}
|
|
4126
|
+
}
|
|
4127
|
+
},
|
|
4128
|
+
{
|
|
4129
|
+
key: "isLowLatencyManifest",
|
|
4130
|
+
value: function isLowLatencyManifest(details) {
|
|
4131
|
+
if (!details) {
|
|
4132
|
+
return false;
|
|
4133
|
+
}
|
|
4134
|
+
var hasParts = Array.isArray(details.partList) && details.partList.length > 0;
|
|
4135
|
+
var hasPartTarget = typeof details.partTarget === "number" && details.partTarget > 0;
|
|
4136
|
+
var hasPartHoldBack = typeof details.partHoldBack === "number" && details.partHoldBack > 0;
|
|
4137
|
+
var canBlockReload = details.canBlockReload === true;
|
|
4138
|
+
return hasParts || hasPartTarget || hasPartHoldBack || canBlockReload;
|
|
4139
|
+
}
|
|
4140
|
+
},
|
|
4074
4141
|
{
|
|
4075
4142
|
key: "attachImaEventListeners",
|
|
4076
4143
|
value: function attachImaEventListeners() {
|
|
@@ -4127,10 +4194,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4127
4194
|
console.log("[StormcloudVideoPlayer] Starting ad break timer on content_pause (first ad starting)");
|
|
4128
4195
|
}
|
|
4129
4196
|
}
|
|
4130
|
-
|
|
4131
|
-
var currentVolume = _this.video.volume;
|
|
4132
|
-
var adVolume = currentMuted ? 0 : currentVolume;
|
|
4133
|
-
_this.ima.setAdVolume(adVolume);
|
|
4197
|
+
_this.ima.setAdVolume(_this.getPreAdBreakAdVolume());
|
|
4134
4198
|
if (_this.isShowingPlaceholder) {
|
|
4135
4199
|
if (_this.config.debugAdTiming) {
|
|
4136
4200
|
console.log("[StormcloudVideoPlayer] Hiding placeholder - new ads starting");
|
|
@@ -4884,6 +4948,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4884
4948
|
{
|
|
4885
4949
|
key: "startScte35AdBreak",
|
|
4886
4950
|
value: function startScte35AdBreak(marker, cueKey, durationMs) {
|
|
4951
|
+
this.capturePreAdBreakAudio();
|
|
4887
4952
|
if (!this.video.muted) {
|
|
4888
4953
|
this.video.muted = true;
|
|
4889
4954
|
this.video.volume = 0;
|
|
@@ -6061,6 +6126,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6061
6126
|
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
|
|
6062
6127
|
}
|
|
6063
6128
|
},
|
|
6129
|
+
{
|
|
6130
|
+
key: "isLowLatencyStream",
|
|
6131
|
+
value: function isLowLatencyStream() {
|
|
6132
|
+
return this.detectedLowLatencyStream;
|
|
6133
|
+
}
|
|
6134
|
+
},
|
|
6064
6135
|
{
|
|
6065
6136
|
key: "shouldContinueLiveStreamDuringAds",
|
|
6066
6137
|
value: function shouldContinueLiveStreamDuringAds() {
|
|
@@ -6565,9 +6636,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6565
6636
|
this.continuousFetchingActive = true;
|
|
6566
6637
|
this.isShowingPlaceholder = false;
|
|
6567
6638
|
this.totalAdRequestsInBreak = 0;
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
this.
|
|
6639
|
+
this.capturePreAdBreakAudio();
|
|
6640
|
+
currentMuted = this.preAdBreakAudio.muted;
|
|
6641
|
+
currentVolume = this.preAdBreakAudio.volume;
|
|
6571
6642
|
if (!this.video.muted) {
|
|
6572
6643
|
this.video.muted = true;
|
|
6573
6644
|
this.video.volume = 0;
|
|
@@ -7042,7 +7113,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7042
7113
|
value: function tryNextAvailableAd() {
|
|
7043
7114
|
var retryCount = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
7044
7115
|
return _async_to_generator(function() {
|
|
7045
|
-
var remaining, preloaded,
|
|
7116
|
+
var remaining, preloaded, error, _ref, _ref1, _this_preAdBreakAudio, _this_preAdBreakAudio1, nextAdUrl, error1, errorMessage, maxRetries;
|
|
7046
7117
|
return _ts_generator(this, function(_state) {
|
|
7047
7118
|
switch(_state.label){
|
|
7048
7119
|
case 0:
|
|
@@ -7114,10 +7185,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7114
7185
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7115
7186
|
this.scheduleAdStopAtBreakBoundary();
|
|
7116
7187
|
}
|
|
7117
|
-
|
|
7118
|
-
currentVolume = this.video.volume;
|
|
7119
|
-
adVolume = currentMuted ? 0 : currentVolume;
|
|
7120
|
-
this.ima.setAdVolume(adVolume);
|
|
7188
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7121
7189
|
this.consecutiveFailures = 0;
|
|
7122
7190
|
return [
|
|
7123
7191
|
2
|
|
@@ -7164,9 +7232,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7164
7232
|
if (this.config.debugAdTiming) {
|
|
7165
7233
|
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)"));
|
|
7166
7234
|
}
|
|
7167
|
-
|
|
7168
|
-
currentVolume1 = this.video.volume;
|
|
7169
|
-
this.ima.updateOriginalMutedState(currentMuted1, currentVolume1);
|
|
7235
|
+
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);
|
|
7170
7236
|
this.currentAdIndex++;
|
|
7171
7237
|
this.totalAdRequestsInBreak++;
|
|
7172
7238
|
this.lastAdRequestTime = Date.now();
|
|
@@ -7259,7 +7325,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7259
7325
|
key: "showPlaceholderAndWaitForAds",
|
|
7260
7326
|
value: function showPlaceholderAndWaitForAds() {
|
|
7261
7327
|
return _async_to_generator(function() {
|
|
7262
|
-
var remaining, waitTime, checkInterval, maxChecks, i,
|
|
7328
|
+
var remaining, waitTime, checkInterval, maxChecks, i, _ref, _ref1, _this_preAdBreakAudio, _this_preAdBreakAudio1, nextAdUrl, error, errorMessage;
|
|
7263
7329
|
return _ts_generator(this, function(_state) {
|
|
7264
7330
|
switch(_state.label){
|
|
7265
7331
|
case 0:
|
|
@@ -7355,9 +7421,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7355
7421
|
}
|
|
7356
7422
|
this.isShowingPlaceholder = false;
|
|
7357
7423
|
this.ima.hidePlaceholder();
|
|
7358
|
-
|
|
7359
|
-
currentVolume = this.video.volume;
|
|
7360
|
-
this.ima.updateOriginalMutedState(currentMuted, currentVolume);
|
|
7424
|
+
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);
|
|
7361
7425
|
this.currentAdIndex++;
|
|
7362
7426
|
this.totalAdRequestsInBreak++;
|
|
7363
7427
|
this.lastAdRequestTime = Date.now();
|
|
@@ -7539,7 +7603,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7539
7603
|
first = tags[0];
|
|
7540
7604
|
rest = tags.slice(1);
|
|
7541
7605
|
this.adPodQueue = rest;
|
|
7542
|
-
this.
|
|
7606
|
+
this.capturePreAdBreakAudio();
|
|
7543
7607
|
this.showAds = true;
|
|
7544
7608
|
this.inAdBreak = true;
|
|
7545
7609
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
@@ -7566,12 +7630,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7566
7630
|
];
|
|
7567
7631
|
case 3:
|
|
7568
7632
|
error = _state.sent();
|
|
7569
|
-
this.adPodQueue = [];
|
|
7570
|
-
this.inAdBreak = false;
|
|
7571
|
-
this.showAds = false;
|
|
7572
7633
|
if (this.config.debugAdTiming) {
|
|
7573
7634
|
console.warn("[StormcloudVideoPlayer] VMAP ad request failed:", error);
|
|
7574
7635
|
}
|
|
7636
|
+
this.handleAdPodComplete();
|
|
7575
7637
|
return [
|
|
7576
7638
|
3,
|
|
7577
7639
|
4
|
|
@@ -7802,7 +7864,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7802
7864
|
key: "playSingleAd",
|
|
7803
7865
|
value: function playSingleAd(vastTagUrl) {
|
|
7804
7866
|
return _async_to_generator(function() {
|
|
7805
|
-
var requestToken,
|
|
7867
|
+
var requestToken, playError, preloadedFallback, fallbackError, error, errorMessage, preloadedFallback1, fallbackError1;
|
|
7806
7868
|
return _ts_generator(this, function(_state) {
|
|
7807
7869
|
switch(_state.label){
|
|
7808
7870
|
case 0:
|
|
@@ -7889,10 +7951,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7889
7951
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7890
7952
|
this.scheduleAdStopAtBreakBoundary();
|
|
7891
7953
|
}
|
|
7892
|
-
|
|
7893
|
-
currentVolume = this.video.volume;
|
|
7894
|
-
adVolume = currentMuted ? 0 : currentVolume;
|
|
7895
|
-
this.ima.setAdVolume(adVolume);
|
|
7954
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7896
7955
|
this.consecutiveFailures = 0;
|
|
7897
7956
|
this.temporaryFailureUrls.delete(vastTagUrl);
|
|
7898
7957
|
return [
|
|
@@ -7939,10 +7998,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7939
7998
|
if (this.expectedAdBreakDurationMs != null && this.adStopTimerId == null) {
|
|
7940
7999
|
this.scheduleAdStopAtBreakBoundary();
|
|
7941
8000
|
}
|
|
7942
|
-
|
|
7943
|
-
currentVolume1 = this.video.volume;
|
|
7944
|
-
adVolume1 = currentMuted1 ? 0 : currentVolume1;
|
|
7945
|
-
this.ima.setAdVolume(adVolume1);
|
|
8001
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
7946
8002
|
return [
|
|
7947
8003
|
2
|
|
7948
8004
|
];
|
|
@@ -8016,10 +8072,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8016
8072
|
];
|
|
8017
8073
|
case 14:
|
|
8018
8074
|
_state.sent();
|
|
8019
|
-
|
|
8020
|
-
currentVolume2 = this.video.volume;
|
|
8021
|
-
adVolume2 = currentMuted2 ? 0 : currentVolume2;
|
|
8022
|
-
this.ima.setAdVolume(adVolume2);
|
|
8075
|
+
this.ima.setAdVolume(this.getPreAdBreakAdVolume());
|
|
8023
8076
|
return [
|
|
8024
8077
|
2
|
|
8025
8078
|
];
|
|
@@ -8059,6 +8112,33 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8059
8112
|
}).call(this);
|
|
8060
8113
|
}
|
|
8061
8114
|
},
|
|
8115
|
+
{
|
|
8116
|
+
key: "capturePreAdBreakAudio",
|
|
8117
|
+
value: function capturePreAdBreakAudio() {
|
|
8118
|
+
if (this.preAdBreakAudio) {
|
|
8119
|
+
return;
|
|
8120
|
+
}
|
|
8121
|
+
var captured = {
|
|
8122
|
+
muted: this.video.muted,
|
|
8123
|
+
volume: typeof this.video.volume === "number" && !Number.isNaN(this.video.volume) ? Math.max(0, Math.min(1, this.video.volume)) : 1
|
|
8124
|
+
};
|
|
8125
|
+
this.preAdBreakAudio = captured;
|
|
8126
|
+
this.ima.updateOriginalMutedState(captured.muted, captured.volume);
|
|
8127
|
+
if (this.config.debugAdTiming) {
|
|
8128
|
+
console.log("[StormcloudVideoPlayer] Captured pre-ad-break audio state: muted=".concat(captured.muted, ", volume=").concat(captured.volume));
|
|
8129
|
+
}
|
|
8130
|
+
}
|
|
8131
|
+
},
|
|
8132
|
+
{
|
|
8133
|
+
key: "getPreAdBreakAdVolume",
|
|
8134
|
+
value: function getPreAdBreakAdVolume() {
|
|
8135
|
+
var state = this.preAdBreakAudio;
|
|
8136
|
+
if (state) {
|
|
8137
|
+
return state.muted ? 0 : state.volume;
|
|
8138
|
+
}
|
|
8139
|
+
return this.ima.getOriginalMutedState() ? 0 : this.ima.getOriginalVolume();
|
|
8140
|
+
}
|
|
8141
|
+
},
|
|
8062
8142
|
{
|
|
8063
8143
|
key: "handleAdPodComplete",
|
|
8064
8144
|
value: function handleAdPodComplete() {
|
|
@@ -8092,14 +8172,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8092
8172
|
this.consecutiveFailures = 0;
|
|
8093
8173
|
this.globalConsecutiveNoFills = 0;
|
|
8094
8174
|
this.ima.stop().catch(function() {});
|
|
8095
|
-
var restoredMuted = this.ima.getOriginalMutedState();
|
|
8096
|
-
var restoredVolume = this.ima.getOriginalVolume();
|
|
8175
|
+
var restoredMuted = this.preAdBreakAudio ? this.preAdBreakAudio.muted : this.ima.getOriginalMutedState();
|
|
8176
|
+
var restoredVolume = this.preAdBreakAudio ? this.preAdBreakAudio.volume : this.ima.getOriginalVolume();
|
|
8177
|
+
this.ima.updateOriginalMutedState(restoredMuted, restoredVolume);
|
|
8097
8178
|
if (this.video.muted !== restoredMuted) {
|
|
8098
8179
|
this.video.muted = restoredMuted;
|
|
8099
8180
|
}
|
|
8100
8181
|
if (Math.abs(this.video.volume - restoredVolume) > 0.01) {
|
|
8101
8182
|
this.video.volume = restoredVolume;
|
|
8102
8183
|
}
|
|
8184
|
+
this.preAdBreakAudio = void 0;
|
|
8185
|
+
if (this.config.debugAdTiming) {
|
|
8186
|
+
console.log("[StormcloudVideoPlayer] Restored post-ad-break audio state: muted=".concat(restoredMuted, ", volume=").concat(restoredVolume));
|
|
8187
|
+
}
|
|
8103
8188
|
if (this.shouldContinueLiveStreamDuringAds()) {
|
|
8104
8189
|
if (this.video.paused) {
|
|
8105
8190
|
var _this_video_play;
|
|
@@ -8509,6 +8594,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8509
8594
|
this.clearAdFailsafeTimer();
|
|
8510
8595
|
this.clearAdRequestWatchdog();
|
|
8511
8596
|
this.clearPendingAdBreak();
|
|
8597
|
+
this.preAdBreakAudio = void 0;
|
|
8512
8598
|
if (this.placeholderContainer) {
|
|
8513
8599
|
if (this.placeholderContainer.parentElement) {
|
|
8514
8600
|
this.placeholderContainer.parentElement.removeChild(this.placeholderContainer);
|
|
@@ -8543,6 +8629,64 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8543
8629
|
// src/ui/StormcloudVideoPlayer.tsx
|
|
8544
8630
|
var import_fa = require("react-icons/fa");
|
|
8545
8631
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
8632
|
+
var ExpandIcon = function ExpandIcon(param) {
|
|
8633
|
+
var _param_size = param.size, size = _param_size === void 0 ? 18 : _param_size;
|
|
8634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", {
|
|
8635
|
+
width: size,
|
|
8636
|
+
height: size,
|
|
8637
|
+
viewBox: "0 0 24 24",
|
|
8638
|
+
fill: "none",
|
|
8639
|
+
stroke: "currentColor",
|
|
8640
|
+
strokeWidth: 2,
|
|
8641
|
+
strokeLinecap: "round",
|
|
8642
|
+
strokeLinejoin: "round",
|
|
8643
|
+
"aria-hidden": "true",
|
|
8644
|
+
focusable: "false",
|
|
8645
|
+
children: [
|
|
8646
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
8647
|
+
d: "M9 4H4v5"
|
|
8648
|
+
}),
|
|
8649
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
8650
|
+
d: "M20 9V4h-5"
|
|
8651
|
+
}),
|
|
8652
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
8653
|
+
d: "M15 20h5v-5"
|
|
8654
|
+
}),
|
|
8655
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
8656
|
+
d: "M4 15v5h5"
|
|
8657
|
+
})
|
|
8658
|
+
]
|
|
8659
|
+
});
|
|
8660
|
+
};
|
|
8661
|
+
var CompressIcon = function CompressIcon(param) {
|
|
8662
|
+
var _param_size = param.size, size = _param_size === void 0 ? 18 : _param_size;
|
|
8663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", {
|
|
8664
|
+
width: size,
|
|
8665
|
+
height: size,
|
|
8666
|
+
viewBox: "0 0 24 24",
|
|
8667
|
+
fill: "none",
|
|
8668
|
+
stroke: "currentColor",
|
|
8669
|
+
strokeWidth: 2,
|
|
8670
|
+
strokeLinecap: "round",
|
|
8671
|
+
strokeLinejoin: "round",
|
|
8672
|
+
"aria-hidden": "true",
|
|
8673
|
+
focusable: "false",
|
|
8674
|
+
children: [
|
|
8675
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
8676
|
+
d: "M4 9h5V4"
|
|
8677
|
+
}),
|
|
8678
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
8679
|
+
d: "M15 4v5h5"
|
|
8680
|
+
}),
|
|
8681
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
8682
|
+
d: "M20 15h-5v5"
|
|
8683
|
+
}),
|
|
8684
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", {
|
|
8685
|
+
d: "M9 20v-5H4"
|
|
8686
|
+
})
|
|
8687
|
+
]
|
|
8688
|
+
});
|
|
8689
|
+
};
|
|
8546
8690
|
var CRITICAL_PROPS = [
|
|
8547
8691
|
"src",
|
|
8548
8692
|
"allowNativeHls",
|
|
@@ -9593,9 +9737,9 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
9593
9737
|
minHeight: "".concat(36 * responsiveScale, "px")
|
|
9594
9738
|
},
|
|
9595
9739
|
title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
|
|
9596
|
-
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
9740
|
+
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompressIcon, {
|
|
9597
9741
|
size: Math.max(14, 18 * responsiveScale)
|
|
9598
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
9742
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpandIcon, {
|
|
9599
9743
|
size: Math.max(14, 18 * responsiveScale)
|
|
9600
9744
|
})
|
|
9601
9745
|
})
|
|
@@ -9793,9 +9937,9 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
9793
9937
|
background: "rgba(0, 0, 0, 0.6)"
|
|
9794
9938
|
},
|
|
9795
9939
|
title: isFullscreen ? "Exit Fullscreen" : "Enter Fullscreen",
|
|
9796
|
-
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
9940
|
+
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompressIcon, {
|
|
9797
9941
|
size: Math.max(14, 18 * responsiveScale)
|
|
9798
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
9942
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExpandIcon, {
|
|
9799
9943
|
size: Math.max(14, 18 * responsiveScale)
|
|
9800
9944
|
})
|
|
9801
9945
|
})
|