stormcloud-video-player 0.5.3 → 0.5.5
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 +526 -379
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +356 -221
- package/lib/index.d.ts +356 -221
- package/lib/index.js +485 -338
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +255 -117
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +8 -1
- package/lib/players/FilePlayer.cjs +99 -116
- package/lib/players/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +307 -169
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +386 -248
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +21 -11
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/ima.cjs +28 -20
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/sdk/prebid.cjs +17 -9
- package/lib/sdk/prebid.cjs.map +1 -1
- package/lib/sdk/prebidController.cjs +24 -12
- package/lib/sdk/prebidController.cjs.map +1 -1
- package/lib/sdk/vastParser.cjs +19 -11
- package/lib/sdk/vastParser.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +346 -199
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/browserCompat.cjs +11 -11
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/polyfills.cjs +13 -13
- package/lib/utils/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs +19 -11
- package/lib/utils/tracking.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -177,9 +177,17 @@ function _ts_generator(thisArg, body) {
|
|
|
177
177
|
},
|
|
178
178
|
trys: [],
|
|
179
179
|
ops: []
|
|
180
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
181
|
-
return
|
|
182
|
-
|
|
180
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
181
|
+
return d(g, "next", {
|
|
182
|
+
value: verb(0)
|
|
183
|
+
}), d(g, "throw", {
|
|
184
|
+
value: verb(1)
|
|
185
|
+
}), d(g, "return", {
|
|
186
|
+
value: verb(2)
|
|
187
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
188
|
+
value: function() {
|
|
189
|
+
return this;
|
|
190
|
+
}
|
|
183
191
|
}), g;
|
|
184
192
|
function verb(n) {
|
|
185
193
|
return function(v) {
|
|
@@ -279,20 +287,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
279
287
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
280
288
|
var __getProtoOf = Object.getPrototypeOf;
|
|
281
289
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
282
|
-
var __export = function(target, all) {
|
|
290
|
+
var __export = function __export(target, all) {
|
|
283
291
|
for(var name in all)__defProp(target, name, {
|
|
284
292
|
get: all[name],
|
|
285
293
|
enumerable: true
|
|
286
294
|
});
|
|
287
295
|
};
|
|
288
|
-
var __copyProps = function(to, from, except, desc) {
|
|
296
|
+
var __copyProps = function __copyProps(to, from, except, desc) {
|
|
289
297
|
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
290
298
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
291
299
|
try {
|
|
292
300
|
var _loop = function() {
|
|
293
301
|
var key = _step.value;
|
|
294
302
|
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
295
|
-
get: function() {
|
|
303
|
+
get: function get() {
|
|
296
304
|
return from[key];
|
|
297
305
|
},
|
|
298
306
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
@@ -316,7 +324,7 @@ var __copyProps = function(to, from, except, desc) {
|
|
|
316
324
|
}
|
|
317
325
|
return to;
|
|
318
326
|
};
|
|
319
|
-
var __toESM = function(mod, isNodeMode, target) {
|
|
327
|
+
var __toESM = function __toESM(mod, isNodeMode, target) {
|
|
320
328
|
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
321
329
|
// file that has been converted to a CommonJS file using a Babel-
|
|
322
330
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
@@ -326,7 +334,7 @@ var __toESM = function(mod, isNodeMode, target) {
|
|
|
326
334
|
enumerable: true
|
|
327
335
|
}) : target, mod);
|
|
328
336
|
};
|
|
329
|
-
var __toCommonJS = function(mod) {
|
|
337
|
+
var __toCommonJS = function __toCommonJS(mod) {
|
|
330
338
|
return __copyProps(__defProp({}, "__esModule", {
|
|
331
339
|
value: true
|
|
332
340
|
}), mod);
|
|
@@ -334,7 +342,7 @@ var __toCommonJS = function(mod) {
|
|
|
334
342
|
// src/player/StormcloudVideoPlayer.ts
|
|
335
343
|
var StormcloudVideoPlayer_exports = {};
|
|
336
344
|
__export(StormcloudVideoPlayer_exports, {
|
|
337
|
-
StormcloudVideoPlayer: function() {
|
|
345
|
+
StormcloudVideoPlayer: function StormcloudVideoPlayer1() {
|
|
338
346
|
return StormcloudVideoPlayer;
|
|
339
347
|
}
|
|
340
348
|
});
|
|
@@ -667,7 +675,7 @@ function createImaController(video, options) {
|
|
|
667
675
|
var fn = _step.value;
|
|
668
676
|
try {
|
|
669
677
|
fn(payload);
|
|
670
|
-
} catch (
|
|
678
|
+
} catch (unused) {}
|
|
671
679
|
}
|
|
672
680
|
} catch (err) {
|
|
673
681
|
_didIteratorError = true;
|
|
@@ -705,7 +713,7 @@ function createImaController(video, options) {
|
|
|
705
713
|
console.error("StormcloudVideoPlayer: The host page is inside a sandboxed iframe without 'allow-scripts'. Google IMA cannot run ads within sandboxed frames. Remove the sandbox attribute or include 'allow-scripts allow-same-origin'.");
|
|
706
714
|
}
|
|
707
715
|
}
|
|
708
|
-
} catch (
|
|
716
|
+
} catch (unused) {}
|
|
709
717
|
if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
|
|
710
718
|
var existing = document.querySelector('script[data-ima="true"]');
|
|
711
719
|
if (existing) {
|
|
@@ -953,7 +961,7 @@ function createImaController(video, options) {
|
|
|
953
961
|
if (adsManager) {
|
|
954
962
|
try {
|
|
955
963
|
adsManager.destroy();
|
|
956
|
-
} catch (
|
|
964
|
+
} catch (unused) {}
|
|
957
965
|
adsManager = void 0;
|
|
958
966
|
}
|
|
959
967
|
if (adVideoElement) {
|
|
@@ -964,7 +972,7 @@ function createImaController(video, options) {
|
|
|
964
972
|
if (adsLoader) {
|
|
965
973
|
try {
|
|
966
974
|
adsLoader.destroy();
|
|
967
|
-
} catch (
|
|
975
|
+
} catch (unused) {}
|
|
968
976
|
adsLoader = void 0;
|
|
969
977
|
}
|
|
970
978
|
}
|
|
@@ -982,7 +990,7 @@ function createImaController(video, options) {
|
|
|
982
990
|
try {
|
|
983
991
|
var _adDisplayContainer_initialize;
|
|
984
992
|
(_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
|
|
985
|
-
} catch (
|
|
993
|
+
} catch (unused) {}
|
|
986
994
|
}
|
|
987
995
|
}).catch(function() {});
|
|
988
996
|
},
|
|
@@ -1141,7 +1149,7 @@ function createImaController(video, options) {
|
|
|
1141
1149
|
window.setTimeout(function() {
|
|
1142
1150
|
try {
|
|
1143
1151
|
makeAdsRequest(google, lastAdTagUrl);
|
|
1144
|
-
} catch (
|
|
1152
|
+
} catch (unused) {}
|
|
1145
1153
|
}, delay);
|
|
1146
1154
|
} else {
|
|
1147
1155
|
emit("ad_error", {
|
|
@@ -1173,7 +1181,7 @@ function createImaController(video, options) {
|
|
|
1173
1181
|
if (adsManager) {
|
|
1174
1182
|
try {
|
|
1175
1183
|
adsManager.setVolume(adVolume);
|
|
1176
|
-
} catch (
|
|
1184
|
+
} catch (unused) {}
|
|
1177
1185
|
}
|
|
1178
1186
|
emit("content_pause");
|
|
1179
1187
|
});
|
|
@@ -1187,7 +1195,7 @@ function createImaController(video, options) {
|
|
|
1187
1195
|
if (adsManager) {
|
|
1188
1196
|
try {
|
|
1189
1197
|
adsManager.setVolume(originalMutedState ? 0 : adVolume);
|
|
1190
|
-
} catch (
|
|
1198
|
+
} catch (unused) {}
|
|
1191
1199
|
}
|
|
1192
1200
|
}
|
|
1193
1201
|
if (adContainerEl) {
|
|
@@ -1348,7 +1356,7 @@ function createImaController(video, options) {
|
|
|
1348
1356
|
}
|
|
1349
1357
|
try {
|
|
1350
1358
|
adsManager.setVolume(originalMutedState ? 0 : adVolume);
|
|
1351
|
-
} catch (
|
|
1359
|
+
} catch (unused) {}
|
|
1352
1360
|
adsManager.start();
|
|
1353
1361
|
return [
|
|
1354
1362
|
2,
|
|
@@ -1430,7 +1438,7 @@ function createImaController(video, options) {
|
|
|
1430
1438
|
try {
|
|
1431
1439
|
;
|
|
1432
1440
|
adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
|
|
1433
|
-
} catch (
|
|
1441
|
+
} catch (unused) {}
|
|
1434
1442
|
destroyAdsManager();
|
|
1435
1443
|
return [
|
|
1436
1444
|
2
|
|
@@ -1461,7 +1469,7 @@ function createImaController(video, options) {
|
|
|
1461
1469
|
try {
|
|
1462
1470
|
var _adsLoader_destroy;
|
|
1463
1471
|
adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
|
|
1464
|
-
} catch (
|
|
1472
|
+
} catch (unused) {}
|
|
1465
1473
|
adDisplayContainer = void 0;
|
|
1466
1474
|
adsLoader = void 0;
|
|
1467
1475
|
contentVideoHidden = false;
|
|
@@ -1510,7 +1518,7 @@ function createImaController(video, options) {
|
|
|
1510
1518
|
if (adsManager && adPlaying) {
|
|
1511
1519
|
try {
|
|
1512
1520
|
adsManager.setVolume(clampedVolume);
|
|
1513
|
-
} catch (
|
|
1521
|
+
} catch (unused) {}
|
|
1514
1522
|
}
|
|
1515
1523
|
},
|
|
1516
1524
|
getAdVolume: function getAdVolume() {
|
|
@@ -1998,10 +2006,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1998
2006
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
1999
2007
|
if (contentVideo.paused) {
|
|
2000
2008
|
console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback");
|
|
2001
|
-
contentVideo.play().catch(function() {});
|
|
2002
2009
|
} else {
|
|
2003
2010
|
console.log("[HlsAdPlayer] Content video already playing in live mode");
|
|
2004
2011
|
}
|
|
2012
|
+
contentVideo.play().catch(function() {});
|
|
2005
2013
|
}
|
|
2006
2014
|
emit("content_resume");
|
|
2007
2015
|
}
|
|
@@ -2274,8 +2282,8 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2274
2282
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
2275
2283
|
if (contentVideo.paused) {
|
|
2276
2284
|
console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback on stop");
|
|
2277
|
-
contentVideo.play().catch(function() {});
|
|
2278
2285
|
}
|
|
2286
|
+
contentVideo.play().catch(function() {});
|
|
2279
2287
|
}
|
|
2280
2288
|
if (adHls) {
|
|
2281
2289
|
adHls.destroy();
|
|
@@ -2284,6 +2292,8 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2284
2292
|
if (adVideoElement) {
|
|
2285
2293
|
adVideoElement.pause();
|
|
2286
2294
|
adVideoElement.src = "";
|
|
2295
|
+
adVideoElement.remove();
|
|
2296
|
+
adVideoElement = void 0;
|
|
2287
2297
|
}
|
|
2288
2298
|
currentAd = void 0;
|
|
2289
2299
|
return [
|
|
@@ -2426,8 +2436,8 @@ var DEFAULT_TIMEOUT_MS = 3e3;
|
|
|
2426
2436
|
var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
|
|
2427
2437
|
function createPrebidManager() {
|
|
2428
2438
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2429
|
-
var initialized = false;
|
|
2430
2439
|
var _options_debug;
|
|
2440
|
+
var initialized = false;
|
|
2431
2441
|
var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
|
|
2432
2442
|
function log() {
|
|
2433
2443
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -2929,13 +2939,15 @@ function createPrebidController(contentVideo, options) {
|
|
|
2929
2939
|
adContainerEl.style.display = "none";
|
|
2930
2940
|
adContainerEl.style.pointerEvents = "none";
|
|
2931
2941
|
}
|
|
2942
|
+
contentVideo.style.visibility = "visible";
|
|
2943
|
+
contentVideo.style.opacity = "1";
|
|
2932
2944
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
2933
2945
|
if (contentVideo.paused) {
|
|
2934
2946
|
console.log("".concat(LOG, " Content video paused in live mode, resuming playback"));
|
|
2935
|
-
contentVideo.play().catch(function() {});
|
|
2936
2947
|
} else {
|
|
2937
2948
|
console.log("".concat(LOG, " Content video already playing in live mode"));
|
|
2938
2949
|
}
|
|
2950
|
+
contentVideo.play().catch(function() {});
|
|
2939
2951
|
}
|
|
2940
2952
|
emit("content_resume");
|
|
2941
2953
|
}
|
|
@@ -3301,8 +3313,8 @@ function createPrebidController(contentVideo, options) {
|
|
|
3301
3313
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
3302
3314
|
if (contentVideo.paused) {
|
|
3303
3315
|
console.log("".concat(LOG, " Content video paused in live mode, resuming playback on stop"));
|
|
3304
|
-
contentVideo.play().catch(function() {});
|
|
3305
3316
|
}
|
|
3317
|
+
contentVideo.play().catch(function() {});
|
|
3306
3318
|
}
|
|
3307
3319
|
if (adHls) {
|
|
3308
3320
|
adHls.destroy();
|
|
@@ -3311,6 +3323,8 @@ function createPrebidController(contentVideo, options) {
|
|
|
3311
3323
|
if (adVideoElement) {
|
|
3312
3324
|
adVideoElement.pause();
|
|
3313
3325
|
adVideoElement.src = "";
|
|
3326
|
+
adVideoElement.remove();
|
|
3327
|
+
adVideoElement = void 0;
|
|
3314
3328
|
}
|
|
3315
3329
|
currentAd = void 0;
|
|
3316
3330
|
return [
|
|
@@ -4079,6 +4093,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4079
4093
|
this.minAdRequestIntervalMs = 2500;
|
|
4080
4094
|
this.backoffBaseMs = 1e3;
|
|
4081
4095
|
this.maxBackoffMs = 15e3;
|
|
4096
|
+
this.continuousFetchWallClockBufferMs = 3e4;
|
|
4097
|
+
this.continuousFetchMaxIterations = 500;
|
|
4098
|
+
this.continuousFetchQueueFullConsecutiveWaits = 0;
|
|
4082
4099
|
this.preloadPool = [];
|
|
4083
4100
|
this.maxPreloadPoolSize = 3;
|
|
4084
4101
|
this.preloadPoolActive = false;
|
|
@@ -4138,6 +4155,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4138
4155
|
}
|
|
4139
4156
|
}
|
|
4140
4157
|
},
|
|
4158
|
+
{
|
|
4159
|
+
key: "getAdPlayerTypeLabel",
|
|
4160
|
+
value: function getAdPlayerTypeLabel() {
|
|
4161
|
+
var t = this.config.adPlayerType;
|
|
4162
|
+
if (t === "prebid") return "Prebid";
|
|
4163
|
+
if (t === "hls") return "HLS";
|
|
4164
|
+
return "IMA";
|
|
4165
|
+
}
|
|
4166
|
+
},
|
|
4141
4167
|
{
|
|
4142
4168
|
key: "load",
|
|
4143
4169
|
value: function load() {
|
|
@@ -4237,7 +4263,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4237
4263
|
});
|
|
4238
4264
|
this.hls.on(import_hls3.default.Events.MANIFEST_PARSED, function(_, data) {
|
|
4239
4265
|
return _async_to_generator(function() {
|
|
4240
|
-
var
|
|
4266
|
+
var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
|
|
4241
4267
|
return _ts_generator(this, function(_state) {
|
|
4242
4268
|
switch(_state.label){
|
|
4243
4269
|
case 0:
|
|
@@ -4246,10 +4272,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4246
4272
|
} else {
|
|
4247
4273
|
;
|
|
4248
4274
|
;
|
|
4249
|
-
this.isLiveStream = (
|
|
4275
|
+
this.isLiveStream = (_ref = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
|
|
4250
4276
|
var _level_details, _level_details1;
|
|
4251
4277
|
return (level === null || level === void 0 ? void 0 : (_level_details = level.details) === null || _level_details === void 0 ? void 0 : _level_details.live) === true || (level === null || level === void 0 ? void 0 : (_level_details1 = level.details) === null || _level_details1 === void 0 ? void 0 : _level_details1.type) === "LIVE";
|
|
4252
|
-
})) !== null &&
|
|
4278
|
+
})) !== null && _ref !== void 0 ? _ref : false;
|
|
4253
4279
|
}
|
|
4254
4280
|
if (this.config.debugAdTiming) {
|
|
4255
4281
|
adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
|
|
@@ -4313,9 +4339,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4313
4339
|
var tag = "";
|
|
4314
4340
|
var value = "";
|
|
4315
4341
|
if (Array.isArray(entry)) {
|
|
4316
|
-
var _entry_;
|
|
4342
|
+
var _entry_, _entry_1;
|
|
4317
4343
|
tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
|
|
4318
|
-
var _entry_1;
|
|
4319
4344
|
value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
|
|
4320
4345
|
} else if (typeof entry === "string") {
|
|
4321
4346
|
var idx = entry.indexOf(":");
|
|
@@ -4438,9 +4463,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4438
4463
|
var tag = "";
|
|
4439
4464
|
var value = "";
|
|
4440
4465
|
if (Array.isArray(entry)) {
|
|
4441
|
-
var _entry_;
|
|
4466
|
+
var _entry_, _entry_1;
|
|
4442
4467
|
tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
|
|
4443
|
-
var _entry_1;
|
|
4444
4468
|
value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
|
|
4445
4469
|
} else if (typeof entry === "string") {
|
|
4446
4470
|
var idx = entry.indexOf(":");
|
|
@@ -4490,10 +4514,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4490
4514
|
}
|
|
4491
4515
|
});
|
|
4492
4516
|
} else if (tag.includes("EXT-X-DATERANGE")) {
|
|
4517
|
+
var _attrs_CLASS;
|
|
4493
4518
|
var attrs = _this.parseAttributeList(value);
|
|
4494
4519
|
var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
|
|
4495
4520
|
var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
|
|
4496
|
-
var _attrs_CLASS;
|
|
4497
4521
|
var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
|
|
4498
4522
|
var duration = _this.toNumber(attrs["DURATION"]);
|
|
4499
4523
|
if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
|
|
@@ -4629,6 +4653,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4629
4653
|
}
|
|
4630
4654
|
});
|
|
4631
4655
|
this.ima.on("content_resume", function() {
|
|
4656
|
+
console.log("[StormcloudVideoPlayer] content_resume received, inAdBreak=%s, remaining=%s", _this.inAdBreak, _this.getRemainingAdMs());
|
|
4632
4657
|
if (!_this.video.muted) {
|
|
4633
4658
|
_this.video.muted = true;
|
|
4634
4659
|
_this.video.volume = 0;
|
|
@@ -4659,15 +4684,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4659
4684
|
}
|
|
4660
4685
|
},
|
|
4661
4686
|
{
|
|
4662
|
-
key: "
|
|
4663
|
-
value: function
|
|
4687
|
+
key: "recreateAdController",
|
|
4688
|
+
value: function recreateAdController() {
|
|
4689
|
+
var label = this.getAdPlayerTypeLabel();
|
|
4664
4690
|
if (this.config.debugAdTiming) {
|
|
4665
|
-
console.log("[StormcloudVideoPlayer] Recreating
|
|
4691
|
+
console.log("[StormcloudVideoPlayer] Recreating ad controller (".concat(label, ") for new ad"));
|
|
4666
4692
|
}
|
|
4667
4693
|
var shouldShowPlaceholder = this.inAdBreak && this.showAds;
|
|
4668
4694
|
if (shouldShowPlaceholder && this.ima) {
|
|
4669
4695
|
if (this.config.debugAdTiming) {
|
|
4670
|
-
console.log("[StormcloudVideoPlayer] Showing placeholder before destroying old
|
|
4696
|
+
console.log("[StormcloudVideoPlayer] Showing placeholder before destroying old ".concat(label, " controller"));
|
|
4671
4697
|
}
|
|
4672
4698
|
this.showPlaceholderLayer();
|
|
4673
4699
|
this.ima.showPlaceholder();
|
|
@@ -4680,7 +4706,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4680
4706
|
this.video.volume = 0;
|
|
4681
4707
|
} catch (error) {
|
|
4682
4708
|
if (this.config.debugAdTiming) {
|
|
4683
|
-
console.warn("[StormcloudVideoPlayer] Error destroying old
|
|
4709
|
+
console.warn("[StormcloudVideoPlayer] Error destroying old ".concat(label, " controller:"), error);
|
|
4684
4710
|
}
|
|
4685
4711
|
}
|
|
4686
4712
|
}
|
|
@@ -4760,7 +4786,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4760
4786
|
});
|
|
4761
4787
|
}
|
|
4762
4788
|
if (this.config.debugAdTiming) {
|
|
4763
|
-
console.log("[StormcloudVideoPlayer] Showing placeholder layer (between content and
|
|
4789
|
+
console.log("[StormcloudVideoPlayer] Showing placeholder layer (between content and ".concat(this.getAdPlayerTypeLabel(), ")"));
|
|
4764
4790
|
}
|
|
4765
4791
|
}
|
|
4766
4792
|
},
|
|
@@ -4895,11 +4921,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4895
4921
|
}
|
|
4896
4922
|
var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
|
|
4897
4923
|
if (daterangeMatch) {
|
|
4898
|
-
var _daterangeMatch_;
|
|
4924
|
+
var _daterangeMatch_, _attrs_CLASS;
|
|
4899
4925
|
var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
|
|
4900
4926
|
var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
|
|
4901
4927
|
var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
|
|
4902
|
-
var _attrs_CLASS;
|
|
4903
4928
|
var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
|
|
4904
4929
|
var duration = this.toNumber(attrs["DURATION"]);
|
|
4905
4930
|
if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
|
|
@@ -4975,7 +5000,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4975
5000
|
var out = "";
|
|
4976
5001
|
for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
|
|
4977
5002
|
return out;
|
|
4978
|
-
} catch (
|
|
5003
|
+
} catch (unused) {
|
|
4979
5004
|
return void 0;
|
|
4980
5005
|
}
|
|
4981
5006
|
}
|
|
@@ -4994,6 +5019,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4994
5019
|
});
|
|
4995
5020
|
}
|
|
4996
5021
|
if (marker.type === "start") {
|
|
5022
|
+
var _this_config_immediateManifestAds;
|
|
4997
5023
|
var _this_pendingAdBreak;
|
|
4998
5024
|
if (!this.video.muted) {
|
|
4999
5025
|
this.video.muted = true;
|
|
@@ -5018,7 +5044,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5018
5044
|
this.expectedAdBreakDurationMs = durationMs;
|
|
5019
5045
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
5020
5046
|
var isManifestMarker = this.isManifestBasedMarker(marker);
|
|
5021
|
-
var _this_config_immediateManifestAds;
|
|
5022
5047
|
var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
|
|
5023
5048
|
if (this.config.debugAdTiming) {
|
|
5024
5049
|
console.log("[StormcloudVideoPlayer] Ad start decision:", {
|
|
@@ -5173,9 +5198,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5173
5198
|
var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
|
|
5174
5199
|
var match;
|
|
5175
5200
|
while((match = regex.exec(value)) !== null){
|
|
5176
|
-
var _match_;
|
|
5201
|
+
var _match_, _ref, _match_1;
|
|
5177
5202
|
var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
|
|
5178
|
-
var _match_1, _ref;
|
|
5179
5203
|
var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
|
|
5180
5204
|
if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
|
|
5181
5205
|
rawVal = rawVal.slice(1, -1);
|
|
@@ -5474,6 +5498,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5474
5498
|
return this.config.adPlayerType === "prebid";
|
|
5475
5499
|
}
|
|
5476
5500
|
},
|
|
5501
|
+
{
|
|
5502
|
+
key: "isLgStbDevice",
|
|
5503
|
+
value: function isLgStbDevice() {
|
|
5504
|
+
if (typeof navigator === "undefined" || !navigator.userAgent) return false;
|
|
5505
|
+
var ua = navigator.userAgent;
|
|
5506
|
+
return /Web0S|webOS|LG Browser|LGSTB/i.test(ua);
|
|
5507
|
+
}
|
|
5508
|
+
},
|
|
5477
5509
|
{
|
|
5478
5510
|
key: "getCurrentAdIndex",
|
|
5479
5511
|
value: function getCurrentAdIndex() {
|
|
@@ -5534,13 +5566,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5534
5566
|
{
|
|
5535
5567
|
key: "shouldShowNativeControls",
|
|
5536
5568
|
value: function shouldShowNativeControls() {
|
|
5569
|
+
var _this_config_showCustomControls;
|
|
5537
5570
|
var streamType = this.getStreamType();
|
|
5538
5571
|
if (streamType === "other") {
|
|
5539
|
-
var
|
|
5540
|
-
return !((
|
|
5572
|
+
var _this_config_showCustomControls1;
|
|
5573
|
+
return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
|
|
5541
5574
|
}
|
|
5542
|
-
|
|
5543
|
-
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
|
|
5575
|
+
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
|
|
5544
5576
|
}
|
|
5545
5577
|
},
|
|
5546
5578
|
{
|
|
@@ -5699,12 +5731,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5699
5731
|
continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
|
|
5700
5732
|
preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
|
|
5701
5733
|
preloadIma.initialize();
|
|
5702
|
-
errorListener = function(payload) {
|
|
5734
|
+
errorListener = function errorListener(payload) {
|
|
5703
5735
|
hasAdError = true;
|
|
5704
5736
|
adErrorPayload = payload;
|
|
5705
5737
|
};
|
|
5706
5738
|
preloadIma.on("ad_error", errorListener);
|
|
5707
|
-
errorListenerCleanup = function() {
|
|
5739
|
+
errorListenerCleanup = function errorListenerCleanup() {
|
|
5708
5740
|
return preloadIma.off("ad_error", errorListener);
|
|
5709
5741
|
};
|
|
5710
5742
|
return [
|
|
@@ -5755,7 +5787,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5755
5787
|
isReady: true,
|
|
5756
5788
|
loadPromise: Promise.resolve()
|
|
5757
5789
|
};
|
|
5758
|
-
lateErrorListener = function(payload) {
|
|
5790
|
+
lateErrorListener = function lateErrorListener(payload) {
|
|
5759
5791
|
var index = _this.preloadPool.findIndex(function(entry) {
|
|
5760
5792
|
return entry.vastUrl === vastUrl;
|
|
5761
5793
|
});
|
|
@@ -5766,7 +5798,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5766
5798
|
}
|
|
5767
5799
|
try {
|
|
5768
5800
|
preloadIma.destroy();
|
|
5769
|
-
} catch (
|
|
5801
|
+
} catch (unused) {}
|
|
5770
5802
|
}
|
|
5771
5803
|
};
|
|
5772
5804
|
preloadIma.on("ad_error", lateErrorListener);
|
|
@@ -6288,15 +6320,34 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6288
6320
|
key: "continuousFetchLoop",
|
|
6289
6321
|
value: function continuousFetchLoop(baseVastUrl) {
|
|
6290
6322
|
return _async_to_generator(function() {
|
|
6291
|
-
var _this, _loop, _ret;
|
|
6323
|
+
var loopIterations, _this, _loop, _ret;
|
|
6292
6324
|
return _ts_generator(this, function(_state) {
|
|
6293
6325
|
switch(_state.label){
|
|
6294
6326
|
case 0:
|
|
6327
|
+
loopIterations = 0;
|
|
6328
|
+
_state.label = 1;
|
|
6329
|
+
case 1:
|
|
6330
|
+
_state.trys.push([
|
|
6331
|
+
1,
|
|
6332
|
+
,
|
|
6333
|
+
5,
|
|
6334
|
+
6
|
|
6335
|
+
]);
|
|
6295
6336
|
_loop = function() {
|
|
6296
|
-
var remaining, maxQueueSize, newAdUrl, queuedUrlsPreview, generationDelay;
|
|
6337
|
+
var remaining, elapsedMs, maxLoopMs, maxQueueSize, newAdUrl, queuedUrlsPreview, generationDelay;
|
|
6297
6338
|
return _ts_generator(this, function(_state) {
|
|
6298
6339
|
switch(_state.label){
|
|
6299
6340
|
case 0:
|
|
6341
|
+
loopIterations++;
|
|
6342
|
+
if (loopIterations > _this.continuousFetchMaxIterations) {
|
|
6343
|
+
if (_this.config.debugAdTiming) {
|
|
6344
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Max iterations reached (".concat(_this.continuousFetchMaxIterations, "), stopping URL generation"));
|
|
6345
|
+
}
|
|
6346
|
+
return [
|
|
6347
|
+
2,
|
|
6348
|
+
"break"
|
|
6349
|
+
];
|
|
6350
|
+
}
|
|
6300
6351
|
remaining = _this.getRemainingAdMs();
|
|
6301
6352
|
if (remaining <= 0) {
|
|
6302
6353
|
if (_this.config.debugAdTiming) {
|
|
@@ -6307,6 +6358,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6307
6358
|
"break"
|
|
6308
6359
|
];
|
|
6309
6360
|
}
|
|
6361
|
+
if (_this.currentAdBreakStartWallClockMs != null && _this.expectedAdBreakDurationMs != null) {
|
|
6362
|
+
elapsedMs = Date.now() - _this.currentAdBreakStartWallClockMs;
|
|
6363
|
+
maxLoopMs = _this.expectedAdBreakDurationMs + _this.continuousFetchWallClockBufferMs;
|
|
6364
|
+
if (elapsedMs >= maxLoopMs) {
|
|
6365
|
+
if (_this.config.debugAdTiming) {
|
|
6366
|
+
console.log("[CONTINUOUS-FETCH] ⏹️ Wall-clock limit reached (".concat(elapsedMs, "ms >= ").concat(maxLoopMs, "ms), stopping URL generation"));
|
|
6367
|
+
}
|
|
6368
|
+
return [
|
|
6369
|
+
2,
|
|
6370
|
+
"break"
|
|
6371
|
+
];
|
|
6372
|
+
}
|
|
6373
|
+
}
|
|
6310
6374
|
if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
|
|
6311
6375
|
if (_this.config.debugAdTiming) {
|
|
6312
6376
|
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
|
|
@@ -6328,46 +6392,63 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6328
6392
|
maxQueueSize = 5;
|
|
6329
6393
|
if (!(_this.adRequestQueue.length >= maxQueueSize)) return [
|
|
6330
6394
|
3,
|
|
6331
|
-
|
|
6395
|
+
4
|
|
6396
|
+
];
|
|
6397
|
+
if (!(_this.isPrebidMode() && _this.isLgStbDevice())) return [
|
|
6398
|
+
3,
|
|
6399
|
+
1
|
|
6332
6400
|
];
|
|
6401
|
+
_this.adRequestQueue.shift();
|
|
6402
|
+
_this.adRequestQueue.push("");
|
|
6403
|
+
_this.totalAdsInBreak++;
|
|
6404
|
+
_this.continuousFetchQueueFullConsecutiveWaits = 0;
|
|
6333
6405
|
if (_this.config.debugAdTiming) {
|
|
6334
|
-
console.log("[CONTINUOUS-FETCH]
|
|
6406
|
+
console.log("[CONTINUOUS-FETCH] Prebid slot rotated (queue full, dropped oldest); queue: ".concat(_this.adRequestQueue.length));
|
|
6335
6407
|
}
|
|
6336
6408
|
return [
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
return setTimeout(resolve, 1e3);
|
|
6340
|
-
})
|
|
6409
|
+
3,
|
|
6410
|
+
3
|
|
6341
6411
|
];
|
|
6342
6412
|
case 1:
|
|
6413
|
+
return [
|
|
6414
|
+
4,
|
|
6415
|
+
_this.waitForQueueWithBackoff()
|
|
6416
|
+
];
|
|
6417
|
+
case 2:
|
|
6343
6418
|
_state.sent();
|
|
6344
6419
|
return [
|
|
6345
6420
|
2,
|
|
6346
6421
|
"continue"
|
|
6347
6422
|
];
|
|
6348
|
-
case
|
|
6423
|
+
case 3:
|
|
6424
|
+
return [
|
|
6425
|
+
3,
|
|
6426
|
+
8
|
|
6427
|
+
];
|
|
6428
|
+
case 4:
|
|
6349
6429
|
if (!_this.isPrebidMode()) return [
|
|
6350
6430
|
3,
|
|
6351
|
-
|
|
6431
|
+
5
|
|
6352
6432
|
];
|
|
6353
6433
|
_this.adRequestQueue.push("");
|
|
6354
6434
|
_this.totalAdsInBreak++;
|
|
6435
|
+
_this.continuousFetchQueueFullConsecutiveWaits = 0;
|
|
6355
6436
|
if (_this.config.debugAdTiming) {
|
|
6356
6437
|
console.log("[CONTINUOUS-FETCH] Prebid auction slot queued (queue: ".concat(_this.adRequestQueue.length, ")"));
|
|
6357
6438
|
}
|
|
6358
6439
|
return [
|
|
6359
6440
|
3,
|
|
6360
|
-
|
|
6441
|
+
8
|
|
6361
6442
|
];
|
|
6362
|
-
case
|
|
6443
|
+
case 5:
|
|
6363
6444
|
if (!baseVastUrl) return [
|
|
6364
6445
|
3,
|
|
6365
|
-
|
|
6446
|
+
8
|
|
6366
6447
|
];
|
|
6367
6448
|
newAdUrl = _this.generateVastUrlsWithCorrelators(baseVastUrl, 1)[0];
|
|
6368
6449
|
if (!(!newAdUrl || _this.failedVastUrls.has(newAdUrl) || _this.isUrlInCooldown(newAdUrl))) return [
|
|
6369
6450
|
3,
|
|
6370
|
-
|
|
6451
|
+
7
|
|
6371
6452
|
];
|
|
6372
6453
|
return [
|
|
6373
6454
|
4,
|
|
@@ -6375,13 +6456,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6375
6456
|
return setTimeout(resolve, 500);
|
|
6376
6457
|
})
|
|
6377
6458
|
];
|
|
6378
|
-
case
|
|
6459
|
+
case 6:
|
|
6379
6460
|
_state.sent();
|
|
6380
6461
|
return [
|
|
6381
6462
|
2,
|
|
6382
6463
|
"continue"
|
|
6383
6464
|
];
|
|
6384
|
-
case
|
|
6465
|
+
case 7:
|
|
6385
6466
|
if (_this.config.debugAdTiming) {
|
|
6386
6467
|
queuedUrlsPreview = _to_consumable_array(_this.adRequestQueue).concat([
|
|
6387
6468
|
newAdUrl
|
|
@@ -6392,8 +6473,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6392
6473
|
}
|
|
6393
6474
|
_this.adRequestQueue.push(newAdUrl);
|
|
6394
6475
|
_this.totalAdsInBreak++;
|
|
6395
|
-
|
|
6396
|
-
|
|
6476
|
+
_this.continuousFetchQueueFullConsecutiveWaits = 0;
|
|
6477
|
+
_state.label = 8;
|
|
6478
|
+
case 8:
|
|
6397
6479
|
generationDelay = _this.consecutiveFailures > 0 ? Math.min(1e3 * Math.pow(2, _this.consecutiveFailures), 5e3) : 500;
|
|
6398
6480
|
return [
|
|
6399
6481
|
4,
|
|
@@ -6401,7 +6483,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6401
6483
|
return setTimeout(resolve, generationDelay);
|
|
6402
6484
|
})
|
|
6403
6485
|
];
|
|
6404
|
-
case
|
|
6486
|
+
case 9:
|
|
6405
6487
|
_state.sent();
|
|
6406
6488
|
return [
|
|
6407
6489
|
2
|
|
@@ -6409,33 +6491,41 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6409
6491
|
}
|
|
6410
6492
|
});
|
|
6411
6493
|
};
|
|
6412
|
-
_state.label =
|
|
6413
|
-
case
|
|
6494
|
+
_state.label = 2;
|
|
6495
|
+
case 2:
|
|
6414
6496
|
if (!(this.continuousFetchingActive && this.inAdBreak)) return [
|
|
6415
6497
|
3,
|
|
6416
|
-
|
|
6498
|
+
4
|
|
6417
6499
|
];
|
|
6418
6500
|
_this = this;
|
|
6419
6501
|
return [
|
|
6420
6502
|
5,
|
|
6421
6503
|
_ts_values(_loop())
|
|
6422
6504
|
];
|
|
6423
|
-
case
|
|
6505
|
+
case 3:
|
|
6424
6506
|
_ret = _state.sent();
|
|
6425
6507
|
if (_ret === "break") return [
|
|
6426
6508
|
3,
|
|
6427
|
-
|
|
6509
|
+
4
|
|
6428
6510
|
];
|
|
6429
6511
|
return [
|
|
6430
6512
|
3,
|
|
6431
|
-
|
|
6513
|
+
2
|
|
6432
6514
|
];
|
|
6433
|
-
case
|
|
6515
|
+
case 4:
|
|
6516
|
+
return [
|
|
6517
|
+
3,
|
|
6518
|
+
6
|
|
6519
|
+
];
|
|
6520
|
+
case 5:
|
|
6434
6521
|
this.continuousFetchLoopRunning = false;
|
|
6522
|
+
this.continuousFetchQueueFullConsecutiveWaits = 0;
|
|
6523
|
+
return [
|
|
6524
|
+
7
|
|
6525
|
+
];
|
|
6526
|
+
case 6:
|
|
6435
6527
|
if (this.config.debugAdTiming) {
|
|
6436
|
-
|
|
6437
|
-
queuedUrls: _to_consumable_array(this.adRequestQueue)
|
|
6438
|
-
} : {});
|
|
6528
|
+
this.logQueueState("URL generation loop ended");
|
|
6439
6529
|
}
|
|
6440
6530
|
return [
|
|
6441
6531
|
2
|
|
@@ -6445,6 +6535,51 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6445
6535
|
}).call(this);
|
|
6446
6536
|
}
|
|
6447
6537
|
},
|
|
6538
|
+
{
|
|
6539
|
+
key: "waitForQueueWithBackoff",
|
|
6540
|
+
value: function waitForQueueWithBackoff() {
|
|
6541
|
+
return _async_to_generator(function() {
|
|
6542
|
+
var delayMs, shouldLog;
|
|
6543
|
+
return _ts_generator(this, function(_state) {
|
|
6544
|
+
switch(_state.label){
|
|
6545
|
+
case 0:
|
|
6546
|
+
this.continuousFetchQueueFullConsecutiveWaits++;
|
|
6547
|
+
delayMs = Math.min(1e3 * Math.pow(2, this.continuousFetchQueueFullConsecutiveWaits - 1), 5e3);
|
|
6548
|
+
shouldLog = this.config.debugAdTiming && (this.continuousFetchQueueFullConsecutiveWaits <= 2 || this.continuousFetchQueueFullConsecutiveWaits % 4 === 0);
|
|
6549
|
+
if (shouldLog) {
|
|
6550
|
+
console.log("[CONTINUOUS-FETCH] ⏸️ URL queue full (".concat(this.adRequestQueue.length, "), waiting ").concat(delayMs, "ms (wait #").concat(this.continuousFetchQueueFullConsecutiveWaits, ")"));
|
|
6551
|
+
}
|
|
6552
|
+
return [
|
|
6553
|
+
4,
|
|
6554
|
+
new Promise(function(resolve) {
|
|
6555
|
+
return setTimeout(resolve, delayMs);
|
|
6556
|
+
})
|
|
6557
|
+
];
|
|
6558
|
+
case 1:
|
|
6559
|
+
_state.sent();
|
|
6560
|
+
return [
|
|
6561
|
+
2
|
|
6562
|
+
];
|
|
6563
|
+
}
|
|
6564
|
+
});
|
|
6565
|
+
}).call(this);
|
|
6566
|
+
}
|
|
6567
|
+
},
|
|
6568
|
+
{
|
|
6569
|
+
key: "logQueueState",
|
|
6570
|
+
value: function logQueueState(reason) {
|
|
6571
|
+
if (!this.config.debugAdTiming) return;
|
|
6572
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 ".concat(reason), {
|
|
6573
|
+
queueLength: this.adRequestQueue.length,
|
|
6574
|
+
totalAdsInBreak: this.totalAdsInBreak,
|
|
6575
|
+
totalAdRequestsInBreak: this.totalAdRequestsInBreak,
|
|
6576
|
+
consecutiveFailures: this.consecutiveFailures,
|
|
6577
|
+
continuousFetchingActive: this.continuousFetchingActive,
|
|
6578
|
+
continuousFetchLoopRunning: this.continuousFetchLoopRunning,
|
|
6579
|
+
inAdBreak: this.inAdBreak
|
|
6580
|
+
});
|
|
6581
|
+
}
|
|
6582
|
+
},
|
|
6448
6583
|
{
|
|
6449
6584
|
key: "stopContinuousFetching",
|
|
6450
6585
|
value: function stopContinuousFetching() {
|
|
@@ -6591,7 +6726,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6591
6726
|
10
|
|
6592
6727
|
];
|
|
6593
6728
|
nextAdUrl = this.adRequestQueue.shift();
|
|
6594
|
-
if (
|
|
6729
|
+
if (nextAdUrl == null) {
|
|
6595
6730
|
return [
|
|
6596
6731
|
3,
|
|
6597
6732
|
4
|
|
@@ -6615,8 +6750,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6615
6750
|
4
|
|
6616
6751
|
];
|
|
6617
6752
|
}
|
|
6753
|
+
console.log("[StormcloudVideoPlayer] Requesting next ad (%s), queue remaining=%s", nextAdUrl === "" ? "Prebid" : "VAST", this.adRequestQueue.length);
|
|
6618
6754
|
if (this.config.debugAdTiming) {
|
|
6619
|
-
console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC Requesting next ad via
|
|
6755
|
+
console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC Requesting next ad via ".concat(this.getAdPlayerTypeLabel(), " (").concat(this.currentAdIndex + 1, "/").concat(this.totalAdsInBreak, ", ").concat(this.adRequestQueue.length, " remaining in queue)"));
|
|
6620
6756
|
}
|
|
6621
6757
|
currentMuted1 = this.video.muted;
|
|
6622
6758
|
currentVolume1 = this.video.volume;
|
|
@@ -6777,7 +6913,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6777
6913
|
9
|
|
6778
6914
|
];
|
|
6779
6915
|
nextAdUrl = this.adRequestQueue.shift();
|
|
6780
|
-
if (
|
|
6916
|
+
if (nextAdUrl == null) {
|
|
6781
6917
|
return [
|
|
6782
6918
|
3,
|
|
6783
6919
|
3
|
|
@@ -6796,7 +6932,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6796
6932
|
];
|
|
6797
6933
|
}
|
|
6798
6934
|
if (this.config.debugAdTiming) {
|
|
6799
|
-
console.log("[CONTINUOUS-FETCH]
|
|
6935
|
+
console.log("[CONTINUOUS-FETCH] ✅ Ad URL available, requesting via ".concat(this.getAdPlayerTypeLabel()));
|
|
6800
6936
|
}
|
|
6801
6937
|
this.isShowingPlaceholder = false;
|
|
6802
6938
|
this.ima.hidePlaceholder();
|
|
@@ -6982,11 +7118,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6982
7118
|
{
|
|
6983
7119
|
key: "ensureAdStoppedByTimer",
|
|
6984
7120
|
value: function ensureAdStoppedByTimer() {
|
|
7121
|
+
var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
|
|
6985
7122
|
if (!this.inAdBreak) return;
|
|
6986
7123
|
this.adStopTimerId = void 0;
|
|
6987
7124
|
var adPlaying = this.ima.isAdPlaying();
|
|
6988
7125
|
var pendingAds = this.adPodQueue.length > 0;
|
|
6989
|
-
var _this_config_adBreakCheckIntervalMs;
|
|
6990
7126
|
var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
|
|
6991
7127
|
var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
|
|
6992
7128
|
var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
|
|
@@ -6994,7 +7130,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6994
7130
|
if (this.currentAdBreakStartWallClockMs != null) {
|
|
6995
7131
|
elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
6996
7132
|
}
|
|
6997
|
-
var _this_expectedAdBreakDurationMs;
|
|
6998
7133
|
var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
|
|
6999
7134
|
var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
|
|
7000
7135
|
var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
|
|
@@ -7139,7 +7274,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7139
7274
|
}
|
|
7140
7275
|
throw new Error("Too many consecutive failures");
|
|
7141
7276
|
}
|
|
7142
|
-
this.
|
|
7277
|
+
this.recreateAdController();
|
|
7143
7278
|
requestToken = ++this.adRequestTokenCounter;
|
|
7144
7279
|
this.activeAdRequestToken = requestToken;
|
|
7145
7280
|
this.startAdRequestWatchdog(requestToken);
|
|
@@ -7251,15 +7386,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7251
7386
|
9
|
|
7252
7387
|
];
|
|
7253
7388
|
case 9:
|
|
7254
|
-
if (
|
|
7255
|
-
this.
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7389
|
+
if (vastTagUrl) {
|
|
7390
|
+
if (this.isTemporaryAdError(playError)) {
|
|
7391
|
+
this.temporaryFailureUrls.set(vastTagUrl, Date.now());
|
|
7392
|
+
if (this.config.debugAdTiming) {
|
|
7393
|
+
console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
|
|
7394
|
+
}
|
|
7395
|
+
} else {
|
|
7396
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
7397
|
+
if (this.config.debugAdTiming) {
|
|
7398
|
+
console.log("[AD-ERROR] Permanent play error - URL blacklisted");
|
|
7399
|
+
}
|
|
7263
7400
|
}
|
|
7264
7401
|
}
|
|
7265
7402
|
this.clearAdFailsafeTimer();
|
|
@@ -7328,15 +7465,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7328
7465
|
15
|
|
7329
7466
|
];
|
|
7330
7467
|
case 15:
|
|
7331
|
-
if (
|
|
7332
|
-
this.
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7468
|
+
if (vastTagUrl) {
|
|
7469
|
+
if (this.isTemporaryAdError(error)) {
|
|
7470
|
+
this.temporaryFailureUrls.set(vastTagUrl, Date.now());
|
|
7471
|
+
if (this.config.debugAdTiming) {
|
|
7472
|
+
console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
|
|
7473
|
+
}
|
|
7474
|
+
} else {
|
|
7475
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
7476
|
+
if (this.config.debugAdTiming) {
|
|
7477
|
+
console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
|
|
7478
|
+
}
|
|
7340
7479
|
}
|
|
7341
7480
|
}
|
|
7342
7481
|
this.clearAdRequestWatchdog();
|
|
@@ -7380,6 +7519,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7380
7519
|
this.showAds = false;
|
|
7381
7520
|
this.currentAdIndex = 0;
|
|
7382
7521
|
this.totalAdsInBreak = 0;
|
|
7522
|
+
this.totalAdRequestsInBreak = 0;
|
|
7383
7523
|
this.consecutiveFailures = 0;
|
|
7384
7524
|
this.ima.stop().catch(function() {});
|
|
7385
7525
|
var restoredMuted = this.ima.getOriginalMutedState();
|
|
@@ -7391,17 +7531,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7391
7531
|
this.video.volume = restoredVolume;
|
|
7392
7532
|
}
|
|
7393
7533
|
if (this.shouldContinueLiveStreamDuringAds()) {
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
if (this.
|
|
7534
|
+
var _this_video_play;
|
|
7535
|
+
if (this.config.debugAdTiming) {
|
|
7536
|
+
if (this.video.paused) {
|
|
7397
7537
|
console.log("[StormcloudVideoPlayer] Content video paused in live mode after ads, resuming playback");
|
|
7398
|
-
}
|
|
7399
|
-
(_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
|
|
7400
|
-
} else {
|
|
7401
|
-
if (this.config.debugAdTiming) {
|
|
7538
|
+
} else {
|
|
7402
7539
|
console.log("[StormcloudVideoPlayer] Content video already playing in live mode after ads");
|
|
7403
7540
|
}
|
|
7404
7541
|
}
|
|
7542
|
+
(_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
|
|
7405
7543
|
} else if (this.video.paused) {
|
|
7406
7544
|
var _this_video_play1;
|
|
7407
7545
|
(_this_video_play1 = this.video.play()) === null || _this_video_play1 === void 0 ? void 0 : _this_video_play1.catch(function() {});
|
|
@@ -7439,8 +7577,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7439
7577
|
key: "startAdRequestWatchdog",
|
|
7440
7578
|
value: function startAdRequestWatchdog(token) {
|
|
7441
7579
|
var _this = this;
|
|
7442
|
-
this.clearAdRequestWatchdog();
|
|
7443
7580
|
var _this_config_adFailsafeTimeoutMs;
|
|
7581
|
+
this.clearAdRequestWatchdog();
|
|
7444
7582
|
var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
|
|
7445
7583
|
this.adRequestWatchdogToken = token;
|
|
7446
7584
|
this.adRequestWatchdogId = window.setTimeout(function() {
|
|
@@ -7483,8 +7621,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7483
7621
|
key: "startAdFailsafeTimer",
|
|
7484
7622
|
value: function startAdFailsafeTimer(token) {
|
|
7485
7623
|
var _this = this;
|
|
7486
|
-
this.clearAdFailsafeTimer();
|
|
7487
7624
|
var _this_config_adFailsafeTimeoutMs;
|
|
7625
|
+
this.clearAdFailsafeTimer();
|
|
7488
7626
|
var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
|
|
7489
7627
|
this.adFailsafeToken = token;
|
|
7490
7628
|
this.adFailsafeTimerId = window.setTimeout(function() {
|