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
package/lib/players/index.cjs
CHANGED
|
@@ -227,9 +227,17 @@ function _ts_generator(thisArg, body) {
|
|
|
227
227
|
},
|
|
228
228
|
trys: [],
|
|
229
229
|
ops: []
|
|
230
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
231
|
-
return
|
|
232
|
-
|
|
230
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
231
|
+
return d(g, "next", {
|
|
232
|
+
value: verb(0)
|
|
233
|
+
}), d(g, "throw", {
|
|
234
|
+
value: verb(1)
|
|
235
|
+
}), d(g, "return", {
|
|
236
|
+
value: verb(2)
|
|
237
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
238
|
+
value: function() {
|
|
239
|
+
return this;
|
|
240
|
+
}
|
|
233
241
|
}), g;
|
|
234
242
|
function verb(n) {
|
|
235
243
|
return function(v) {
|
|
@@ -329,20 +337,20 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
329
337
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
330
338
|
var __getProtoOf = Object.getPrototypeOf;
|
|
331
339
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
332
|
-
var __export = function(target, all) {
|
|
340
|
+
var __export = function __export(target, all) {
|
|
333
341
|
for(var name in all)__defProp(target, name, {
|
|
334
342
|
get: all[name],
|
|
335
343
|
enumerable: true
|
|
336
344
|
});
|
|
337
345
|
};
|
|
338
|
-
var __copyProps = function(to, from, except, desc) {
|
|
346
|
+
var __copyProps = function __copyProps(to, from, except, desc) {
|
|
339
347
|
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
340
348
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
341
349
|
try {
|
|
342
350
|
var _loop = function() {
|
|
343
351
|
var key = _step.value;
|
|
344
352
|
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
345
|
-
get: function() {
|
|
353
|
+
get: function get() {
|
|
346
354
|
return from[key];
|
|
347
355
|
},
|
|
348
356
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
@@ -366,7 +374,7 @@ var __copyProps = function(to, from, except, desc) {
|
|
|
366
374
|
}
|
|
367
375
|
return to;
|
|
368
376
|
};
|
|
369
|
-
var __toESM = function(mod, isNodeMode, target) {
|
|
377
|
+
var __toESM = function __toESM(mod, isNodeMode, target) {
|
|
370
378
|
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
371
379
|
// file that has been converted to a CommonJS file using a Babel-
|
|
372
380
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
@@ -376,7 +384,7 @@ var __toESM = function(mod, isNodeMode, target) {
|
|
|
376
384
|
enumerable: true
|
|
377
385
|
}) : target, mod);
|
|
378
386
|
};
|
|
379
|
-
var __toCommonJS = function(mod) {
|
|
387
|
+
var __toCommonJS = function __toCommonJS(mod) {
|
|
380
388
|
return __copyProps(__defProp({}, "__esModule", {
|
|
381
389
|
value: true
|
|
382
390
|
}), mod);
|
|
@@ -384,7 +392,7 @@ var __toCommonJS = function(mod) {
|
|
|
384
392
|
// src/players/index.ts
|
|
385
393
|
var players_exports = {};
|
|
386
394
|
__export(players_exports, {
|
|
387
|
-
default: function() {
|
|
395
|
+
default: function _default() {
|
|
388
396
|
return players_default;
|
|
389
397
|
}
|
|
390
398
|
});
|
|
@@ -403,23 +411,23 @@ var DASH_EXTENSIONS = /\.(mpd)($|\?)/i;
|
|
|
403
411
|
var VIDEO_EXTENSIONS = /\.(mp4|webm|ogg|avi|mov|wmv|flv|mkv)($|\?)/i;
|
|
404
412
|
var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|aac|wma|flac|m4a)($|\?)/i;
|
|
405
413
|
var canPlay = {
|
|
406
|
-
hls: function(url) {
|
|
414
|
+
hls: function hls(url) {
|
|
407
415
|
if (!url || typeof url !== "string") return false;
|
|
408
416
|
return HLS_EXTENSIONS.test(url) || HLS_PATHS.test(url);
|
|
409
417
|
},
|
|
410
|
-
dash: function(url) {
|
|
418
|
+
dash: function dash(url) {
|
|
411
419
|
if (!url || typeof url !== "string") return false;
|
|
412
420
|
return DASH_EXTENSIONS.test(url);
|
|
413
421
|
},
|
|
414
|
-
video: function(url) {
|
|
422
|
+
video: function video(url) {
|
|
415
423
|
if (!url || typeof url !== "string") return false;
|
|
416
424
|
return VIDEO_EXTENSIONS.test(url);
|
|
417
425
|
},
|
|
418
|
-
audio: function(url) {
|
|
426
|
+
audio: function audio(url) {
|
|
419
427
|
if (!url || typeof url !== "string") return false;
|
|
420
428
|
return AUDIO_EXTENSIONS.test(url);
|
|
421
429
|
},
|
|
422
|
-
file: function(url) {
|
|
430
|
+
file: function file(url) {
|
|
423
431
|
if (!url || typeof url !== "string") return false;
|
|
424
432
|
return VIDEO_EXTENSIONS.test(url) || AUDIO_EXTENSIONS.test(url);
|
|
425
433
|
}
|
|
@@ -755,7 +763,7 @@ function createImaController(video, options) {
|
|
|
755
763
|
var fn = _step.value;
|
|
756
764
|
try {
|
|
757
765
|
fn(payload);
|
|
758
|
-
} catch (
|
|
766
|
+
} catch (unused) {}
|
|
759
767
|
}
|
|
760
768
|
} catch (err) {
|
|
761
769
|
_didIteratorError = true;
|
|
@@ -793,7 +801,7 @@ function createImaController(video, options) {
|
|
|
793
801
|
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'.");
|
|
794
802
|
}
|
|
795
803
|
}
|
|
796
|
-
} catch (
|
|
804
|
+
} catch (unused) {}
|
|
797
805
|
if (typeof window !== "undefined" && ((_window_google = window.google) === null || _window_google === void 0 ? void 0 : _window_google.ima)) return Promise.resolve();
|
|
798
806
|
var existing = document.querySelector('script[data-ima="true"]');
|
|
799
807
|
if (existing) {
|
|
@@ -1041,7 +1049,7 @@ function createImaController(video, options) {
|
|
|
1041
1049
|
if (adsManager) {
|
|
1042
1050
|
try {
|
|
1043
1051
|
adsManager.destroy();
|
|
1044
|
-
} catch (
|
|
1052
|
+
} catch (unused) {}
|
|
1045
1053
|
adsManager = void 0;
|
|
1046
1054
|
}
|
|
1047
1055
|
if (adVideoElement) {
|
|
@@ -1052,7 +1060,7 @@ function createImaController(video, options) {
|
|
|
1052
1060
|
if (adsLoader) {
|
|
1053
1061
|
try {
|
|
1054
1062
|
adsLoader.destroy();
|
|
1055
|
-
} catch (
|
|
1063
|
+
} catch (unused) {}
|
|
1056
1064
|
adsLoader = void 0;
|
|
1057
1065
|
}
|
|
1058
1066
|
}
|
|
@@ -1070,7 +1078,7 @@ function createImaController(video, options) {
|
|
|
1070
1078
|
try {
|
|
1071
1079
|
var _adDisplayContainer_initialize;
|
|
1072
1080
|
(_adDisplayContainer_initialize = adDisplayContainer.initialize) === null || _adDisplayContainer_initialize === void 0 ? void 0 : _adDisplayContainer_initialize.call(adDisplayContainer);
|
|
1073
|
-
} catch (
|
|
1081
|
+
} catch (unused) {}
|
|
1074
1082
|
}
|
|
1075
1083
|
}).catch(function() {});
|
|
1076
1084
|
},
|
|
@@ -1229,7 +1237,7 @@ function createImaController(video, options) {
|
|
|
1229
1237
|
window.setTimeout(function() {
|
|
1230
1238
|
try {
|
|
1231
1239
|
makeAdsRequest(google, lastAdTagUrl);
|
|
1232
|
-
} catch (
|
|
1240
|
+
} catch (unused) {}
|
|
1233
1241
|
}, delay);
|
|
1234
1242
|
} else {
|
|
1235
1243
|
emit("ad_error", {
|
|
@@ -1261,7 +1269,7 @@ function createImaController(video, options) {
|
|
|
1261
1269
|
if (adsManager) {
|
|
1262
1270
|
try {
|
|
1263
1271
|
adsManager.setVolume(adVolume);
|
|
1264
|
-
} catch (
|
|
1272
|
+
} catch (unused) {}
|
|
1265
1273
|
}
|
|
1266
1274
|
emit("content_pause");
|
|
1267
1275
|
});
|
|
@@ -1275,7 +1283,7 @@ function createImaController(video, options) {
|
|
|
1275
1283
|
if (adsManager) {
|
|
1276
1284
|
try {
|
|
1277
1285
|
adsManager.setVolume(originalMutedState ? 0 : adVolume);
|
|
1278
|
-
} catch (
|
|
1286
|
+
} catch (unused) {}
|
|
1279
1287
|
}
|
|
1280
1288
|
}
|
|
1281
1289
|
if (adContainerEl) {
|
|
@@ -1436,7 +1444,7 @@ function createImaController(video, options) {
|
|
|
1436
1444
|
}
|
|
1437
1445
|
try {
|
|
1438
1446
|
adsManager.setVolume(originalMutedState ? 0 : adVolume);
|
|
1439
|
-
} catch (
|
|
1447
|
+
} catch (unused) {}
|
|
1440
1448
|
adsManager.start();
|
|
1441
1449
|
return [
|
|
1442
1450
|
2,
|
|
@@ -1518,7 +1526,7 @@ function createImaController(video, options) {
|
|
|
1518
1526
|
try {
|
|
1519
1527
|
;
|
|
1520
1528
|
adsManager === null || adsManager === void 0 ? void 0 : (_adsManager_stop = adsManager.stop) === null || _adsManager_stop === void 0 ? void 0 : _adsManager_stop.call(adsManager);
|
|
1521
|
-
} catch (
|
|
1529
|
+
} catch (unused) {}
|
|
1522
1530
|
destroyAdsManager();
|
|
1523
1531
|
return [
|
|
1524
1532
|
2
|
|
@@ -1549,7 +1557,7 @@ function createImaController(video, options) {
|
|
|
1549
1557
|
try {
|
|
1550
1558
|
var _adsLoader_destroy;
|
|
1551
1559
|
adsLoader === null || adsLoader === void 0 ? void 0 : (_adsLoader_destroy = adsLoader.destroy) === null || _adsLoader_destroy === void 0 ? void 0 : _adsLoader_destroy.call(adsLoader);
|
|
1552
|
-
} catch (
|
|
1560
|
+
} catch (unused) {}
|
|
1553
1561
|
adDisplayContainer = void 0;
|
|
1554
1562
|
adsLoader = void 0;
|
|
1555
1563
|
contentVideoHidden = false;
|
|
@@ -1598,7 +1606,7 @@ function createImaController(video, options) {
|
|
|
1598
1606
|
if (adsManager && adPlaying) {
|
|
1599
1607
|
try {
|
|
1600
1608
|
adsManager.setVolume(clampedVolume);
|
|
1601
|
-
} catch (
|
|
1609
|
+
} catch (unused) {}
|
|
1602
1610
|
}
|
|
1603
1611
|
},
|
|
1604
1612
|
getAdVolume: function getAdVolume() {
|
|
@@ -2086,10 +2094,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2086
2094
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
2087
2095
|
if (contentVideo.paused) {
|
|
2088
2096
|
console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback");
|
|
2089
|
-
contentVideo.play().catch(function() {});
|
|
2090
2097
|
} else {
|
|
2091
2098
|
console.log("[HlsAdPlayer] Content video already playing in live mode");
|
|
2092
2099
|
}
|
|
2100
|
+
contentVideo.play().catch(function() {});
|
|
2093
2101
|
}
|
|
2094
2102
|
emit("content_resume");
|
|
2095
2103
|
}
|
|
@@ -2362,8 +2370,8 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2362
2370
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
2363
2371
|
if (contentVideo.paused) {
|
|
2364
2372
|
console.log("[HlsAdPlayer] Content video paused in live mode, resuming playback on stop");
|
|
2365
|
-
contentVideo.play().catch(function() {});
|
|
2366
2373
|
}
|
|
2374
|
+
contentVideo.play().catch(function() {});
|
|
2367
2375
|
}
|
|
2368
2376
|
if (adHls) {
|
|
2369
2377
|
adHls.destroy();
|
|
@@ -2372,6 +2380,8 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2372
2380
|
if (adVideoElement) {
|
|
2373
2381
|
adVideoElement.pause();
|
|
2374
2382
|
adVideoElement.src = "";
|
|
2383
|
+
adVideoElement.remove();
|
|
2384
|
+
adVideoElement = void 0;
|
|
2375
2385
|
}
|
|
2376
2386
|
currentAd = void 0;
|
|
2377
2387
|
return [
|
|
@@ -2514,8 +2524,8 @@ var DEFAULT_TIMEOUT_MS = 3e3;
|
|
|
2514
2524
|
var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
|
|
2515
2525
|
function createPrebidManager() {
|
|
2516
2526
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2517
|
-
var initialized = false;
|
|
2518
2527
|
var _options_debug;
|
|
2528
|
+
var initialized = false;
|
|
2519
2529
|
var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
|
|
2520
2530
|
function log() {
|
|
2521
2531
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -3017,13 +3027,15 @@ function createPrebidController(contentVideo, options) {
|
|
|
3017
3027
|
adContainerEl.style.display = "none";
|
|
3018
3028
|
adContainerEl.style.pointerEvents = "none";
|
|
3019
3029
|
}
|
|
3030
|
+
contentVideo.style.visibility = "visible";
|
|
3031
|
+
contentVideo.style.opacity = "1";
|
|
3020
3032
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
3021
3033
|
if (contentVideo.paused) {
|
|
3022
3034
|
console.log("".concat(LOG, " Content video paused in live mode, resuming playback"));
|
|
3023
|
-
contentVideo.play().catch(function() {});
|
|
3024
3035
|
} else {
|
|
3025
3036
|
console.log("".concat(LOG, " Content video already playing in live mode"));
|
|
3026
3037
|
}
|
|
3038
|
+
contentVideo.play().catch(function() {});
|
|
3027
3039
|
}
|
|
3028
3040
|
emit("content_resume");
|
|
3029
3041
|
}
|
|
@@ -3389,8 +3401,8 @@ function createPrebidController(contentVideo, options) {
|
|
|
3389
3401
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
3390
3402
|
if (contentVideo.paused) {
|
|
3391
3403
|
console.log("".concat(LOG, " Content video paused in live mode, resuming playback on stop"));
|
|
3392
|
-
contentVideo.play().catch(function() {});
|
|
3393
3404
|
}
|
|
3405
|
+
contentVideo.play().catch(function() {});
|
|
3394
3406
|
}
|
|
3395
3407
|
if (adHls) {
|
|
3396
3408
|
adHls.destroy();
|
|
@@ -3399,6 +3411,8 @@ function createPrebidController(contentVideo, options) {
|
|
|
3399
3411
|
if (adVideoElement) {
|
|
3400
3412
|
adVideoElement.pause();
|
|
3401
3413
|
adVideoElement.src = "";
|
|
3414
|
+
adVideoElement.remove();
|
|
3415
|
+
adVideoElement = void 0;
|
|
3402
3416
|
}
|
|
3403
3417
|
currentAd = void 0;
|
|
3404
3418
|
return [
|
|
@@ -4167,6 +4181,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4167
4181
|
this.minAdRequestIntervalMs = 2500;
|
|
4168
4182
|
this.backoffBaseMs = 1e3;
|
|
4169
4183
|
this.maxBackoffMs = 15e3;
|
|
4184
|
+
this.continuousFetchWallClockBufferMs = 3e4;
|
|
4185
|
+
this.continuousFetchMaxIterations = 500;
|
|
4186
|
+
this.continuousFetchQueueFullConsecutiveWaits = 0;
|
|
4170
4187
|
this.preloadPool = [];
|
|
4171
4188
|
this.maxPreloadPoolSize = 3;
|
|
4172
4189
|
this.preloadPoolActive = false;
|
|
@@ -4226,6 +4243,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4226
4243
|
}
|
|
4227
4244
|
}
|
|
4228
4245
|
},
|
|
4246
|
+
{
|
|
4247
|
+
key: "getAdPlayerTypeLabel",
|
|
4248
|
+
value: function getAdPlayerTypeLabel() {
|
|
4249
|
+
var t = this.config.adPlayerType;
|
|
4250
|
+
if (t === "prebid") return "Prebid";
|
|
4251
|
+
if (t === "hls") return "HLS";
|
|
4252
|
+
return "IMA";
|
|
4253
|
+
}
|
|
4254
|
+
},
|
|
4229
4255
|
{
|
|
4230
4256
|
key: "load",
|
|
4231
4257
|
value: function load() {
|
|
@@ -4325,7 +4351,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4325
4351
|
});
|
|
4326
4352
|
this.hls.on(import_hls3.default.Events.MANIFEST_PARSED, function(_, data) {
|
|
4327
4353
|
return _async_to_generator(function() {
|
|
4328
|
-
var
|
|
4354
|
+
var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
|
|
4329
4355
|
return _ts_generator(this, function(_state) {
|
|
4330
4356
|
switch(_state.label){
|
|
4331
4357
|
case 0:
|
|
@@ -4334,10 +4360,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4334
4360
|
} else {
|
|
4335
4361
|
;
|
|
4336
4362
|
;
|
|
4337
|
-
this.isLiveStream = (
|
|
4363
|
+
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) {
|
|
4338
4364
|
var _level_details, _level_details1;
|
|
4339
4365
|
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";
|
|
4340
|
-
})) !== null &&
|
|
4366
|
+
})) !== null && _ref !== void 0 ? _ref : false;
|
|
4341
4367
|
}
|
|
4342
4368
|
if (this.config.debugAdTiming) {
|
|
4343
4369
|
adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
|
|
@@ -4401,9 +4427,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4401
4427
|
var tag = "";
|
|
4402
4428
|
var value = "";
|
|
4403
4429
|
if (Array.isArray(entry)) {
|
|
4404
|
-
var _entry_;
|
|
4430
|
+
var _entry_, _entry_1;
|
|
4405
4431
|
tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
|
|
4406
|
-
var _entry_1;
|
|
4407
4432
|
value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
|
|
4408
4433
|
} else if (typeof entry === "string") {
|
|
4409
4434
|
var idx = entry.indexOf(":");
|
|
@@ -4526,9 +4551,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4526
4551
|
var tag = "";
|
|
4527
4552
|
var value = "";
|
|
4528
4553
|
if (Array.isArray(entry)) {
|
|
4529
|
-
var _entry_;
|
|
4554
|
+
var _entry_, _entry_1;
|
|
4530
4555
|
tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
|
|
4531
|
-
var _entry_1;
|
|
4532
4556
|
value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
|
|
4533
4557
|
} else if (typeof entry === "string") {
|
|
4534
4558
|
var idx = entry.indexOf(":");
|
|
@@ -4578,10 +4602,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4578
4602
|
}
|
|
4579
4603
|
});
|
|
4580
4604
|
} else if (tag.includes("EXT-X-DATERANGE")) {
|
|
4605
|
+
var _attrs_CLASS;
|
|
4581
4606
|
var attrs = _this.parseAttributeList(value);
|
|
4582
4607
|
var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
|
|
4583
4608
|
var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
|
|
4584
|
-
var _attrs_CLASS;
|
|
4585
4609
|
var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
|
|
4586
4610
|
var duration = _this.toNumber(attrs["DURATION"]);
|
|
4587
4611
|
if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
|
|
@@ -4717,6 +4741,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4717
4741
|
}
|
|
4718
4742
|
});
|
|
4719
4743
|
this.ima.on("content_resume", function() {
|
|
4744
|
+
console.log("[StormcloudVideoPlayer] content_resume received, inAdBreak=%s, remaining=%s", _this.inAdBreak, _this.getRemainingAdMs());
|
|
4720
4745
|
if (!_this.video.muted) {
|
|
4721
4746
|
_this.video.muted = true;
|
|
4722
4747
|
_this.video.volume = 0;
|
|
@@ -4747,15 +4772,16 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4747
4772
|
}
|
|
4748
4773
|
},
|
|
4749
4774
|
{
|
|
4750
|
-
key: "
|
|
4751
|
-
value: function
|
|
4775
|
+
key: "recreateAdController",
|
|
4776
|
+
value: function recreateAdController() {
|
|
4777
|
+
var label = this.getAdPlayerTypeLabel();
|
|
4752
4778
|
if (this.config.debugAdTiming) {
|
|
4753
|
-
console.log("[StormcloudVideoPlayer] Recreating
|
|
4779
|
+
console.log("[StormcloudVideoPlayer] Recreating ad controller (".concat(label, ") for new ad"));
|
|
4754
4780
|
}
|
|
4755
4781
|
var shouldShowPlaceholder = this.inAdBreak && this.showAds;
|
|
4756
4782
|
if (shouldShowPlaceholder && this.ima) {
|
|
4757
4783
|
if (this.config.debugAdTiming) {
|
|
4758
|
-
console.log("[StormcloudVideoPlayer] Showing placeholder before destroying old
|
|
4784
|
+
console.log("[StormcloudVideoPlayer] Showing placeholder before destroying old ".concat(label, " controller"));
|
|
4759
4785
|
}
|
|
4760
4786
|
this.showPlaceholderLayer();
|
|
4761
4787
|
this.ima.showPlaceholder();
|
|
@@ -4768,7 +4794,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4768
4794
|
this.video.volume = 0;
|
|
4769
4795
|
} catch (error) {
|
|
4770
4796
|
if (this.config.debugAdTiming) {
|
|
4771
|
-
console.warn("[StormcloudVideoPlayer] Error destroying old
|
|
4797
|
+
console.warn("[StormcloudVideoPlayer] Error destroying old ".concat(label, " controller:"), error);
|
|
4772
4798
|
}
|
|
4773
4799
|
}
|
|
4774
4800
|
}
|
|
@@ -4848,7 +4874,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4848
4874
|
});
|
|
4849
4875
|
}
|
|
4850
4876
|
if (this.config.debugAdTiming) {
|
|
4851
|
-
console.log("[StormcloudVideoPlayer] Showing placeholder layer (between content and
|
|
4877
|
+
console.log("[StormcloudVideoPlayer] Showing placeholder layer (between content and ".concat(this.getAdPlayerTypeLabel(), ")"));
|
|
4852
4878
|
}
|
|
4853
4879
|
}
|
|
4854
4880
|
},
|
|
@@ -4983,11 +5009,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4983
5009
|
}
|
|
4984
5010
|
var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
|
|
4985
5011
|
if (daterangeMatch) {
|
|
4986
|
-
var _daterangeMatch_;
|
|
5012
|
+
var _daterangeMatch_, _attrs_CLASS;
|
|
4987
5013
|
var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
|
|
4988
5014
|
var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
|
|
4989
5015
|
var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
|
|
4990
|
-
var _attrs_CLASS;
|
|
4991
5016
|
var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
|
|
4992
5017
|
var duration = this.toNumber(attrs["DURATION"]);
|
|
4993
5018
|
if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
|
|
@@ -5063,7 +5088,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5063
5088
|
var out = "";
|
|
5064
5089
|
for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
|
|
5065
5090
|
return out;
|
|
5066
|
-
} catch (
|
|
5091
|
+
} catch (unused) {
|
|
5067
5092
|
return void 0;
|
|
5068
5093
|
}
|
|
5069
5094
|
}
|
|
@@ -5082,6 +5107,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5082
5107
|
});
|
|
5083
5108
|
}
|
|
5084
5109
|
if (marker.type === "start") {
|
|
5110
|
+
var _this_config_immediateManifestAds;
|
|
5085
5111
|
var _this_pendingAdBreak;
|
|
5086
5112
|
if (!this.video.muted) {
|
|
5087
5113
|
this.video.muted = true;
|
|
@@ -5106,7 +5132,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5106
5132
|
this.expectedAdBreakDurationMs = durationMs;
|
|
5107
5133
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
5108
5134
|
var isManifestMarker = this.isManifestBasedMarker(marker);
|
|
5109
|
-
var _this_config_immediateManifestAds;
|
|
5110
5135
|
var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
|
|
5111
5136
|
if (this.config.debugAdTiming) {
|
|
5112
5137
|
console.log("[StormcloudVideoPlayer] Ad start decision:", {
|
|
@@ -5261,9 +5286,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5261
5286
|
var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
|
|
5262
5287
|
var match;
|
|
5263
5288
|
while((match = regex.exec(value)) !== null){
|
|
5264
|
-
var _match_;
|
|
5289
|
+
var _match_, _ref, _match_1;
|
|
5265
5290
|
var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
|
|
5266
|
-
var _match_1, _ref;
|
|
5267
5291
|
var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
|
|
5268
5292
|
if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
|
|
5269
5293
|
rawVal = rawVal.slice(1, -1);
|
|
@@ -5562,6 +5586,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5562
5586
|
return this.config.adPlayerType === "prebid";
|
|
5563
5587
|
}
|
|
5564
5588
|
},
|
|
5589
|
+
{
|
|
5590
|
+
key: "isLgStbDevice",
|
|
5591
|
+
value: function isLgStbDevice() {
|
|
5592
|
+
if (typeof navigator === "undefined" || !navigator.userAgent) return false;
|
|
5593
|
+
var ua = navigator.userAgent;
|
|
5594
|
+
return /Web0S|webOS|LG Browser|LGSTB/i.test(ua);
|
|
5595
|
+
}
|
|
5596
|
+
},
|
|
5565
5597
|
{
|
|
5566
5598
|
key: "getCurrentAdIndex",
|
|
5567
5599
|
value: function getCurrentAdIndex() {
|
|
@@ -5622,13 +5654,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5622
5654
|
{
|
|
5623
5655
|
key: "shouldShowNativeControls",
|
|
5624
5656
|
value: function shouldShowNativeControls() {
|
|
5657
|
+
var _this_config_showCustomControls;
|
|
5625
5658
|
var streamType = this.getStreamType();
|
|
5626
5659
|
if (streamType === "other") {
|
|
5627
|
-
var
|
|
5628
|
-
return !((
|
|
5660
|
+
var _this_config_showCustomControls1;
|
|
5661
|
+
return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
|
|
5629
5662
|
}
|
|
5630
|
-
|
|
5631
|
-
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
|
|
5663
|
+
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
|
|
5632
5664
|
}
|
|
5633
5665
|
},
|
|
5634
5666
|
{
|
|
@@ -5787,12 +5819,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5787
5819
|
continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
|
|
5788
5820
|
preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
|
|
5789
5821
|
preloadIma.initialize();
|
|
5790
|
-
errorListener = function(payload) {
|
|
5822
|
+
errorListener = function errorListener(payload) {
|
|
5791
5823
|
hasAdError = true;
|
|
5792
5824
|
adErrorPayload = payload;
|
|
5793
5825
|
};
|
|
5794
5826
|
preloadIma.on("ad_error", errorListener);
|
|
5795
|
-
errorListenerCleanup = function() {
|
|
5827
|
+
errorListenerCleanup = function errorListenerCleanup() {
|
|
5796
5828
|
return preloadIma.off("ad_error", errorListener);
|
|
5797
5829
|
};
|
|
5798
5830
|
return [
|
|
@@ -5843,7 +5875,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5843
5875
|
isReady: true,
|
|
5844
5876
|
loadPromise: Promise.resolve()
|
|
5845
5877
|
};
|
|
5846
|
-
lateErrorListener = function(payload) {
|
|
5878
|
+
lateErrorListener = function lateErrorListener(payload) {
|
|
5847
5879
|
var index = _this.preloadPool.findIndex(function(entry) {
|
|
5848
5880
|
return entry.vastUrl === vastUrl;
|
|
5849
5881
|
});
|
|
@@ -5854,7 +5886,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5854
5886
|
}
|
|
5855
5887
|
try {
|
|
5856
5888
|
preloadIma.destroy();
|
|
5857
|
-
} catch (
|
|
5889
|
+
} catch (unused) {}
|
|
5858
5890
|
}
|
|
5859
5891
|
};
|
|
5860
5892
|
preloadIma.on("ad_error", lateErrorListener);
|
|
@@ -6376,15 +6408,34 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6376
6408
|
key: "continuousFetchLoop",
|
|
6377
6409
|
value: function continuousFetchLoop(baseVastUrl) {
|
|
6378
6410
|
return _async_to_generator(function() {
|
|
6379
|
-
var _this, _loop, _ret;
|
|
6411
|
+
var loopIterations, _this, _loop, _ret;
|
|
6380
6412
|
return _ts_generator(this, function(_state) {
|
|
6381
6413
|
switch(_state.label){
|
|
6382
6414
|
case 0:
|
|
6415
|
+
loopIterations = 0;
|
|
6416
|
+
_state.label = 1;
|
|
6417
|
+
case 1:
|
|
6418
|
+
_state.trys.push([
|
|
6419
|
+
1,
|
|
6420
|
+
,
|
|
6421
|
+
5,
|
|
6422
|
+
6
|
|
6423
|
+
]);
|
|
6383
6424
|
_loop = function() {
|
|
6384
|
-
var remaining, maxQueueSize, newAdUrl, queuedUrlsPreview, generationDelay;
|
|
6425
|
+
var remaining, elapsedMs, maxLoopMs, maxQueueSize, newAdUrl, queuedUrlsPreview, generationDelay;
|
|
6385
6426
|
return _ts_generator(this, function(_state) {
|
|
6386
6427
|
switch(_state.label){
|
|
6387
6428
|
case 0:
|
|
6429
|
+
loopIterations++;
|
|
6430
|
+
if (loopIterations > _this.continuousFetchMaxIterations) {
|
|
6431
|
+
if (_this.config.debugAdTiming) {
|
|
6432
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Max iterations reached (".concat(_this.continuousFetchMaxIterations, "), stopping URL generation"));
|
|
6433
|
+
}
|
|
6434
|
+
return [
|
|
6435
|
+
2,
|
|
6436
|
+
"break"
|
|
6437
|
+
];
|
|
6438
|
+
}
|
|
6388
6439
|
remaining = _this.getRemainingAdMs();
|
|
6389
6440
|
if (remaining <= 0) {
|
|
6390
6441
|
if (_this.config.debugAdTiming) {
|
|
@@ -6395,6 +6446,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6395
6446
|
"break"
|
|
6396
6447
|
];
|
|
6397
6448
|
}
|
|
6449
|
+
if (_this.currentAdBreakStartWallClockMs != null && _this.expectedAdBreakDurationMs != null) {
|
|
6450
|
+
elapsedMs = Date.now() - _this.currentAdBreakStartWallClockMs;
|
|
6451
|
+
maxLoopMs = _this.expectedAdBreakDurationMs + _this.continuousFetchWallClockBufferMs;
|
|
6452
|
+
if (elapsedMs >= maxLoopMs) {
|
|
6453
|
+
if (_this.config.debugAdTiming) {
|
|
6454
|
+
console.log("[CONTINUOUS-FETCH] ⏹️ Wall-clock limit reached (".concat(elapsedMs, "ms >= ").concat(maxLoopMs, "ms), stopping URL generation"));
|
|
6455
|
+
}
|
|
6456
|
+
return [
|
|
6457
|
+
2,
|
|
6458
|
+
"break"
|
|
6459
|
+
];
|
|
6460
|
+
}
|
|
6461
|
+
}
|
|
6398
6462
|
if (_this.consecutiveFailures >= _this.maxConsecutiveFailures) {
|
|
6399
6463
|
if (_this.config.debugAdTiming) {
|
|
6400
6464
|
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 Too many consecutive failures (".concat(_this.consecutiveFailures, "), stopping URL generation"));
|
|
@@ -6416,46 +6480,63 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6416
6480
|
maxQueueSize = 5;
|
|
6417
6481
|
if (!(_this.adRequestQueue.length >= maxQueueSize)) return [
|
|
6418
6482
|
3,
|
|
6419
|
-
|
|
6483
|
+
4
|
|
6484
|
+
];
|
|
6485
|
+
if (!(_this.isPrebidMode() && _this.isLgStbDevice())) return [
|
|
6486
|
+
3,
|
|
6487
|
+
1
|
|
6420
6488
|
];
|
|
6489
|
+
_this.adRequestQueue.shift();
|
|
6490
|
+
_this.adRequestQueue.push("");
|
|
6491
|
+
_this.totalAdsInBreak++;
|
|
6492
|
+
_this.continuousFetchQueueFullConsecutiveWaits = 0;
|
|
6421
6493
|
if (_this.config.debugAdTiming) {
|
|
6422
|
-
console.log("[CONTINUOUS-FETCH]
|
|
6494
|
+
console.log("[CONTINUOUS-FETCH] Prebid slot rotated (queue full, dropped oldest); queue: ".concat(_this.adRequestQueue.length));
|
|
6423
6495
|
}
|
|
6424
6496
|
return [
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
return setTimeout(resolve, 1e3);
|
|
6428
|
-
})
|
|
6497
|
+
3,
|
|
6498
|
+
3
|
|
6429
6499
|
];
|
|
6430
6500
|
case 1:
|
|
6501
|
+
return [
|
|
6502
|
+
4,
|
|
6503
|
+
_this.waitForQueueWithBackoff()
|
|
6504
|
+
];
|
|
6505
|
+
case 2:
|
|
6431
6506
|
_state.sent();
|
|
6432
6507
|
return [
|
|
6433
6508
|
2,
|
|
6434
6509
|
"continue"
|
|
6435
6510
|
];
|
|
6436
|
-
case
|
|
6511
|
+
case 3:
|
|
6512
|
+
return [
|
|
6513
|
+
3,
|
|
6514
|
+
8
|
|
6515
|
+
];
|
|
6516
|
+
case 4:
|
|
6437
6517
|
if (!_this.isPrebidMode()) return [
|
|
6438
6518
|
3,
|
|
6439
|
-
|
|
6519
|
+
5
|
|
6440
6520
|
];
|
|
6441
6521
|
_this.adRequestQueue.push("");
|
|
6442
6522
|
_this.totalAdsInBreak++;
|
|
6523
|
+
_this.continuousFetchQueueFullConsecutiveWaits = 0;
|
|
6443
6524
|
if (_this.config.debugAdTiming) {
|
|
6444
6525
|
console.log("[CONTINUOUS-FETCH] Prebid auction slot queued (queue: ".concat(_this.adRequestQueue.length, ")"));
|
|
6445
6526
|
}
|
|
6446
6527
|
return [
|
|
6447
6528
|
3,
|
|
6448
|
-
|
|
6529
|
+
8
|
|
6449
6530
|
];
|
|
6450
|
-
case
|
|
6531
|
+
case 5:
|
|
6451
6532
|
if (!baseVastUrl) return [
|
|
6452
6533
|
3,
|
|
6453
|
-
|
|
6534
|
+
8
|
|
6454
6535
|
];
|
|
6455
6536
|
newAdUrl = _this.generateVastUrlsWithCorrelators(baseVastUrl, 1)[0];
|
|
6456
6537
|
if (!(!newAdUrl || _this.failedVastUrls.has(newAdUrl) || _this.isUrlInCooldown(newAdUrl))) return [
|
|
6457
6538
|
3,
|
|
6458
|
-
|
|
6539
|
+
7
|
|
6459
6540
|
];
|
|
6460
6541
|
return [
|
|
6461
6542
|
4,
|
|
@@ -6463,13 +6544,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6463
6544
|
return setTimeout(resolve, 500);
|
|
6464
6545
|
})
|
|
6465
6546
|
];
|
|
6466
|
-
case
|
|
6547
|
+
case 6:
|
|
6467
6548
|
_state.sent();
|
|
6468
6549
|
return [
|
|
6469
6550
|
2,
|
|
6470
6551
|
"continue"
|
|
6471
6552
|
];
|
|
6472
|
-
case
|
|
6553
|
+
case 7:
|
|
6473
6554
|
if (_this.config.debugAdTiming) {
|
|
6474
6555
|
queuedUrlsPreview = _to_consumable_array(_this.adRequestQueue).concat([
|
|
6475
6556
|
newAdUrl
|
|
@@ -6480,8 +6561,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6480
6561
|
}
|
|
6481
6562
|
_this.adRequestQueue.push(newAdUrl);
|
|
6482
6563
|
_this.totalAdsInBreak++;
|
|
6483
|
-
|
|
6484
|
-
|
|
6564
|
+
_this.continuousFetchQueueFullConsecutiveWaits = 0;
|
|
6565
|
+
_state.label = 8;
|
|
6566
|
+
case 8:
|
|
6485
6567
|
generationDelay = _this.consecutiveFailures > 0 ? Math.min(1e3 * Math.pow(2, _this.consecutiveFailures), 5e3) : 500;
|
|
6486
6568
|
return [
|
|
6487
6569
|
4,
|
|
@@ -6489,7 +6571,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6489
6571
|
return setTimeout(resolve, generationDelay);
|
|
6490
6572
|
})
|
|
6491
6573
|
];
|
|
6492
|
-
case
|
|
6574
|
+
case 9:
|
|
6493
6575
|
_state.sent();
|
|
6494
6576
|
return [
|
|
6495
6577
|
2
|
|
@@ -6497,33 +6579,41 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6497
6579
|
}
|
|
6498
6580
|
});
|
|
6499
6581
|
};
|
|
6500
|
-
_state.label =
|
|
6501
|
-
case
|
|
6582
|
+
_state.label = 2;
|
|
6583
|
+
case 2:
|
|
6502
6584
|
if (!(this.continuousFetchingActive && this.inAdBreak)) return [
|
|
6503
6585
|
3,
|
|
6504
|
-
|
|
6586
|
+
4
|
|
6505
6587
|
];
|
|
6506
6588
|
_this = this;
|
|
6507
6589
|
return [
|
|
6508
6590
|
5,
|
|
6509
6591
|
_ts_values(_loop())
|
|
6510
6592
|
];
|
|
6511
|
-
case
|
|
6593
|
+
case 3:
|
|
6512
6594
|
_ret = _state.sent();
|
|
6513
6595
|
if (_ret === "break") return [
|
|
6514
6596
|
3,
|
|
6515
|
-
|
|
6597
|
+
4
|
|
6516
6598
|
];
|
|
6517
6599
|
return [
|
|
6518
6600
|
3,
|
|
6519
|
-
|
|
6601
|
+
2
|
|
6520
6602
|
];
|
|
6521
|
-
case
|
|
6603
|
+
case 4:
|
|
6604
|
+
return [
|
|
6605
|
+
3,
|
|
6606
|
+
6
|
|
6607
|
+
];
|
|
6608
|
+
case 5:
|
|
6522
6609
|
this.continuousFetchLoopRunning = false;
|
|
6610
|
+
this.continuousFetchQueueFullConsecutiveWaits = 0;
|
|
6611
|
+
return [
|
|
6612
|
+
7
|
|
6613
|
+
];
|
|
6614
|
+
case 6:
|
|
6523
6615
|
if (this.config.debugAdTiming) {
|
|
6524
|
-
|
|
6525
|
-
queuedUrls: _to_consumable_array(this.adRequestQueue)
|
|
6526
|
-
} : {});
|
|
6616
|
+
this.logQueueState("URL generation loop ended");
|
|
6527
6617
|
}
|
|
6528
6618
|
return [
|
|
6529
6619
|
2
|
|
@@ -6533,6 +6623,51 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6533
6623
|
}).call(this);
|
|
6534
6624
|
}
|
|
6535
6625
|
},
|
|
6626
|
+
{
|
|
6627
|
+
key: "waitForQueueWithBackoff",
|
|
6628
|
+
value: function waitForQueueWithBackoff() {
|
|
6629
|
+
return _async_to_generator(function() {
|
|
6630
|
+
var delayMs, shouldLog;
|
|
6631
|
+
return _ts_generator(this, function(_state) {
|
|
6632
|
+
switch(_state.label){
|
|
6633
|
+
case 0:
|
|
6634
|
+
this.continuousFetchQueueFullConsecutiveWaits++;
|
|
6635
|
+
delayMs = Math.min(1e3 * Math.pow(2, this.continuousFetchQueueFullConsecutiveWaits - 1), 5e3);
|
|
6636
|
+
shouldLog = this.config.debugAdTiming && (this.continuousFetchQueueFullConsecutiveWaits <= 2 || this.continuousFetchQueueFullConsecutiveWaits % 4 === 0);
|
|
6637
|
+
if (shouldLog) {
|
|
6638
|
+
console.log("[CONTINUOUS-FETCH] ⏸️ URL queue full (".concat(this.adRequestQueue.length, "), waiting ").concat(delayMs, "ms (wait #").concat(this.continuousFetchQueueFullConsecutiveWaits, ")"));
|
|
6639
|
+
}
|
|
6640
|
+
return [
|
|
6641
|
+
4,
|
|
6642
|
+
new Promise(function(resolve) {
|
|
6643
|
+
return setTimeout(resolve, delayMs);
|
|
6644
|
+
})
|
|
6645
|
+
];
|
|
6646
|
+
case 1:
|
|
6647
|
+
_state.sent();
|
|
6648
|
+
return [
|
|
6649
|
+
2
|
|
6650
|
+
];
|
|
6651
|
+
}
|
|
6652
|
+
});
|
|
6653
|
+
}).call(this);
|
|
6654
|
+
}
|
|
6655
|
+
},
|
|
6656
|
+
{
|
|
6657
|
+
key: "logQueueState",
|
|
6658
|
+
value: function logQueueState(reason) {
|
|
6659
|
+
if (!this.config.debugAdTiming) return;
|
|
6660
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDED1 ".concat(reason), {
|
|
6661
|
+
queueLength: this.adRequestQueue.length,
|
|
6662
|
+
totalAdsInBreak: this.totalAdsInBreak,
|
|
6663
|
+
totalAdRequestsInBreak: this.totalAdRequestsInBreak,
|
|
6664
|
+
consecutiveFailures: this.consecutiveFailures,
|
|
6665
|
+
continuousFetchingActive: this.continuousFetchingActive,
|
|
6666
|
+
continuousFetchLoopRunning: this.continuousFetchLoopRunning,
|
|
6667
|
+
inAdBreak: this.inAdBreak
|
|
6668
|
+
});
|
|
6669
|
+
}
|
|
6670
|
+
},
|
|
6536
6671
|
{
|
|
6537
6672
|
key: "stopContinuousFetching",
|
|
6538
6673
|
value: function stopContinuousFetching() {
|
|
@@ -6679,7 +6814,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6679
6814
|
10
|
|
6680
6815
|
];
|
|
6681
6816
|
nextAdUrl = this.adRequestQueue.shift();
|
|
6682
|
-
if (
|
|
6817
|
+
if (nextAdUrl == null) {
|
|
6683
6818
|
return [
|
|
6684
6819
|
3,
|
|
6685
6820
|
4
|
|
@@ -6703,8 +6838,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6703
6838
|
4
|
|
6704
6839
|
];
|
|
6705
6840
|
}
|
|
6841
|
+
console.log("[StormcloudVideoPlayer] Requesting next ad (%s), queue remaining=%s", nextAdUrl === "" ? "Prebid" : "VAST", this.adRequestQueue.length);
|
|
6706
6842
|
if (this.config.debugAdTiming) {
|
|
6707
|
-
console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC Requesting next ad via
|
|
6843
|
+
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)"));
|
|
6708
6844
|
}
|
|
6709
6845
|
currentMuted1 = this.video.muted;
|
|
6710
6846
|
currentVolume1 = this.video.volume;
|
|
@@ -6865,7 +7001,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6865
7001
|
9
|
|
6866
7002
|
];
|
|
6867
7003
|
nextAdUrl = this.adRequestQueue.shift();
|
|
6868
|
-
if (
|
|
7004
|
+
if (nextAdUrl == null) {
|
|
6869
7005
|
return [
|
|
6870
7006
|
3,
|
|
6871
7007
|
3
|
|
@@ -6884,7 +7020,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6884
7020
|
];
|
|
6885
7021
|
}
|
|
6886
7022
|
if (this.config.debugAdTiming) {
|
|
6887
|
-
console.log("[CONTINUOUS-FETCH]
|
|
7023
|
+
console.log("[CONTINUOUS-FETCH] ✅ Ad URL available, requesting via ".concat(this.getAdPlayerTypeLabel()));
|
|
6888
7024
|
}
|
|
6889
7025
|
this.isShowingPlaceholder = false;
|
|
6890
7026
|
this.ima.hidePlaceholder();
|
|
@@ -7070,11 +7206,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7070
7206
|
{
|
|
7071
7207
|
key: "ensureAdStoppedByTimer",
|
|
7072
7208
|
value: function ensureAdStoppedByTimer() {
|
|
7209
|
+
var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
|
|
7073
7210
|
if (!this.inAdBreak) return;
|
|
7074
7211
|
this.adStopTimerId = void 0;
|
|
7075
7212
|
var adPlaying = this.ima.isAdPlaying();
|
|
7076
7213
|
var pendingAds = this.adPodQueue.length > 0;
|
|
7077
|
-
var _this_config_adBreakCheckIntervalMs;
|
|
7078
7214
|
var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
|
|
7079
7215
|
var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
|
|
7080
7216
|
var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
|
|
@@ -7082,7 +7218,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7082
7218
|
if (this.currentAdBreakStartWallClockMs != null) {
|
|
7083
7219
|
elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
7084
7220
|
}
|
|
7085
|
-
var _this_expectedAdBreakDurationMs;
|
|
7086
7221
|
var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
|
|
7087
7222
|
var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
|
|
7088
7223
|
var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
|
|
@@ -7227,7 +7362,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7227
7362
|
}
|
|
7228
7363
|
throw new Error("Too many consecutive failures");
|
|
7229
7364
|
}
|
|
7230
|
-
this.
|
|
7365
|
+
this.recreateAdController();
|
|
7231
7366
|
requestToken = ++this.adRequestTokenCounter;
|
|
7232
7367
|
this.activeAdRequestToken = requestToken;
|
|
7233
7368
|
this.startAdRequestWatchdog(requestToken);
|
|
@@ -7339,15 +7474,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7339
7474
|
9
|
|
7340
7475
|
];
|
|
7341
7476
|
case 9:
|
|
7342
|
-
if (
|
|
7343
|
-
this.
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7477
|
+
if (vastTagUrl) {
|
|
7478
|
+
if (this.isTemporaryAdError(playError)) {
|
|
7479
|
+
this.temporaryFailureUrls.set(vastTagUrl, Date.now());
|
|
7480
|
+
if (this.config.debugAdTiming) {
|
|
7481
|
+
console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
|
|
7482
|
+
}
|
|
7483
|
+
} else {
|
|
7484
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
7485
|
+
if (this.config.debugAdTiming) {
|
|
7486
|
+
console.log("[AD-ERROR] Permanent play error - URL blacklisted");
|
|
7487
|
+
}
|
|
7351
7488
|
}
|
|
7352
7489
|
}
|
|
7353
7490
|
this.clearAdFailsafeTimer();
|
|
@@ -7416,15 +7553,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7416
7553
|
15
|
|
7417
7554
|
];
|
|
7418
7555
|
case 15:
|
|
7419
|
-
if (
|
|
7420
|
-
this.
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7556
|
+
if (vastTagUrl) {
|
|
7557
|
+
if (this.isTemporaryAdError(error)) {
|
|
7558
|
+
this.temporaryFailureUrls.set(vastTagUrl, Date.now());
|
|
7559
|
+
if (this.config.debugAdTiming) {
|
|
7560
|
+
console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
|
|
7561
|
+
}
|
|
7562
|
+
} else {
|
|
7563
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
7564
|
+
if (this.config.debugAdTiming) {
|
|
7565
|
+
console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
|
|
7566
|
+
}
|
|
7428
7567
|
}
|
|
7429
7568
|
}
|
|
7430
7569
|
this.clearAdRequestWatchdog();
|
|
@@ -7468,6 +7607,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7468
7607
|
this.showAds = false;
|
|
7469
7608
|
this.currentAdIndex = 0;
|
|
7470
7609
|
this.totalAdsInBreak = 0;
|
|
7610
|
+
this.totalAdRequestsInBreak = 0;
|
|
7471
7611
|
this.consecutiveFailures = 0;
|
|
7472
7612
|
this.ima.stop().catch(function() {});
|
|
7473
7613
|
var restoredMuted = this.ima.getOriginalMutedState();
|
|
@@ -7479,17 +7619,15 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7479
7619
|
this.video.volume = restoredVolume;
|
|
7480
7620
|
}
|
|
7481
7621
|
if (this.shouldContinueLiveStreamDuringAds()) {
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
if (this.
|
|
7622
|
+
var _this_video_play;
|
|
7623
|
+
if (this.config.debugAdTiming) {
|
|
7624
|
+
if (this.video.paused) {
|
|
7485
7625
|
console.log("[StormcloudVideoPlayer] Content video paused in live mode after ads, resuming playback");
|
|
7486
|
-
}
|
|
7487
|
-
(_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
|
|
7488
|
-
} else {
|
|
7489
|
-
if (this.config.debugAdTiming) {
|
|
7626
|
+
} else {
|
|
7490
7627
|
console.log("[StormcloudVideoPlayer] Content video already playing in live mode after ads");
|
|
7491
7628
|
}
|
|
7492
7629
|
}
|
|
7630
|
+
(_this_video_play = this.video.play()) === null || _this_video_play === void 0 ? void 0 : _this_video_play.catch(function() {});
|
|
7493
7631
|
} else if (this.video.paused) {
|
|
7494
7632
|
var _this_video_play1;
|
|
7495
7633
|
(_this_video_play1 = this.video.play()) === null || _this_video_play1 === void 0 ? void 0 : _this_video_play1.catch(function() {});
|
|
@@ -7527,8 +7665,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7527
7665
|
key: "startAdRequestWatchdog",
|
|
7528
7666
|
value: function startAdRequestWatchdog(token) {
|
|
7529
7667
|
var _this = this;
|
|
7530
|
-
this.clearAdRequestWatchdog();
|
|
7531
7668
|
var _this_config_adFailsafeTimeoutMs;
|
|
7669
|
+
this.clearAdRequestWatchdog();
|
|
7532
7670
|
var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
|
|
7533
7671
|
this.adRequestWatchdogToken = token;
|
|
7534
7672
|
this.adRequestWatchdogId = window.setTimeout(function() {
|
|
@@ -7571,8 +7709,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7571
7709
|
key: "startAdFailsafeTimer",
|
|
7572
7710
|
value: function startAdFailsafeTimer(token) {
|
|
7573
7711
|
var _this = this;
|
|
7574
|
-
this.clearAdFailsafeTimer();
|
|
7575
7712
|
var _this_config_adFailsafeTimeoutMs;
|
|
7713
|
+
this.clearAdFailsafeTimer();
|
|
7576
7714
|
var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
|
|
7577
7715
|
this.adFailsafeToken = token;
|
|
7578
7716
|
this.adFailsafeTimerId = window.setTimeout(function() {
|
|
@@ -7892,11 +8030,11 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react2_Component) {
|
|
|
7892
8030
|
function HlsPlayer() {
|
|
7893
8031
|
_class_call_check(this, HlsPlayer);
|
|
7894
8032
|
var _this;
|
|
7895
|
-
var _this1
|
|
7896
|
-
_this = _call_super(this, HlsPlayer,
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
8033
|
+
var _this1;
|
|
8034
|
+
_this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
|
|
8035
|
+
_this.player = null;
|
|
8036
|
+
_this.mounted = false;
|
|
8037
|
+
_this.load = function() {
|
|
7900
8038
|
return _async_to_generator(function() {
|
|
7901
8039
|
var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
|
|
7902
8040
|
return _ts_generator(this, function(_state) {
|
|
@@ -7969,87 +8107,87 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react2_Component) {
|
|
|
7969
8107
|
});
|
|
7970
8108
|
})();
|
|
7971
8109
|
};
|
|
7972
|
-
|
|
7973
|
-
if (
|
|
7974
|
-
var video =
|
|
8110
|
+
_this.play = function() {
|
|
8111
|
+
if (_this.props.videoElement) {
|
|
8112
|
+
var video = _this.props.videoElement;
|
|
7975
8113
|
var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
|
|
7976
8114
|
if (hasValidSource) {
|
|
7977
8115
|
var _video_play, _this_props_onPlay, _this_props;
|
|
7978
8116
|
(_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
|
|
7979
8117
|
var _this_props_onError, _this_props;
|
|
7980
8118
|
console.error("[HlsPlayer] Failed to play:", error);
|
|
7981
|
-
(_this_props_onError = (_this_props =
|
|
8119
|
+
(_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
|
|
7982
8120
|
});
|
|
7983
|
-
(_this_props_onPlay = (_this_props =
|
|
8121
|
+
(_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
|
|
7984
8122
|
} else {
|
|
7985
8123
|
console.warn("[HlsPlayer] Cannot play: video has no valid source");
|
|
7986
8124
|
}
|
|
7987
8125
|
}
|
|
7988
8126
|
};
|
|
7989
|
-
|
|
7990
|
-
if (
|
|
8127
|
+
_this.pause = function() {
|
|
8128
|
+
if (_this.props.videoElement) {
|
|
7991
8129
|
var _this_props_onPause, _this_props;
|
|
7992
|
-
|
|
7993
|
-
(_this_props_onPause = (_this_props =
|
|
8130
|
+
_this.props.videoElement.pause();
|
|
8131
|
+
(_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
|
|
7994
8132
|
}
|
|
7995
8133
|
};
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
if (
|
|
7999
|
-
|
|
8134
|
+
_this.stop = function() {
|
|
8135
|
+
_this.pause();
|
|
8136
|
+
if (_this.props.videoElement) {
|
|
8137
|
+
_this.props.videoElement.currentTime = 0;
|
|
8000
8138
|
}
|
|
8001
8139
|
};
|
|
8002
|
-
|
|
8003
|
-
if (
|
|
8004
|
-
|
|
8140
|
+
_this.seekTo = function(seconds, keepPlaying) {
|
|
8141
|
+
if (_this.props.videoElement) {
|
|
8142
|
+
_this.props.videoElement.currentTime = seconds;
|
|
8005
8143
|
if (!keepPlaying) {
|
|
8006
|
-
|
|
8144
|
+
_this.pause();
|
|
8007
8145
|
}
|
|
8008
8146
|
}
|
|
8009
8147
|
};
|
|
8010
|
-
|
|
8011
|
-
if (
|
|
8012
|
-
|
|
8148
|
+
_this.setVolume = function(volume) {
|
|
8149
|
+
if (_this.props.videoElement) {
|
|
8150
|
+
_this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
|
|
8013
8151
|
}
|
|
8014
8152
|
};
|
|
8015
|
-
|
|
8016
|
-
if (
|
|
8017
|
-
|
|
8153
|
+
_this.mute = function() {
|
|
8154
|
+
if (_this.props.videoElement) {
|
|
8155
|
+
_this.props.videoElement.muted = true;
|
|
8018
8156
|
}
|
|
8019
8157
|
};
|
|
8020
|
-
|
|
8021
|
-
if (
|
|
8022
|
-
|
|
8158
|
+
_this.unmute = function() {
|
|
8159
|
+
if (_this.props.videoElement) {
|
|
8160
|
+
_this.props.videoElement.muted = false;
|
|
8023
8161
|
}
|
|
8024
8162
|
};
|
|
8025
|
-
|
|
8026
|
-
if (
|
|
8027
|
-
|
|
8163
|
+
_this.setPlaybackRate = function(rate) {
|
|
8164
|
+
if (_this.props.videoElement && rate > 0) {
|
|
8165
|
+
_this.props.videoElement.playbackRate = rate;
|
|
8028
8166
|
}
|
|
8029
8167
|
};
|
|
8030
|
-
|
|
8031
|
-
if (
|
|
8032
|
-
return
|
|
8168
|
+
_this.getDuration = function() {
|
|
8169
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
|
|
8170
|
+
return _this.props.videoElement.duration;
|
|
8033
8171
|
}
|
|
8034
8172
|
return null;
|
|
8035
8173
|
};
|
|
8036
|
-
|
|
8037
|
-
if (
|
|
8038
|
-
return
|
|
8174
|
+
_this.getCurrentTime = function() {
|
|
8175
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
|
|
8176
|
+
return _this.props.videoElement.currentTime;
|
|
8039
8177
|
}
|
|
8040
8178
|
return null;
|
|
8041
8179
|
};
|
|
8042
|
-
|
|
8043
|
-
if (
|
|
8044
|
-
return
|
|
8180
|
+
_this.getSecondsLoaded = function() {
|
|
8181
|
+
if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
|
|
8182
|
+
return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
|
|
8045
8183
|
}
|
|
8046
8184
|
return null;
|
|
8047
8185
|
};
|
|
8048
|
-
|
|
8186
|
+
_this.getInternalPlayer = function() {
|
|
8049
8187
|
var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
|
|
8050
|
-
if (key === "player") return
|
|
8051
|
-
if (key === "video") return
|
|
8052
|
-
if (key === "hls" &&
|
|
8188
|
+
if (key === "player") return _this.player;
|
|
8189
|
+
if (key === "video") return _this.props.videoElement;
|
|
8190
|
+
if (key === "hls" && _this.player) return _this.player.hls;
|
|
8053
8191
|
return null;
|
|
8054
8192
|
};
|
|
8055
8193
|
return _this;
|
|
@@ -8098,49 +8236,49 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
|
|
|
8098
8236
|
function FilePlayer() {
|
|
8099
8237
|
_class_call_check(this, FilePlayer);
|
|
8100
8238
|
var _this;
|
|
8101
|
-
var _this1
|
|
8102
|
-
_this = _call_super(this, FilePlayer,
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8239
|
+
var _this1;
|
|
8240
|
+
_this = _call_super(this, FilePlayer, arguments), _this1 = _this;
|
|
8241
|
+
_this.mounted = false;
|
|
8242
|
+
_this.ready = false;
|
|
8243
|
+
_this.load = function() {
|
|
8106
8244
|
var _this_props_onMount, _this_props;
|
|
8107
|
-
if (!
|
|
8108
|
-
var video =
|
|
8109
|
-
var handleLoadedMetadata = function() {
|
|
8110
|
-
if (
|
|
8245
|
+
if (!_this.props.videoElement || !_this.props.src) return;
|
|
8246
|
+
var video = _this.props.videoElement;
|
|
8247
|
+
var handleLoadedMetadata = function handleLoadedMetadata() {
|
|
8248
|
+
if (_this.mounted && !_this.ready) {
|
|
8111
8249
|
var _this_props_onReady, _this_props;
|
|
8112
|
-
|
|
8113
|
-
(_this_props_onReady = (_this_props =
|
|
8250
|
+
_this.ready = true;
|
|
8251
|
+
(_this_props_onReady = (_this_props = _this.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
|
|
8114
8252
|
}
|
|
8115
8253
|
};
|
|
8116
|
-
var handlePlay = function() {
|
|
8117
|
-
if (
|
|
8254
|
+
var handlePlay = function handlePlay() {
|
|
8255
|
+
if (_this.mounted) {
|
|
8118
8256
|
var _this_props_onPlay, _this_props;
|
|
8119
|
-
(_this_props_onPlay = (_this_props =
|
|
8257
|
+
(_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
|
|
8120
8258
|
}
|
|
8121
8259
|
};
|
|
8122
|
-
var handlePause = function() {
|
|
8123
|
-
if (
|
|
8260
|
+
var handlePause = function handlePause() {
|
|
8261
|
+
if (_this.mounted) {
|
|
8124
8262
|
var _this_props_onPause, _this_props;
|
|
8125
|
-
(_this_props_onPause = (_this_props =
|
|
8263
|
+
(_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
|
|
8126
8264
|
}
|
|
8127
8265
|
};
|
|
8128
|
-
var handleEnded = function() {
|
|
8129
|
-
if (
|
|
8266
|
+
var handleEnded = function handleEnded() {
|
|
8267
|
+
if (_this.mounted) {
|
|
8130
8268
|
var _this_props_onEnded, _this_props;
|
|
8131
|
-
(_this_props_onEnded = (_this_props =
|
|
8269
|
+
(_this_props_onEnded = (_this_props = _this.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
|
|
8132
8270
|
}
|
|
8133
8271
|
};
|
|
8134
|
-
var handleError = function(error) {
|
|
8135
|
-
if (
|
|
8272
|
+
var handleError = function handleError(error) {
|
|
8273
|
+
if (_this.mounted) {
|
|
8136
8274
|
var _this_props_onError, _this_props;
|
|
8137
|
-
(_this_props_onError = (_this_props =
|
|
8275
|
+
(_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
|
|
8138
8276
|
}
|
|
8139
8277
|
};
|
|
8140
|
-
var handleLoadedData = function() {
|
|
8141
|
-
if (
|
|
8278
|
+
var handleLoadedData = function handleLoadedData() {
|
|
8279
|
+
if (_this.mounted) {
|
|
8142
8280
|
var _this_props_onLoaded, _this_props;
|
|
8143
|
-
(_this_props_onLoaded = (_this_props =
|
|
8281
|
+
(_this_props_onLoaded = (_this_props = _this.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
|
|
8144
8282
|
}
|
|
8145
8283
|
};
|
|
8146
8284
|
video.addEventListener("loadedmetadata", handleLoadedMetadata);
|
|
@@ -8149,15 +8287,15 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
|
|
|
8149
8287
|
video.addEventListener("ended", handleEnded);
|
|
8150
8288
|
video.addEventListener("error", handleError);
|
|
8151
8289
|
video.addEventListener("loadeddata", handleLoadedData);
|
|
8152
|
-
video.src =
|
|
8153
|
-
if (
|
|
8154
|
-
if (
|
|
8155
|
-
if (
|
|
8156
|
-
if (
|
|
8157
|
-
if (
|
|
8158
|
-
if (
|
|
8159
|
-
if (
|
|
8160
|
-
(_this_props_onMount = (_this_props =
|
|
8290
|
+
video.src = _this.props.src;
|
|
8291
|
+
if (_this.props.autoplay !== void 0) video.autoplay = _this.props.autoplay;
|
|
8292
|
+
if (_this.props.muted !== void 0) video.muted = _this.props.muted;
|
|
8293
|
+
if (_this.props.loop !== void 0) video.loop = _this.props.loop;
|
|
8294
|
+
if (_this.props.controls !== void 0) video.controls = _this.props.controls;
|
|
8295
|
+
if (_this.props.playsInline !== void 0) video.playsInline = _this.props.playsInline;
|
|
8296
|
+
if (_this.props.preload !== void 0) video.preload = _this.props.preload;
|
|
8297
|
+
if (_this.props.poster !== void 0) video.poster = _this.props.poster;
|
|
8298
|
+
(_this_props_onMount = (_this_props = _this.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this);
|
|
8161
8299
|
return function() {
|
|
8162
8300
|
video.removeEventListener("loadedmetadata", handleLoadedMetadata);
|
|
8163
8301
|
video.removeEventListener("play", handlePlay);
|
|
@@ -8167,90 +8305,90 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
|
|
|
8167
8305
|
video.removeEventListener("loadeddata", handleLoadedData);
|
|
8168
8306
|
};
|
|
8169
8307
|
};
|
|
8170
|
-
|
|
8171
|
-
if (
|
|
8172
|
-
var video =
|
|
8308
|
+
_this.play = function() {
|
|
8309
|
+
if (_this.props.videoElement) {
|
|
8310
|
+
var video = _this.props.videoElement;
|
|
8173
8311
|
var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
|
|
8174
8312
|
if (hasValidSource) {
|
|
8175
8313
|
var _video_play;
|
|
8176
8314
|
(_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
|
|
8177
8315
|
var _this_props_onError, _this_props;
|
|
8178
8316
|
console.error("[FilePlayer] Failed to play:", error);
|
|
8179
|
-
(_this_props_onError = (_this_props =
|
|
8317
|
+
(_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
|
|
8180
8318
|
});
|
|
8181
8319
|
} else {
|
|
8182
8320
|
console.warn("[FilePlayer] Cannot play: video has no valid source");
|
|
8183
8321
|
}
|
|
8184
8322
|
}
|
|
8185
8323
|
};
|
|
8186
|
-
|
|
8187
|
-
if (
|
|
8188
|
-
|
|
8324
|
+
_this.pause = function() {
|
|
8325
|
+
if (_this.props.videoElement) {
|
|
8326
|
+
_this.props.videoElement.pause();
|
|
8189
8327
|
}
|
|
8190
8328
|
};
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
if (
|
|
8194
|
-
|
|
8329
|
+
_this.stop = function() {
|
|
8330
|
+
_this.pause();
|
|
8331
|
+
if (_this.props.videoElement) {
|
|
8332
|
+
_this.props.videoElement.currentTime = 0;
|
|
8195
8333
|
}
|
|
8196
8334
|
};
|
|
8197
|
-
|
|
8198
|
-
if (
|
|
8199
|
-
|
|
8335
|
+
_this.seekTo = function(seconds, keepPlaying) {
|
|
8336
|
+
if (_this.props.videoElement) {
|
|
8337
|
+
_this.props.videoElement.currentTime = seconds;
|
|
8200
8338
|
if (!keepPlaying) {
|
|
8201
|
-
|
|
8339
|
+
_this.pause();
|
|
8202
8340
|
}
|
|
8203
8341
|
}
|
|
8204
8342
|
};
|
|
8205
|
-
|
|
8206
|
-
if (
|
|
8207
|
-
|
|
8343
|
+
_this.setVolume = function(volume) {
|
|
8344
|
+
if (_this.props.videoElement) {
|
|
8345
|
+
_this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
|
|
8208
8346
|
}
|
|
8209
8347
|
};
|
|
8210
|
-
|
|
8211
|
-
if (
|
|
8212
|
-
|
|
8348
|
+
_this.mute = function() {
|
|
8349
|
+
if (_this.props.videoElement) {
|
|
8350
|
+
_this.props.videoElement.muted = true;
|
|
8213
8351
|
}
|
|
8214
8352
|
};
|
|
8215
|
-
|
|
8216
|
-
if (
|
|
8217
|
-
|
|
8353
|
+
_this.unmute = function() {
|
|
8354
|
+
if (_this.props.videoElement) {
|
|
8355
|
+
_this.props.videoElement.muted = false;
|
|
8218
8356
|
}
|
|
8219
8357
|
};
|
|
8220
|
-
|
|
8221
|
-
if (
|
|
8222
|
-
|
|
8358
|
+
_this.setPlaybackRate = function(rate) {
|
|
8359
|
+
if (_this.props.videoElement && rate > 0) {
|
|
8360
|
+
_this.props.videoElement.playbackRate = rate;
|
|
8223
8361
|
}
|
|
8224
8362
|
};
|
|
8225
|
-
|
|
8226
|
-
if (
|
|
8227
|
-
|
|
8363
|
+
_this.setLoop = function(loop) {
|
|
8364
|
+
if (_this.props.videoElement) {
|
|
8365
|
+
_this.props.videoElement.loop = loop;
|
|
8228
8366
|
}
|
|
8229
8367
|
};
|
|
8230
|
-
|
|
8231
|
-
if (
|
|
8232
|
-
return
|
|
8368
|
+
_this.getDuration = function() {
|
|
8369
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
|
|
8370
|
+
return _this.props.videoElement.duration;
|
|
8233
8371
|
}
|
|
8234
8372
|
return null;
|
|
8235
8373
|
};
|
|
8236
|
-
|
|
8237
|
-
if (
|
|
8238
|
-
return
|
|
8374
|
+
_this.getCurrentTime = function() {
|
|
8375
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
|
|
8376
|
+
return _this.props.videoElement.currentTime;
|
|
8239
8377
|
}
|
|
8240
8378
|
return null;
|
|
8241
8379
|
};
|
|
8242
|
-
|
|
8243
|
-
if (
|
|
8244
|
-
return
|
|
8380
|
+
_this.getSecondsLoaded = function() {
|
|
8381
|
+
if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
|
|
8382
|
+
return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
|
|
8245
8383
|
}
|
|
8246
8384
|
return null;
|
|
8247
8385
|
};
|
|
8248
|
-
|
|
8386
|
+
_this.getInternalPlayer = function() {
|
|
8249
8387
|
var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
|
|
8250
|
-
if (key === "video") return
|
|
8388
|
+
if (key === "video") return _this.props.videoElement;
|
|
8251
8389
|
return null;
|
|
8252
8390
|
};
|
|
8253
|
-
|
|
8391
|
+
_this.enablePIP = function() {
|
|
8254
8392
|
return _async_to_generator(function() {
|
|
8255
8393
|
var error;
|
|
8256
8394
|
return _ts_generator(this, function(_state) {
|
|
@@ -8293,7 +8431,7 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
|
|
|
8293
8431
|
});
|
|
8294
8432
|
})();
|
|
8295
8433
|
};
|
|
8296
|
-
|
|
8434
|
+
_this.disablePIP = function() {
|
|
8297
8435
|
return _async_to_generator(function() {
|
|
8298
8436
|
var error;
|
|
8299
8437
|
return _ts_generator(this, function(_state) {
|
|
@@ -8387,7 +8525,7 @@ var players = [
|
|
|
8387
8525
|
key: "file",
|
|
8388
8526
|
name: "File Player",
|
|
8389
8527
|
canPlay: canPlay.file,
|
|
8390
|
-
canEnablePIP: function(url) {
|
|
8528
|
+
canEnablePIP: function canEnablePIP(url) {
|
|
8391
8529
|
return canPlay.file(url) && (document.pictureInPictureEnabled || typeof document.webkitSupportsPresentationMode === "function");
|
|
8392
8530
|
},
|
|
8393
8531
|
lazyPlayer: lazy(function() {
|