stormcloud-video-player 0.5.3 → 0.5.4
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 +348 -330
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +348 -220
- package/lib/index.d.ts +348 -220
- package/lib/index.js +307 -289
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +77 -68
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/FilePlayer.cjs +99 -116
- package/lib/players/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +129 -120
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +208 -199
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +17 -9
- 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 +20 -10
- 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 +168 -150
- 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() {
|
|
@@ -2514,8 +2522,8 @@ var DEFAULT_TIMEOUT_MS = 3e3;
|
|
|
2514
2522
|
var AUCTION_URL = "https://sspproxy.adstorm.co/openrtb2/auction/adstorm";
|
|
2515
2523
|
function createPrebidManager() {
|
|
2516
2524
|
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2517
|
-
var initialized = false;
|
|
2518
2525
|
var _options_debug;
|
|
2526
|
+
var initialized = false;
|
|
2519
2527
|
var debug = (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : false;
|
|
2520
2528
|
function log() {
|
|
2521
2529
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -3017,6 +3025,8 @@ function createPrebidController(contentVideo, options) {
|
|
|
3017
3025
|
adContainerEl.style.display = "none";
|
|
3018
3026
|
adContainerEl.style.pointerEvents = "none";
|
|
3019
3027
|
}
|
|
3028
|
+
contentVideo.style.visibility = "visible";
|
|
3029
|
+
contentVideo.style.opacity = "1";
|
|
3020
3030
|
if (options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds) {
|
|
3021
3031
|
if (contentVideo.paused) {
|
|
3022
3032
|
console.log("".concat(LOG, " Content video paused in live mode, resuming playback"));
|
|
@@ -4325,7 +4335,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4325
4335
|
});
|
|
4326
4336
|
this.hls.on(import_hls3.default.Events.MANIFEST_PARSED, function(_, data) {
|
|
4327
4337
|
return _async_to_generator(function() {
|
|
4328
|
-
var
|
|
4338
|
+
var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
|
|
4329
4339
|
return _ts_generator(this, function(_state) {
|
|
4330
4340
|
switch(_state.label){
|
|
4331
4341
|
case 0:
|
|
@@ -4334,10 +4344,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4334
4344
|
} else {
|
|
4335
4345
|
;
|
|
4336
4346
|
;
|
|
4337
|
-
this.isLiveStream = (
|
|
4347
|
+
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
4348
|
var _level_details, _level_details1;
|
|
4339
4349
|
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 &&
|
|
4350
|
+
})) !== null && _ref !== void 0 ? _ref : false;
|
|
4341
4351
|
}
|
|
4342
4352
|
if (this.config.debugAdTiming) {
|
|
4343
4353
|
adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
|
|
@@ -4401,9 +4411,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4401
4411
|
var tag = "";
|
|
4402
4412
|
var value = "";
|
|
4403
4413
|
if (Array.isArray(entry)) {
|
|
4404
|
-
var _entry_;
|
|
4414
|
+
var _entry_, _entry_1;
|
|
4405
4415
|
tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
|
|
4406
|
-
var _entry_1;
|
|
4407
4416
|
value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
|
|
4408
4417
|
} else if (typeof entry === "string") {
|
|
4409
4418
|
var idx = entry.indexOf(":");
|
|
@@ -4526,9 +4535,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4526
4535
|
var tag = "";
|
|
4527
4536
|
var value = "";
|
|
4528
4537
|
if (Array.isArray(entry)) {
|
|
4529
|
-
var _entry_;
|
|
4538
|
+
var _entry_, _entry_1;
|
|
4530
4539
|
tag = String((_entry_ = entry[0]) !== null && _entry_ !== void 0 ? _entry_ : "");
|
|
4531
|
-
var _entry_1;
|
|
4532
4540
|
value = String((_entry_1 = entry[1]) !== null && _entry_1 !== void 0 ? _entry_1 : "");
|
|
4533
4541
|
} else if (typeof entry === "string") {
|
|
4534
4542
|
var idx = entry.indexOf(":");
|
|
@@ -4578,10 +4586,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4578
4586
|
}
|
|
4579
4587
|
});
|
|
4580
4588
|
} else if (tag.includes("EXT-X-DATERANGE")) {
|
|
4589
|
+
var _attrs_CLASS;
|
|
4581
4590
|
var attrs = _this.parseAttributeList(value);
|
|
4582
4591
|
var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
|
|
4583
4592
|
var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
|
|
4584
|
-
var _attrs_CLASS;
|
|
4585
4593
|
var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
|
|
4586
4594
|
var duration = _this.toNumber(attrs["DURATION"]);
|
|
4587
4595
|
if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
|
|
@@ -4983,11 +4991,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4983
4991
|
}
|
|
4984
4992
|
var daterangeMatch = text.match(/EXT-X-DATERANGE:([^\r\n]*)/i);
|
|
4985
4993
|
if (daterangeMatch) {
|
|
4986
|
-
var _daterangeMatch_;
|
|
4994
|
+
var _daterangeMatch_, _attrs_CLASS;
|
|
4987
4995
|
var attrs = this.parseAttributeList((_daterangeMatch_ = daterangeMatch[1]) !== null && _daterangeMatch_ !== void 0 ? _daterangeMatch_ : "");
|
|
4988
4996
|
var hasScteOut = "SCTE35-OUT" in attrs || attrs["SCTE35-OUT"] !== void 0;
|
|
4989
4997
|
var hasScteIn = "SCTE35-IN" in attrs || attrs["SCTE35-IN"] !== void 0;
|
|
4990
|
-
var _attrs_CLASS;
|
|
4991
4998
|
var klass = String((_attrs_CLASS = attrs["CLASS"]) !== null && _attrs_CLASS !== void 0 ? _attrs_CLASS : "");
|
|
4992
4999
|
var duration = this.toNumber(attrs["DURATION"]);
|
|
4993
5000
|
if (hasScteOut || /com\.apple\.hls\.cue/i.test(klass)) {
|
|
@@ -5063,7 +5070,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5063
5070
|
var out = "";
|
|
5064
5071
|
for(var i = 0; i < value.length; i++)out += String.fromCharCode(value[i]);
|
|
5065
5072
|
return out;
|
|
5066
|
-
} catch (
|
|
5073
|
+
} catch (unused) {
|
|
5067
5074
|
return void 0;
|
|
5068
5075
|
}
|
|
5069
5076
|
}
|
|
@@ -5082,6 +5089,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5082
5089
|
});
|
|
5083
5090
|
}
|
|
5084
5091
|
if (marker.type === "start") {
|
|
5092
|
+
var _this_config_immediateManifestAds;
|
|
5085
5093
|
var _this_pendingAdBreak;
|
|
5086
5094
|
if (!this.video.muted) {
|
|
5087
5095
|
this.video.muted = true;
|
|
@@ -5106,7 +5114,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5106
5114
|
this.expectedAdBreakDurationMs = durationMs;
|
|
5107
5115
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
5108
5116
|
var isManifestMarker = this.isManifestBasedMarker(marker);
|
|
5109
|
-
var _this_config_immediateManifestAds;
|
|
5110
5117
|
var forceImmediate = (_this_config_immediateManifestAds = this.config.immediateManifestAds) !== null && _this_config_immediateManifestAds !== void 0 ? _this_config_immediateManifestAds : true;
|
|
5111
5118
|
if (this.config.debugAdTiming) {
|
|
5112
5119
|
console.log("[StormcloudVideoPlayer] Ad start decision:", {
|
|
@@ -5261,9 +5268,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5261
5268
|
var regex = /([A-Z0-9-]+)=(("[^"]*")|([^",]*))(?:,|$)/gi;
|
|
5262
5269
|
var match;
|
|
5263
5270
|
while((match = regex.exec(value)) !== null){
|
|
5264
|
-
var _match_;
|
|
5271
|
+
var _match_, _ref, _match_1;
|
|
5265
5272
|
var key = (_match_ = match[1]) !== null && _match_ !== void 0 ? _match_ : "";
|
|
5266
|
-
var _match_1, _ref;
|
|
5267
5273
|
var rawVal = (_ref = (_match_1 = match[3]) !== null && _match_1 !== void 0 ? _match_1 : match[4]) !== null && _ref !== void 0 ? _ref : "";
|
|
5268
5274
|
if (rawVal.startsWith('"') && rawVal.endsWith('"')) {
|
|
5269
5275
|
rawVal = rawVal.slice(1, -1);
|
|
@@ -5622,13 +5628,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5622
5628
|
{
|
|
5623
5629
|
key: "shouldShowNativeControls",
|
|
5624
5630
|
value: function shouldShowNativeControls() {
|
|
5631
|
+
var _this_config_showCustomControls;
|
|
5625
5632
|
var streamType = this.getStreamType();
|
|
5626
5633
|
if (streamType === "other") {
|
|
5627
|
-
var
|
|
5628
|
-
return !((
|
|
5634
|
+
var _this_config_showCustomControls1;
|
|
5635
|
+
return !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false);
|
|
5629
5636
|
}
|
|
5630
|
-
|
|
5631
|
-
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls1 = this.config.showCustomControls) !== null && _this_config_showCustomControls1 !== void 0 ? _this_config_showCustomControls1 : false));
|
|
5637
|
+
return !!(this.config.allowNativeHls && !((_this_config_showCustomControls = this.config.showCustomControls) !== null && _this_config_showCustomControls !== void 0 ? _this_config_showCustomControls : false));
|
|
5632
5638
|
}
|
|
5633
5639
|
},
|
|
5634
5640
|
{
|
|
@@ -5787,12 +5793,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5787
5793
|
continueLiveStreamDuringAds = this.shouldContinueLiveStreamDuringAds();
|
|
5788
5794
|
preloadIma = this.createAdPlayer(continueLiveStreamDuringAds);
|
|
5789
5795
|
preloadIma.initialize();
|
|
5790
|
-
errorListener = function(payload) {
|
|
5796
|
+
errorListener = function errorListener(payload) {
|
|
5791
5797
|
hasAdError = true;
|
|
5792
5798
|
adErrorPayload = payload;
|
|
5793
5799
|
};
|
|
5794
5800
|
preloadIma.on("ad_error", errorListener);
|
|
5795
|
-
errorListenerCleanup = function() {
|
|
5801
|
+
errorListenerCleanup = function errorListenerCleanup() {
|
|
5796
5802
|
return preloadIma.off("ad_error", errorListener);
|
|
5797
5803
|
};
|
|
5798
5804
|
return [
|
|
@@ -5843,7 +5849,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5843
5849
|
isReady: true,
|
|
5844
5850
|
loadPromise: Promise.resolve()
|
|
5845
5851
|
};
|
|
5846
|
-
lateErrorListener = function(payload) {
|
|
5852
|
+
lateErrorListener = function lateErrorListener(payload) {
|
|
5847
5853
|
var index = _this.preloadPool.findIndex(function(entry) {
|
|
5848
5854
|
return entry.vastUrl === vastUrl;
|
|
5849
5855
|
});
|
|
@@ -5854,7 +5860,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5854
5860
|
}
|
|
5855
5861
|
try {
|
|
5856
5862
|
preloadIma.destroy();
|
|
5857
|
-
} catch (
|
|
5863
|
+
} catch (unused) {}
|
|
5858
5864
|
}
|
|
5859
5865
|
};
|
|
5860
5866
|
preloadIma.on("ad_error", lateErrorListener);
|
|
@@ -6679,7 +6685,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6679
6685
|
10
|
|
6680
6686
|
];
|
|
6681
6687
|
nextAdUrl = this.adRequestQueue.shift();
|
|
6682
|
-
if (
|
|
6688
|
+
if (nextAdUrl == null) {
|
|
6683
6689
|
return [
|
|
6684
6690
|
3,
|
|
6685
6691
|
4
|
|
@@ -6865,7 +6871,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
6865
6871
|
9
|
|
6866
6872
|
];
|
|
6867
6873
|
nextAdUrl = this.adRequestQueue.shift();
|
|
6868
|
-
if (
|
|
6874
|
+
if (nextAdUrl == null) {
|
|
6869
6875
|
return [
|
|
6870
6876
|
3,
|
|
6871
6877
|
3
|
|
@@ -7070,11 +7076,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7070
7076
|
{
|
|
7071
7077
|
key: "ensureAdStoppedByTimer",
|
|
7072
7078
|
value: function ensureAdStoppedByTimer() {
|
|
7079
|
+
var _this_config_adBreakCheckIntervalMs, _this_expectedAdBreakDurationMs;
|
|
7073
7080
|
if (!this.inAdBreak) return;
|
|
7074
7081
|
this.adStopTimerId = void 0;
|
|
7075
7082
|
var adPlaying = this.ima.isAdPlaying();
|
|
7076
7083
|
var pendingAds = this.adPodQueue.length > 0;
|
|
7077
|
-
var _this_config_adBreakCheckIntervalMs;
|
|
7078
7084
|
var checkIntervalMs = Math.max(250, Math.floor((_this_config_adBreakCheckIntervalMs = this.config.adBreakCheckIntervalMs) !== null && _this_config_adBreakCheckIntervalMs !== void 0 ? _this_config_adBreakCheckIntervalMs : 1e3));
|
|
7079
7085
|
var maxExtensionMsConfig = this.config.maxAdBreakExtensionMs;
|
|
7080
7086
|
var maxExtensionMs = typeof maxExtensionMsConfig === "number" && maxExtensionMsConfig > 0 ? maxExtensionMsConfig : 6e4;
|
|
@@ -7082,7 +7088,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7082
7088
|
if (this.currentAdBreakStartWallClockMs != null) {
|
|
7083
7089
|
elapsedSinceStartMs = Date.now() - this.currentAdBreakStartWallClockMs;
|
|
7084
7090
|
}
|
|
7085
|
-
var _this_expectedAdBreakDurationMs;
|
|
7086
7091
|
var expectedDurationMs = (_this_expectedAdBreakDurationMs = this.expectedAdBreakDurationMs) !== null && _this_expectedAdBreakDurationMs !== void 0 ? _this_expectedAdBreakDurationMs : 0;
|
|
7087
7092
|
var overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
|
|
7088
7093
|
var shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
|
|
@@ -7339,15 +7344,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7339
7344
|
9
|
|
7340
7345
|
];
|
|
7341
7346
|
case 9:
|
|
7342
|
-
if (
|
|
7343
|
-
this.
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7347
|
+
if (vastTagUrl) {
|
|
7348
|
+
if (this.isTemporaryAdError(playError)) {
|
|
7349
|
+
this.temporaryFailureUrls.set(vastTagUrl, Date.now());
|
|
7350
|
+
if (this.config.debugAdTiming) {
|
|
7351
|
+
console.log("[AD-ERROR] Temporary play error - URL can be retried after cooldown");
|
|
7352
|
+
}
|
|
7353
|
+
} else {
|
|
7354
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
7355
|
+
if (this.config.debugAdTiming) {
|
|
7356
|
+
console.log("[AD-ERROR] Permanent play error - URL blacklisted");
|
|
7357
|
+
}
|
|
7351
7358
|
}
|
|
7352
7359
|
}
|
|
7353
7360
|
this.clearAdFailsafeTimer();
|
|
@@ -7416,15 +7423,17 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7416
7423
|
15
|
|
7417
7424
|
];
|
|
7418
7425
|
case 15:
|
|
7419
|
-
if (
|
|
7420
|
-
this.
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7426
|
+
if (vastTagUrl) {
|
|
7427
|
+
if (this.isTemporaryAdError(error)) {
|
|
7428
|
+
this.temporaryFailureUrls.set(vastTagUrl, Date.now());
|
|
7429
|
+
if (this.config.debugAdTiming) {
|
|
7430
|
+
console.log("[AD-ERROR] Temporary error (no-fill/timeout) - URL can be retried after cooldown");
|
|
7431
|
+
}
|
|
7432
|
+
} else {
|
|
7433
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
7434
|
+
if (this.config.debugAdTiming) {
|
|
7435
|
+
console.log("[AD-ERROR] Permanent error - URL blacklisted:", errorMessage);
|
|
7436
|
+
}
|
|
7428
7437
|
}
|
|
7429
7438
|
}
|
|
7430
7439
|
this.clearAdRequestWatchdog();
|
|
@@ -7527,8 +7536,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7527
7536
|
key: "startAdRequestWatchdog",
|
|
7528
7537
|
value: function startAdRequestWatchdog(token) {
|
|
7529
7538
|
var _this = this;
|
|
7530
|
-
this.clearAdRequestWatchdog();
|
|
7531
7539
|
var _this_config_adFailsafeTimeoutMs;
|
|
7540
|
+
this.clearAdRequestWatchdog();
|
|
7532
7541
|
var timeoutMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
|
|
7533
7542
|
this.adRequestWatchdogToken = token;
|
|
7534
7543
|
this.adRequestWatchdogId = window.setTimeout(function() {
|
|
@@ -7571,8 +7580,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7571
7580
|
key: "startAdFailsafeTimer",
|
|
7572
7581
|
value: function startAdFailsafeTimer(token) {
|
|
7573
7582
|
var _this = this;
|
|
7574
|
-
this.clearAdFailsafeTimer();
|
|
7575
7583
|
var _this_config_adFailsafeTimeoutMs;
|
|
7584
|
+
this.clearAdFailsafeTimer();
|
|
7576
7585
|
var failsafeMs = (_this_config_adFailsafeTimeoutMs = this.config.adFailsafeTimeoutMs) !== null && _this_config_adFailsafeTimeoutMs !== void 0 ? _this_config_adFailsafeTimeoutMs : 1e4;
|
|
7577
7586
|
this.adFailsafeToken = token;
|
|
7578
7587
|
this.adFailsafeTimerId = window.setTimeout(function() {
|
|
@@ -7892,11 +7901,11 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react2_Component) {
|
|
|
7892
7901
|
function HlsPlayer() {
|
|
7893
7902
|
_class_call_check(this, HlsPlayer);
|
|
7894
7903
|
var _this;
|
|
7895
|
-
var _this1
|
|
7896
|
-
_this = _call_super(this, HlsPlayer,
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7904
|
+
var _this1;
|
|
7905
|
+
_this = _call_super(this, HlsPlayer, arguments), _this1 = _this;
|
|
7906
|
+
_this.player = null;
|
|
7907
|
+
_this.mounted = false;
|
|
7908
|
+
_this.load = function() {
|
|
7900
7909
|
return _async_to_generator(function() {
|
|
7901
7910
|
var _this_props_onMount, _this_props, config, _this_props_onReady, _this_props1, error, _this_props_onError, _this_props2;
|
|
7902
7911
|
return _ts_generator(this, function(_state) {
|
|
@@ -7969,87 +7978,87 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react2_Component) {
|
|
|
7969
7978
|
});
|
|
7970
7979
|
})();
|
|
7971
7980
|
};
|
|
7972
|
-
|
|
7973
|
-
if (
|
|
7974
|
-
var video =
|
|
7981
|
+
_this.play = function() {
|
|
7982
|
+
if (_this.props.videoElement) {
|
|
7983
|
+
var video = _this.props.videoElement;
|
|
7975
7984
|
var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
|
|
7976
7985
|
if (hasValidSource) {
|
|
7977
7986
|
var _video_play, _this_props_onPlay, _this_props;
|
|
7978
7987
|
(_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
|
|
7979
7988
|
var _this_props_onError, _this_props;
|
|
7980
7989
|
console.error("[HlsPlayer] Failed to play:", error);
|
|
7981
|
-
(_this_props_onError = (_this_props =
|
|
7990
|
+
(_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
|
|
7982
7991
|
});
|
|
7983
|
-
(_this_props_onPlay = (_this_props =
|
|
7992
|
+
(_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
|
|
7984
7993
|
} else {
|
|
7985
7994
|
console.warn("[HlsPlayer] Cannot play: video has no valid source");
|
|
7986
7995
|
}
|
|
7987
7996
|
}
|
|
7988
7997
|
};
|
|
7989
|
-
|
|
7990
|
-
if (
|
|
7998
|
+
_this.pause = function() {
|
|
7999
|
+
if (_this.props.videoElement) {
|
|
7991
8000
|
var _this_props_onPause, _this_props;
|
|
7992
|
-
|
|
7993
|
-
(_this_props_onPause = (_this_props =
|
|
8001
|
+
_this.props.videoElement.pause();
|
|
8002
|
+
(_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
|
|
7994
8003
|
}
|
|
7995
8004
|
};
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
if (
|
|
7999
|
-
|
|
8005
|
+
_this.stop = function() {
|
|
8006
|
+
_this.pause();
|
|
8007
|
+
if (_this.props.videoElement) {
|
|
8008
|
+
_this.props.videoElement.currentTime = 0;
|
|
8000
8009
|
}
|
|
8001
8010
|
};
|
|
8002
|
-
|
|
8003
|
-
if (
|
|
8004
|
-
|
|
8011
|
+
_this.seekTo = function(seconds, keepPlaying) {
|
|
8012
|
+
if (_this.props.videoElement) {
|
|
8013
|
+
_this.props.videoElement.currentTime = seconds;
|
|
8005
8014
|
if (!keepPlaying) {
|
|
8006
|
-
|
|
8015
|
+
_this.pause();
|
|
8007
8016
|
}
|
|
8008
8017
|
}
|
|
8009
8018
|
};
|
|
8010
|
-
|
|
8011
|
-
if (
|
|
8012
|
-
|
|
8019
|
+
_this.setVolume = function(volume) {
|
|
8020
|
+
if (_this.props.videoElement) {
|
|
8021
|
+
_this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
|
|
8013
8022
|
}
|
|
8014
8023
|
};
|
|
8015
|
-
|
|
8016
|
-
if (
|
|
8017
|
-
|
|
8024
|
+
_this.mute = function() {
|
|
8025
|
+
if (_this.props.videoElement) {
|
|
8026
|
+
_this.props.videoElement.muted = true;
|
|
8018
8027
|
}
|
|
8019
8028
|
};
|
|
8020
|
-
|
|
8021
|
-
if (
|
|
8022
|
-
|
|
8029
|
+
_this.unmute = function() {
|
|
8030
|
+
if (_this.props.videoElement) {
|
|
8031
|
+
_this.props.videoElement.muted = false;
|
|
8023
8032
|
}
|
|
8024
8033
|
};
|
|
8025
|
-
|
|
8026
|
-
if (
|
|
8027
|
-
|
|
8034
|
+
_this.setPlaybackRate = function(rate) {
|
|
8035
|
+
if (_this.props.videoElement && rate > 0) {
|
|
8036
|
+
_this.props.videoElement.playbackRate = rate;
|
|
8028
8037
|
}
|
|
8029
8038
|
};
|
|
8030
|
-
|
|
8031
|
-
if (
|
|
8032
|
-
return
|
|
8039
|
+
_this.getDuration = function() {
|
|
8040
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
|
|
8041
|
+
return _this.props.videoElement.duration;
|
|
8033
8042
|
}
|
|
8034
8043
|
return null;
|
|
8035
8044
|
};
|
|
8036
|
-
|
|
8037
|
-
if (
|
|
8038
|
-
return
|
|
8045
|
+
_this.getCurrentTime = function() {
|
|
8046
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
|
|
8047
|
+
return _this.props.videoElement.currentTime;
|
|
8039
8048
|
}
|
|
8040
8049
|
return null;
|
|
8041
8050
|
};
|
|
8042
|
-
|
|
8043
|
-
if (
|
|
8044
|
-
return
|
|
8051
|
+
_this.getSecondsLoaded = function() {
|
|
8052
|
+
if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
|
|
8053
|
+
return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
|
|
8045
8054
|
}
|
|
8046
8055
|
return null;
|
|
8047
8056
|
};
|
|
8048
|
-
|
|
8057
|
+
_this.getInternalPlayer = function() {
|
|
8049
8058
|
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" &&
|
|
8059
|
+
if (key === "player") return _this.player;
|
|
8060
|
+
if (key === "video") return _this.props.videoElement;
|
|
8061
|
+
if (key === "hls" && _this.player) return _this.player.hls;
|
|
8053
8062
|
return null;
|
|
8054
8063
|
};
|
|
8055
8064
|
return _this;
|
|
@@ -8098,49 +8107,49 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
|
|
|
8098
8107
|
function FilePlayer() {
|
|
8099
8108
|
_class_call_check(this, FilePlayer);
|
|
8100
8109
|
var _this;
|
|
8101
|
-
var _this1
|
|
8102
|
-
_this = _call_super(this, FilePlayer,
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8110
|
+
var _this1;
|
|
8111
|
+
_this = _call_super(this, FilePlayer, arguments), _this1 = _this;
|
|
8112
|
+
_this.mounted = false;
|
|
8113
|
+
_this.ready = false;
|
|
8114
|
+
_this.load = function() {
|
|
8106
8115
|
var _this_props_onMount, _this_props;
|
|
8107
|
-
if (!
|
|
8108
|
-
var video =
|
|
8109
|
-
var handleLoadedMetadata = function() {
|
|
8110
|
-
if (
|
|
8116
|
+
if (!_this.props.videoElement || !_this.props.src) return;
|
|
8117
|
+
var video = _this.props.videoElement;
|
|
8118
|
+
var handleLoadedMetadata = function handleLoadedMetadata() {
|
|
8119
|
+
if (_this.mounted && !_this.ready) {
|
|
8111
8120
|
var _this_props_onReady, _this_props;
|
|
8112
|
-
|
|
8113
|
-
(_this_props_onReady = (_this_props =
|
|
8121
|
+
_this.ready = true;
|
|
8122
|
+
(_this_props_onReady = (_this_props = _this.props).onReady) === null || _this_props_onReady === void 0 ? void 0 : _this_props_onReady.call(_this_props);
|
|
8114
8123
|
}
|
|
8115
8124
|
};
|
|
8116
|
-
var handlePlay = function() {
|
|
8117
|
-
if (
|
|
8125
|
+
var handlePlay = function handlePlay() {
|
|
8126
|
+
if (_this.mounted) {
|
|
8118
8127
|
var _this_props_onPlay, _this_props;
|
|
8119
|
-
(_this_props_onPlay = (_this_props =
|
|
8128
|
+
(_this_props_onPlay = (_this_props = _this.props).onPlay) === null || _this_props_onPlay === void 0 ? void 0 : _this_props_onPlay.call(_this_props);
|
|
8120
8129
|
}
|
|
8121
8130
|
};
|
|
8122
|
-
var handlePause = function() {
|
|
8123
|
-
if (
|
|
8131
|
+
var handlePause = function handlePause() {
|
|
8132
|
+
if (_this.mounted) {
|
|
8124
8133
|
var _this_props_onPause, _this_props;
|
|
8125
|
-
(_this_props_onPause = (_this_props =
|
|
8134
|
+
(_this_props_onPause = (_this_props = _this.props).onPause) === null || _this_props_onPause === void 0 ? void 0 : _this_props_onPause.call(_this_props);
|
|
8126
8135
|
}
|
|
8127
8136
|
};
|
|
8128
|
-
var handleEnded = function() {
|
|
8129
|
-
if (
|
|
8137
|
+
var handleEnded = function handleEnded() {
|
|
8138
|
+
if (_this.mounted) {
|
|
8130
8139
|
var _this_props_onEnded, _this_props;
|
|
8131
|
-
(_this_props_onEnded = (_this_props =
|
|
8140
|
+
(_this_props_onEnded = (_this_props = _this.props).onEnded) === null || _this_props_onEnded === void 0 ? void 0 : _this_props_onEnded.call(_this_props);
|
|
8132
8141
|
}
|
|
8133
8142
|
};
|
|
8134
|
-
var handleError = function(error) {
|
|
8135
|
-
if (
|
|
8143
|
+
var handleError = function handleError(error) {
|
|
8144
|
+
if (_this.mounted) {
|
|
8136
8145
|
var _this_props_onError, _this_props;
|
|
8137
|
-
(_this_props_onError = (_this_props =
|
|
8146
|
+
(_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
|
|
8138
8147
|
}
|
|
8139
8148
|
};
|
|
8140
|
-
var handleLoadedData = function() {
|
|
8141
|
-
if (
|
|
8149
|
+
var handleLoadedData = function handleLoadedData() {
|
|
8150
|
+
if (_this.mounted) {
|
|
8142
8151
|
var _this_props_onLoaded, _this_props;
|
|
8143
|
-
(_this_props_onLoaded = (_this_props =
|
|
8152
|
+
(_this_props_onLoaded = (_this_props = _this.props).onLoaded) === null || _this_props_onLoaded === void 0 ? void 0 : _this_props_onLoaded.call(_this_props);
|
|
8144
8153
|
}
|
|
8145
8154
|
};
|
|
8146
8155
|
video.addEventListener("loadedmetadata", handleLoadedMetadata);
|
|
@@ -8149,15 +8158,15 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
|
|
|
8149
8158
|
video.addEventListener("ended", handleEnded);
|
|
8150
8159
|
video.addEventListener("error", handleError);
|
|
8151
8160
|
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 =
|
|
8161
|
+
video.src = _this.props.src;
|
|
8162
|
+
if (_this.props.autoplay !== void 0) video.autoplay = _this.props.autoplay;
|
|
8163
|
+
if (_this.props.muted !== void 0) video.muted = _this.props.muted;
|
|
8164
|
+
if (_this.props.loop !== void 0) video.loop = _this.props.loop;
|
|
8165
|
+
if (_this.props.controls !== void 0) video.controls = _this.props.controls;
|
|
8166
|
+
if (_this.props.playsInline !== void 0) video.playsInline = _this.props.playsInline;
|
|
8167
|
+
if (_this.props.preload !== void 0) video.preload = _this.props.preload;
|
|
8168
|
+
if (_this.props.poster !== void 0) video.poster = _this.props.poster;
|
|
8169
|
+
(_this_props_onMount = (_this_props = _this.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this);
|
|
8161
8170
|
return function() {
|
|
8162
8171
|
video.removeEventListener("loadedmetadata", handleLoadedMetadata);
|
|
8163
8172
|
video.removeEventListener("play", handlePlay);
|
|
@@ -8167,90 +8176,90 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
|
|
|
8167
8176
|
video.removeEventListener("loadeddata", handleLoadedData);
|
|
8168
8177
|
};
|
|
8169
8178
|
};
|
|
8170
|
-
|
|
8171
|
-
if (
|
|
8172
|
-
var video =
|
|
8179
|
+
_this.play = function() {
|
|
8180
|
+
if (_this.props.videoElement) {
|
|
8181
|
+
var video = _this.props.videoElement;
|
|
8173
8182
|
var hasValidSource = video.src || video.currentSrc && video.currentSrc !== "" || video.readyState >= 1;
|
|
8174
8183
|
if (hasValidSource) {
|
|
8175
8184
|
var _video_play;
|
|
8176
8185
|
(_video_play = video.play()) === null || _video_play === void 0 ? void 0 : _video_play.catch(function(error) {
|
|
8177
8186
|
var _this_props_onError, _this_props;
|
|
8178
8187
|
console.error("[FilePlayer] Failed to play:", error);
|
|
8179
|
-
(_this_props_onError = (_this_props =
|
|
8188
|
+
(_this_props_onError = (_this_props = _this.props).onError) === null || _this_props_onError === void 0 ? void 0 : _this_props_onError.call(_this_props, error);
|
|
8180
8189
|
});
|
|
8181
8190
|
} else {
|
|
8182
8191
|
console.warn("[FilePlayer] Cannot play: video has no valid source");
|
|
8183
8192
|
}
|
|
8184
8193
|
}
|
|
8185
8194
|
};
|
|
8186
|
-
|
|
8187
|
-
if (
|
|
8188
|
-
|
|
8195
|
+
_this.pause = function() {
|
|
8196
|
+
if (_this.props.videoElement) {
|
|
8197
|
+
_this.props.videoElement.pause();
|
|
8189
8198
|
}
|
|
8190
8199
|
};
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
if (
|
|
8194
|
-
|
|
8200
|
+
_this.stop = function() {
|
|
8201
|
+
_this.pause();
|
|
8202
|
+
if (_this.props.videoElement) {
|
|
8203
|
+
_this.props.videoElement.currentTime = 0;
|
|
8195
8204
|
}
|
|
8196
8205
|
};
|
|
8197
|
-
|
|
8198
|
-
if (
|
|
8199
|
-
|
|
8206
|
+
_this.seekTo = function(seconds, keepPlaying) {
|
|
8207
|
+
if (_this.props.videoElement) {
|
|
8208
|
+
_this.props.videoElement.currentTime = seconds;
|
|
8200
8209
|
if (!keepPlaying) {
|
|
8201
|
-
|
|
8210
|
+
_this.pause();
|
|
8202
8211
|
}
|
|
8203
8212
|
}
|
|
8204
8213
|
};
|
|
8205
|
-
|
|
8206
|
-
if (
|
|
8207
|
-
|
|
8214
|
+
_this.setVolume = function(volume) {
|
|
8215
|
+
if (_this.props.videoElement) {
|
|
8216
|
+
_this.props.videoElement.volume = Math.max(0, Math.min(1, volume));
|
|
8208
8217
|
}
|
|
8209
8218
|
};
|
|
8210
|
-
|
|
8211
|
-
if (
|
|
8212
|
-
|
|
8219
|
+
_this.mute = function() {
|
|
8220
|
+
if (_this.props.videoElement) {
|
|
8221
|
+
_this.props.videoElement.muted = true;
|
|
8213
8222
|
}
|
|
8214
8223
|
};
|
|
8215
|
-
|
|
8216
|
-
if (
|
|
8217
|
-
|
|
8224
|
+
_this.unmute = function() {
|
|
8225
|
+
if (_this.props.videoElement) {
|
|
8226
|
+
_this.props.videoElement.muted = false;
|
|
8218
8227
|
}
|
|
8219
8228
|
};
|
|
8220
|
-
|
|
8221
|
-
if (
|
|
8222
|
-
|
|
8229
|
+
_this.setPlaybackRate = function(rate) {
|
|
8230
|
+
if (_this.props.videoElement && rate > 0) {
|
|
8231
|
+
_this.props.videoElement.playbackRate = rate;
|
|
8223
8232
|
}
|
|
8224
8233
|
};
|
|
8225
|
-
|
|
8226
|
-
if (
|
|
8227
|
-
|
|
8234
|
+
_this.setLoop = function(loop) {
|
|
8235
|
+
if (_this.props.videoElement) {
|
|
8236
|
+
_this.props.videoElement.loop = loop;
|
|
8228
8237
|
}
|
|
8229
8238
|
};
|
|
8230
|
-
|
|
8231
|
-
if (
|
|
8232
|
-
return
|
|
8239
|
+
_this.getDuration = function() {
|
|
8240
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.duration)) {
|
|
8241
|
+
return _this.props.videoElement.duration;
|
|
8233
8242
|
}
|
|
8234
8243
|
return null;
|
|
8235
8244
|
};
|
|
8236
|
-
|
|
8237
|
-
if (
|
|
8238
|
-
return
|
|
8245
|
+
_this.getCurrentTime = function() {
|
|
8246
|
+
if (_this.props.videoElement && isFinite(_this.props.videoElement.currentTime)) {
|
|
8247
|
+
return _this.props.videoElement.currentTime;
|
|
8239
8248
|
}
|
|
8240
8249
|
return null;
|
|
8241
8250
|
};
|
|
8242
|
-
|
|
8243
|
-
if (
|
|
8244
|
-
return
|
|
8251
|
+
_this.getSecondsLoaded = function() {
|
|
8252
|
+
if (_this.props.videoElement && _this.props.videoElement.buffered.length > 0) {
|
|
8253
|
+
return _this.props.videoElement.buffered.end(_this.props.videoElement.buffered.length - 1);
|
|
8245
8254
|
}
|
|
8246
8255
|
return null;
|
|
8247
8256
|
};
|
|
8248
|
-
|
|
8257
|
+
_this.getInternalPlayer = function() {
|
|
8249
8258
|
var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "player";
|
|
8250
|
-
if (key === "video") return
|
|
8259
|
+
if (key === "video") return _this.props.videoElement;
|
|
8251
8260
|
return null;
|
|
8252
8261
|
};
|
|
8253
|
-
|
|
8262
|
+
_this.enablePIP = function() {
|
|
8254
8263
|
return _async_to_generator(function() {
|
|
8255
8264
|
var error;
|
|
8256
8265
|
return _ts_generator(this, function(_state) {
|
|
@@ -8293,7 +8302,7 @@ var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
|
|
|
8293
8302
|
});
|
|
8294
8303
|
})();
|
|
8295
8304
|
};
|
|
8296
|
-
|
|
8305
|
+
_this.disablePIP = function() {
|
|
8297
8306
|
return _async_to_generator(function() {
|
|
8298
8307
|
var error;
|
|
8299
8308
|
return _ts_generator(this, function(_state) {
|
|
@@ -8387,7 +8396,7 @@ var players = [
|
|
|
8387
8396
|
key: "file",
|
|
8388
8397
|
name: "File Player",
|
|
8389
8398
|
canPlay: canPlay.file,
|
|
8390
|
-
canEnablePIP: function(url) {
|
|
8399
|
+
canEnablePIP: function canEnablePIP(url) {
|
|
8391
8400
|
return canPlay.file(url) && (document.pictureInPictureEnabled || typeof document.webkitSupportsPresentationMode === "function");
|
|
8392
8401
|
},
|
|
8393
8402
|
lazyPlayer: lazy(function() {
|