stormcloud-video-player 0.8.59 → 0.8.61
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/LICENSE +21 -21
- package/README.md +1369 -1369
- package/dist/stormcloud-vp.min.js +3 -1
- package/lib/Player.cjs +548 -0
- package/lib/Player.cjs.map +1 -0
- package/lib/Player.d.cts +146 -0
- package/lib/{index.js → StormcloudPlayer.cjs} +1193 -1908
- package/lib/StormcloudPlayer.cjs.map +1 -0
- package/lib/{index.d.ts → StormcloudPlayer.d.cts} +7 -400
- package/lib/index.cjs +1064 -280
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +18 -4032
- package/lib/patterns.cjs +111 -0
- package/lib/patterns.cjs.map +1 -0
- package/lib/patterns.d.cts +14 -0
- package/lib/player/AdBreakOrchestrator.cjs +51 -16
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +3 -1
- package/lib/player/AdConfigManager.cjs +206 -26
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdConfigManager.d.cts +1 -1
- package/lib/player/AdTimingService.cjs.map +1 -1
- package/lib/player/AdTimingService.d.cts +1 -1
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +1 -1
- package/lib/player/PlaceholderLayer.cjs.map +1 -1
- package/lib/player/PlayerControls.cjs.map +1 -1
- package/lib/player/PlayerControls.d.cts +1 -1
- package/lib/player/Scte35CueManager.cjs.map +1 -1
- package/lib/player/Scte35CueManager.d.cts +1 -1
- package/lib/player/Scte35Parser.cjs.map +1 -1
- package/lib/player/Scte35Parser.d.cts +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +1060 -278
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/player/playerTypes.cjs.map +1 -1
- package/lib/player/playerTypes.d.cts +1 -1
- package/lib/players/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +1060 -278
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +1060 -278
- package/lib/players/index.cjs.map +1 -1
- package/lib/props.cjs +186 -0
- package/lib/props.cjs.map +1 -0
- package/lib/props.d.cts +62 -0
- package/lib/sdk/hlsAdPlayer.cjs +884 -234
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/sdk/pal.cjs +9 -5
- package/lib/sdk/pal.cjs.map +1 -1
- package/lib/sdk/pal.d.cts +1 -0
- package/lib/types.cjs +49 -0
- package/lib/types.cjs.map +1 -0
- package/lib/{types-52ASml2N.d.cts → types.d.cts} +48 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +1064 -280
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/ctvVastSignals.cjs +178 -19
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/devUrl.cjs.map +1 -1
- package/lib/utils/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs +45 -16
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/lib/utils/trackingIngest.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.cjs +192 -20
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.d.cts +13 -2
- package/lib/utils/vastMacros.cjs +50 -4
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +2 -0
- package/lib/utils/vastTrackingMacros.cjs +5 -0
- package/lib/utils/vastTrackingMacros.cjs.map +1 -1
- package/lib/utils/vastTrackingMacros.d.cts +2 -0
- package/lib/utils.cjs +292 -0
- package/lib/utils.cjs.map +1 -0
- package/lib/utils.d.cts +17 -0
- package/package.json +91 -91
- package/rollup.config.js +90 -90
- package/lib/index.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
function _array_like_to_array(arr, len) {
|
|
2
3
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
4
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -177,42 +178,6 @@ function _object_spread_props(target, source) {
|
|
|
177
178
|
}
|
|
178
179
|
return target;
|
|
179
180
|
}
|
|
180
|
-
function _object_without_properties(source, excluded) {
|
|
181
|
-
if (source == null) return {};
|
|
182
|
-
var target = {}, sourceKeys, key, i;
|
|
183
|
-
if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
|
|
184
|
-
sourceKeys = Reflect.ownKeys(Object(source));
|
|
185
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
186
|
-
key = sourceKeys[i];
|
|
187
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
188
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
189
|
-
target[key] = source[key];
|
|
190
|
-
}
|
|
191
|
-
return target;
|
|
192
|
-
}
|
|
193
|
-
target = _object_without_properties_loose(source, excluded);
|
|
194
|
-
if (Object.getOwnPropertySymbols) {
|
|
195
|
-
sourceKeys = Object.getOwnPropertySymbols(source);
|
|
196
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
197
|
-
key = sourceKeys[i];
|
|
198
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
199
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
200
|
-
target[key] = source[key];
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return target;
|
|
204
|
-
}
|
|
205
|
-
function _object_without_properties_loose(source, excluded) {
|
|
206
|
-
if (source == null) return {};
|
|
207
|
-
var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
|
|
208
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
209
|
-
key = sourceKeys[i];
|
|
210
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
211
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
212
|
-
target[key] = source[key];
|
|
213
|
-
}
|
|
214
|
-
return target;
|
|
215
|
-
}
|
|
216
181
|
function _possible_constructor_return(self, call) {
|
|
217
182
|
if (call && (_type_of(call) === "object" || typeof call === "function")) return call;
|
|
218
183
|
return _assert_this_initialized(self);
|
|
@@ -361,10 +326,78 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
361
326
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
362
327
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
363
328
|
}
|
|
364
|
-
|
|
365
|
-
|
|
329
|
+
var __create = Object.create;
|
|
330
|
+
var __defProp = Object.defineProperty;
|
|
331
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
332
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
333
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
334
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
335
|
+
var __export = function __export(target, all) {
|
|
336
|
+
for(var name in all)__defProp(target, name, {
|
|
337
|
+
get: all[name],
|
|
338
|
+
enumerable: true
|
|
339
|
+
});
|
|
340
|
+
};
|
|
341
|
+
var __copyProps = function __copyProps(to, from, except, desc) {
|
|
342
|
+
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
343
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
344
|
+
try {
|
|
345
|
+
var _loop = function() {
|
|
346
|
+
var key = _step.value;
|
|
347
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
348
|
+
get: function get() {
|
|
349
|
+
return from[key];
|
|
350
|
+
},
|
|
351
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
355
|
+
} catch (err) {
|
|
356
|
+
_didIteratorError = true;
|
|
357
|
+
_iteratorError = err;
|
|
358
|
+
} finally{
|
|
359
|
+
try {
|
|
360
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
361
|
+
_iterator.return();
|
|
362
|
+
}
|
|
363
|
+
} finally{
|
|
364
|
+
if (_didIteratorError) {
|
|
365
|
+
throw _iteratorError;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return to;
|
|
371
|
+
};
|
|
372
|
+
var __toESM = function __toESM(mod, isNodeMode, target) {
|
|
373
|
+
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
374
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
375
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
376
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
377
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
378
|
+
value: mod,
|
|
379
|
+
enumerable: true
|
|
380
|
+
}) : target, mod);
|
|
381
|
+
};
|
|
382
|
+
var __toCommonJS = function __toCommonJS(mod) {
|
|
383
|
+
return __copyProps(__defProp({}, "__esModule", {
|
|
384
|
+
value: true
|
|
385
|
+
}), mod);
|
|
386
|
+
};
|
|
387
|
+
// src/StormcloudPlayer.tsx
|
|
388
|
+
var StormcloudPlayer_exports = {};
|
|
389
|
+
__export(StormcloudPlayer_exports, {
|
|
390
|
+
createStormcloudPlayer: function createStormcloudPlayer1() {
|
|
391
|
+
return createStormcloudPlayer;
|
|
392
|
+
},
|
|
393
|
+
default: function _default() {
|
|
394
|
+
return StormcloudPlayer_default;
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
module.exports = __toCommonJS(StormcloudPlayer_exports);
|
|
398
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
366
399
|
// src/sdk/hlsAdPlayer.ts
|
|
367
|
-
|
|
400
|
+
var import_hls = __toESM(require("hls.js"), 1);
|
|
368
401
|
// src/utils/browserCompat.ts
|
|
369
402
|
function getChromeVersion(ua) {
|
|
370
403
|
var match = ua.match(/Chrome\/(\d+)/);
|
|
@@ -402,7 +435,7 @@ function detectBrowser() {
|
|
|
402
435
|
var majorVersion = 0;
|
|
403
436
|
var isSmartTV = false;
|
|
404
437
|
var isLegacyTV = false;
|
|
405
|
-
var
|
|
438
|
+
var supportsModernJS = true;
|
|
406
439
|
var webOSVersion;
|
|
407
440
|
var tizenVersion;
|
|
408
441
|
var chromeVersionNum;
|
|
@@ -477,18 +510,18 @@ function detectBrowser() {
|
|
|
477
510
|
version = chromeVersion.toString();
|
|
478
511
|
majorVersion = chromeVersion;
|
|
479
512
|
if (chromeVersion < 50) {
|
|
480
|
-
|
|
513
|
+
supportsModernJS = false;
|
|
481
514
|
}
|
|
482
515
|
}
|
|
483
516
|
if (webkitVersion > 0 && webkitVersion < 600) {
|
|
484
|
-
|
|
517
|
+
supportsModernJS = false;
|
|
485
518
|
}
|
|
486
519
|
}
|
|
487
520
|
if (typeof Promise === "undefined" || typeof Map === "undefined" || typeof Set === "undefined") {
|
|
488
|
-
|
|
521
|
+
supportsModernJS = false;
|
|
489
522
|
}
|
|
490
523
|
if (typeof URLSearchParams === "undefined") {
|
|
491
|
-
|
|
524
|
+
supportsModernJS = false;
|
|
492
525
|
}
|
|
493
526
|
return {
|
|
494
527
|
name: name,
|
|
@@ -497,7 +530,7 @@ function detectBrowser() {
|
|
|
497
530
|
isSmartTV: isSmartTV,
|
|
498
531
|
isLegacyTV: isLegacyTV,
|
|
499
532
|
platform: platform,
|
|
500
|
-
supportsModernJS:
|
|
533
|
+
supportsModernJS: supportsModernJS,
|
|
501
534
|
webOSVersion: webOSVersion,
|
|
502
535
|
tizenVersion: tizenVersion,
|
|
503
536
|
chromeVersion: chromeVersionNum
|
|
@@ -517,13 +550,6 @@ function getBrowserConfigOverrides() {
|
|
|
517
550
|
}
|
|
518
551
|
return overrides;
|
|
519
552
|
}
|
|
520
|
-
function supportsModernJS() {
|
|
521
|
-
try {
|
|
522
|
-
return typeof Promise !== "undefined" && typeof Map !== "undefined" && typeof Set !== "undefined" && typeof Array.from !== "undefined" && typeof Object.assign !== "undefined" && typeof Array.prototype.forEach !== "undefined" && typeof String.prototype.includes !== "undefined";
|
|
523
|
-
} catch (e) {
|
|
524
|
-
return false;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
553
|
function logBrowserInfo() {
|
|
528
554
|
var debug = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
529
555
|
if (!debug) return;
|
|
@@ -544,22 +570,6 @@ function logBrowserInfo() {
|
|
|
544
570
|
userAgent: navigator.userAgent
|
|
545
571
|
}));
|
|
546
572
|
}
|
|
547
|
-
function supportsFeature(feature) {
|
|
548
|
-
switch(feature){
|
|
549
|
-
case "urlsearchparams":
|
|
550
|
-
return typeof URLSearchParams !== "undefined";
|
|
551
|
-
case "textencoder":
|
|
552
|
-
return typeof TextEncoder !== "undefined";
|
|
553
|
-
case "promises":
|
|
554
|
-
return typeof Promise !== "undefined";
|
|
555
|
-
case "fetch":
|
|
556
|
-
return typeof fetch !== "undefined";
|
|
557
|
-
case "crypto":
|
|
558
|
-
return typeof crypto !== "undefined" && typeof crypto.subtle !== "undefined";
|
|
559
|
-
default:
|
|
560
|
-
return false;
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
573
|
// src/utils/vastTrackingMacros.ts
|
|
564
574
|
var VAST_MACRO_PATTERN = /\[([A-Z][A-Z0-9_]*)\]/g;
|
|
565
575
|
var CACHEBUSTING_ALIASES = /\[CACHEBUSTER\]|\[cachebuster\]|\[timestamp\]|\[random\]|\[INSERT_RANDOM_NUMBER\]|%%CACHEBUSTER%%|%%CACHEBUST%%|\$\{CACHEBUSTER\}|\$\{CACHEBUSTING\}|\{cachebuster\}|\{random\}/g;
|
|
@@ -605,6 +615,7 @@ var KNOWN_VAST_MACROS = /* @__PURE__ */ new Set([
|
|
|
605
615
|
"PLAYERSIZE",
|
|
606
616
|
"PLAYERSTATE",
|
|
607
617
|
"PODSEQUENCE",
|
|
618
|
+
"REASON",
|
|
608
619
|
"REGULATIONS",
|
|
609
620
|
"SERVERSIDE",
|
|
610
621
|
"SERVERUA",
|
|
@@ -663,6 +674,10 @@ function resolveMacroValues(ctx) {
|
|
|
663
674
|
if (ctx.podSequence != null) {
|
|
664
675
|
set("PODSEQUENCE", String(ctx.podSequence));
|
|
665
676
|
}
|
|
677
|
+
set("ADSERVINGID", ctx.adServingId);
|
|
678
|
+
if (ctx.reason != null && ctx.reason !== "") {
|
|
679
|
+
set("REASON", String(ctx.reason));
|
|
680
|
+
}
|
|
666
681
|
return values;
|
|
667
682
|
}
|
|
668
683
|
function substituteVastTrackingMacros(url) {
|
|
@@ -679,10 +694,72 @@ function substituteVastTrackingMacros(url) {
|
|
|
679
694
|
});
|
|
680
695
|
}
|
|
681
696
|
// src/sdk/hlsAdPlayer.ts
|
|
697
|
+
var LINEAR_TRACKING_EVENTS = [
|
|
698
|
+
"creativeView",
|
|
699
|
+
"loaded",
|
|
700
|
+
"start",
|
|
701
|
+
"firstQuartile",
|
|
702
|
+
"midpoint",
|
|
703
|
+
"thirdQuartile",
|
|
704
|
+
"complete",
|
|
705
|
+
"mute",
|
|
706
|
+
"unmute",
|
|
707
|
+
"pause",
|
|
708
|
+
"resume",
|
|
709
|
+
"fullscreen",
|
|
710
|
+
"exitFullscreen",
|
|
711
|
+
"playerExpand",
|
|
712
|
+
"playerCollapse",
|
|
713
|
+
"notUsed"
|
|
714
|
+
];
|
|
715
|
+
function textOf(el) {
|
|
716
|
+
var _el_textContent;
|
|
717
|
+
var value = el === null || el === void 0 ? void 0 : (_el_textContent = el.textContent) === null || _el_textContent === void 0 ? void 0 : _el_textContent.trim();
|
|
718
|
+
return value ? value : void 0;
|
|
719
|
+
}
|
|
720
|
+
function parseVastTime(value) {
|
|
721
|
+
if (!value) return void 0;
|
|
722
|
+
var parts = value.trim().split(":");
|
|
723
|
+
if (parts.length !== 3) return void 0;
|
|
724
|
+
var _parts_map = _sliced_to_array(parts.map(function(p) {
|
|
725
|
+
return parseFloat(p);
|
|
726
|
+
}), 3), h = _parts_map[0], m = _parts_map[1], s = _parts_map[2];
|
|
727
|
+
if (![
|
|
728
|
+
h,
|
|
729
|
+
m,
|
|
730
|
+
s
|
|
731
|
+
].every(function(n) {
|
|
732
|
+
return n !== void 0 && Number.isFinite(n);
|
|
733
|
+
})) {
|
|
734
|
+
return void 0;
|
|
735
|
+
}
|
|
736
|
+
return h * 3600 + m * 60 + s;
|
|
737
|
+
}
|
|
738
|
+
function parseProgressOffset(offset) {
|
|
739
|
+
if (!offset) return void 0;
|
|
740
|
+
var trimmed = offset.trim();
|
|
741
|
+
if (trimmed.endsWith("%")) {
|
|
742
|
+
var percent = parseFloat(trimmed);
|
|
743
|
+
return Number.isFinite(percent) ? {
|
|
744
|
+
offsetPercent: percent
|
|
745
|
+
} : void 0;
|
|
746
|
+
}
|
|
747
|
+
var seconds = parseVastTime(trimmed);
|
|
748
|
+
return seconds !== void 0 ? {
|
|
749
|
+
offsetSeconds: seconds
|
|
750
|
+
} : void 0;
|
|
751
|
+
}
|
|
682
752
|
var MAX_VAST_WRAPPER_DEPTH = 5;
|
|
683
753
|
var BEACON_TIMEOUT_MS = 3e4;
|
|
684
754
|
var inFlightBeacons = /* @__PURE__ */ new Set();
|
|
685
755
|
var VAST_ERROR_MEDIA_DISPLAY = 405;
|
|
756
|
+
var VAST_ERROR_WRAPPER_TIMEOUT = 301;
|
|
757
|
+
var VAST_ERROR_WRAPPER_LIMIT = 302;
|
|
758
|
+
var VAST_ERROR_WRAPPER_NO_ADS = 303;
|
|
759
|
+
var VAST_ERROR_NO_SUPPORTED_MEDIA = 403;
|
|
760
|
+
var VERIFICATION_NOT_SUPPORTED_REASON = 2;
|
|
761
|
+
var VIEWABLE_MIN_VISIBLE_RATIO = 0.5;
|
|
762
|
+
var VIEWABLE_MIN_CONTINUOUS_S = 2;
|
|
686
763
|
function toVastMediaErrorCode(error) {
|
|
687
764
|
switch(error === null || error === void 0 ? void 0 : error.code){
|
|
688
765
|
case 1:
|
|
@@ -710,6 +787,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
710
787
|
var adHls;
|
|
711
788
|
var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
|
|
712
789
|
var adEventHandlers = [];
|
|
790
|
+
var containerHandlers = [];
|
|
713
791
|
var currentAd;
|
|
714
792
|
var currentAdMediaFile;
|
|
715
793
|
var podAds = [];
|
|
@@ -727,14 +805,28 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
727
805
|
var sawDecodedVideoFrame = false;
|
|
728
806
|
var videoFrameCallbackHandle;
|
|
729
807
|
var pendingPlayPromise;
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
808
|
+
function createTrackingState() {
|
|
809
|
+
return {
|
|
810
|
+
impression: false,
|
|
811
|
+
loaded: false,
|
|
812
|
+
start: false,
|
|
813
|
+
firstQuartile: false,
|
|
814
|
+
midpoint: false,
|
|
815
|
+
thirdQuartile: false,
|
|
816
|
+
complete: false,
|
|
817
|
+
viewabilitySettled: false,
|
|
818
|
+
lastMuted: void 0,
|
|
819
|
+
progressFired: /* @__PURE__ */ new Set()
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
var trackingFired = createTrackingState();
|
|
823
|
+
var resolvedAds = /* @__PURE__ */ new Set();
|
|
824
|
+
var viewObserver;
|
|
825
|
+
var visibleRatio = 0;
|
|
826
|
+
var continuousVisibleS = 0;
|
|
827
|
+
var lastViewSampleTime;
|
|
828
|
+
var lastPlayerExpanded = false;
|
|
829
|
+
var documentHandlers = [];
|
|
738
830
|
function emit(event, payload) {
|
|
739
831
|
var set = listeners.get(event);
|
|
740
832
|
if (!set) return;
|
|
@@ -763,7 +855,11 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
763
855
|
}
|
|
764
856
|
}
|
|
765
857
|
}
|
|
766
|
-
function buildTrackingMacroContext(
|
|
858
|
+
function buildTrackingMacroContext() {
|
|
859
|
+
var options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
860
|
+
var _options2_ad;
|
|
861
|
+
var errorCode = options2.errorCode, reason = options2.reason;
|
|
862
|
+
var ad = (_options2_ad = options2.ad) !== null && _options2_ad !== void 0 ? _options2_ad : currentAd;
|
|
767
863
|
var context = {
|
|
768
864
|
adPlayheadSeconds: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.currentTime,
|
|
769
865
|
contentPlayheadSeconds: contentVideo.currentTime,
|
|
@@ -784,11 +880,17 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
784
880
|
if (podAds.length > 0) {
|
|
785
881
|
context.podSequence = podIndex + 1;
|
|
786
882
|
}
|
|
883
|
+
if (ad === null || ad === void 0 ? void 0 : ad.adServingId) {
|
|
884
|
+
context.adServingId = ad.adServingId;
|
|
885
|
+
}
|
|
886
|
+
if (reason != null) {
|
|
887
|
+
context.reason = reason;
|
|
888
|
+
}
|
|
787
889
|
return context;
|
|
788
890
|
}
|
|
789
891
|
function fireTrackingPixels(urls, options2) {
|
|
790
892
|
if (!urls || urls.length === 0) return;
|
|
791
|
-
var macroContext = buildTrackingMacroContext(options2
|
|
893
|
+
var macroContext = buildTrackingMacroContext(options2);
|
|
792
894
|
urls.forEach(function(url) {
|
|
793
895
|
try {
|
|
794
896
|
var trackingUrl = substituteVastTrackingMacros(url, macroContext);
|
|
@@ -899,8 +1001,8 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
899
1001
|
var url = (mediaFile.url.toLowerCase().split("?")[0] || "").trim();
|
|
900
1002
|
return type.startsWith("audio/") || url.endsWith(".mp3") || url.endsWith(".aac") || url.endsWith(".m4a") || url.endsWith(".ogg") || url.endsWith(".oga") || url.endsWith(".opus") || url.endsWith(".wav") || url.endsWith(".weba");
|
|
901
1003
|
}
|
|
902
|
-
function collectVideoMediaFiles(
|
|
903
|
-
var mediaFileElements =
|
|
1004
|
+
function collectVideoMediaFiles(linear, verbose) {
|
|
1005
|
+
var mediaFileElements = linear.querySelectorAll(":scope > MediaFiles > MediaFile");
|
|
904
1006
|
var mediaFiles = [];
|
|
905
1007
|
if (verbose) {
|
|
906
1008
|
console.log("[HlsAdPlayer] Found ".concat(mediaFileElements.length, " MediaFile element(s) in VAST XML"));
|
|
@@ -920,6 +1022,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
920
1022
|
}
|
|
921
1023
|
return;
|
|
922
1024
|
}
|
|
1025
|
+
var apiFramework = (mf.getAttribute("apiFramework") || "").toUpperCase();
|
|
1026
|
+
if (apiFramework === "VPAID") {
|
|
1027
|
+
if (verbose) {
|
|
1028
|
+
console.log("[HlsAdPlayer] MediaFile ".concat(index, " ignored (VPAID creatives are not supported)"));
|
|
1029
|
+
}
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
923
1032
|
var bitrateAttr = mf.getAttribute("bitrate");
|
|
924
1033
|
var bitrateValue = bitrateAttr ? parseInt(bitrateAttr, 10) : void 0;
|
|
925
1034
|
var mediaFile = {
|
|
@@ -950,114 +1059,144 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
950
1059
|
return mediaFiles;
|
|
951
1060
|
}
|
|
952
1061
|
function createEmptyTrackingUrls() {
|
|
953
|
-
|
|
1062
|
+
var urls = {
|
|
954
1063
|
impression: [],
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
pause: [],
|
|
963
|
-
resume: [],
|
|
964
|
-
fullscreen: [],
|
|
965
|
-
exitFullscreen: [],
|
|
966
|
-
skip: [],
|
|
967
|
-
error: []
|
|
1064
|
+
clickTracking: [],
|
|
1065
|
+
error: [],
|
|
1066
|
+
viewable: [],
|
|
1067
|
+
notViewable: [],
|
|
1068
|
+
viewUndetermined: [],
|
|
1069
|
+
verificationNotExecuted: [],
|
|
1070
|
+
progress: []
|
|
968
1071
|
};
|
|
1072
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1073
|
+
try {
|
|
1074
|
+
for(var _iterator = LINEAR_TRACKING_EVENTS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1075
|
+
var event = _step.value;
|
|
1076
|
+
urls[event] = [];
|
|
1077
|
+
}
|
|
1078
|
+
} catch (err) {
|
|
1079
|
+
_didIteratorError = true;
|
|
1080
|
+
_iteratorError = err;
|
|
1081
|
+
} finally{
|
|
1082
|
+
try {
|
|
1083
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1084
|
+
_iterator.return();
|
|
1085
|
+
}
|
|
1086
|
+
} finally{
|
|
1087
|
+
if (_didIteratorError) {
|
|
1088
|
+
throw _iteratorError;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
return urls;
|
|
969
1093
|
}
|
|
970
|
-
function
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
var url = (_el_textContent = el.textContent) === null || _el_textContent === void 0 ? void 0 : _el_textContent.trim();
|
|
975
|
-
if (url) trackingUrls.impression.push(url);
|
|
1094
|
+
function pushUrls(target, elements) {
|
|
1095
|
+
elements.forEach(function(el) {
|
|
1096
|
+
var url = textOf(el);
|
|
1097
|
+
if (url) target.push(url);
|
|
976
1098
|
});
|
|
977
|
-
|
|
978
|
-
|
|
1099
|
+
}
|
|
1100
|
+
function collectLinearTracking(linear, into) {
|
|
1101
|
+
linear.querySelectorAll(":scope > TrackingEvents > Tracking").forEach(function(el) {
|
|
979
1102
|
var event = el.getAttribute("event");
|
|
980
|
-
var url = (
|
|
981
|
-
if (event
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1103
|
+
var url = textOf(el);
|
|
1104
|
+
if (!event || !url) return;
|
|
1105
|
+
if (event === "progress") {
|
|
1106
|
+
var offset = parseProgressOffset(el.getAttribute("offset"));
|
|
1107
|
+
if (offset) into.progress.push(_object_spread({
|
|
1108
|
+
url: url
|
|
1109
|
+
}, offset));
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
if (LINEAR_TRACKING_EVENTS.indexOf(event) !== -1) {
|
|
1113
|
+
into[event].push(url);
|
|
986
1114
|
}
|
|
987
1115
|
});
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1116
|
+
pushUrls(into.clickTracking, linear.querySelectorAll(":scope > VideoClicks > ClickTracking"));
|
|
1117
|
+
}
|
|
1118
|
+
function collectAdLevelTracking(adBody, into) {
|
|
1119
|
+
pushUrls(into.impression, adBody.querySelectorAll(":scope > Impression"));
|
|
1120
|
+
pushUrls(into.error, adBody.querySelectorAll(":scope > Error"));
|
|
1121
|
+
pushUrls(into.viewable, adBody.querySelectorAll(":scope > ViewableImpression > Viewable"));
|
|
1122
|
+
pushUrls(into.notViewable, adBody.querySelectorAll(":scope > ViewableImpression > NotViewable"));
|
|
1123
|
+
pushUrls(into.viewUndetermined, adBody.querySelectorAll(":scope > ViewableImpression > ViewUndetermined"));
|
|
1124
|
+
adBody.querySelectorAll(':scope > AdVerifications > Verification, :scope > Extensions > Extension[type="AdVerifications"] > AdVerifications > Verification').forEach(function(verification) {
|
|
1125
|
+
pushUrls(into.verificationNotExecuted, verification.querySelectorAll(':scope > TrackingEvents > Tracking[event="verificationNotExecuted"]'));
|
|
992
1126
|
});
|
|
993
|
-
return trackingUrls;
|
|
994
1127
|
}
|
|
995
1128
|
function mergeTrackingUrls(target, source) {
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
1129
|
+
var targetLists = target;
|
|
1130
|
+
var sourceLists = source;
|
|
1131
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1132
|
+
try {
|
|
1133
|
+
for(var _iterator = Object.keys(targetLists)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1134
|
+
var key = _step.value;
|
|
1135
|
+
var incoming = sourceLists[key];
|
|
1136
|
+
if (incoming && incoming.length > 0) {
|
|
1137
|
+
targetLists[key] = targetLists[key].concat(incoming);
|
|
1138
|
+
}
|
|
999
1139
|
}
|
|
1000
|
-
})
|
|
1140
|
+
} catch (err) {
|
|
1141
|
+
_didIteratorError = true;
|
|
1142
|
+
_iteratorError = err;
|
|
1143
|
+
} finally{
|
|
1144
|
+
try {
|
|
1145
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1146
|
+
_iterator.return();
|
|
1147
|
+
}
|
|
1148
|
+
} finally{
|
|
1149
|
+
if (_didIteratorError) {
|
|
1150
|
+
throw _iteratorError;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1001
1154
|
return target;
|
|
1002
1155
|
}
|
|
1156
|
+
function parseXml(xmlString) {
|
|
1157
|
+
var xmlDoc = new DOMParser().parseFromString(xmlString, "text/xml");
|
|
1158
|
+
var parserError = xmlDoc.querySelector("parsererror");
|
|
1159
|
+
if (parserError) {
|
|
1160
|
+
console.error("[HlsAdPlayer] XML parsing error (malformed VAST XML):", parserError.textContent);
|
|
1161
|
+
return null;
|
|
1162
|
+
}
|
|
1163
|
+
return xmlDoc;
|
|
1164
|
+
}
|
|
1165
|
+
function getAdSequence(adElement) {
|
|
1166
|
+
var sequence = parseInt(adElement.getAttribute("sequence") || "", 10);
|
|
1167
|
+
return Number.isFinite(sequence) ? sequence : void 0;
|
|
1168
|
+
}
|
|
1169
|
+
function emptyVastResult(root) {
|
|
1170
|
+
var errorUrls = [];
|
|
1171
|
+
pushUrls(errorUrls, root.querySelectorAll(":scope > Error"));
|
|
1172
|
+
return {
|
|
1173
|
+
type: "empty",
|
|
1174
|
+
errorUrls: errorUrls,
|
|
1175
|
+
errorCode: VAST_ERROR_WRAPPER_NO_ADS
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1003
1178
|
function parseVastXml(xmlString) {
|
|
1004
1179
|
try {
|
|
1005
|
-
var
|
|
1006
|
-
var
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
}
|
|
1015
|
-
var adElement = xmlDoc.querySelector("Ad");
|
|
1180
|
+
var _adElements_find;
|
|
1181
|
+
var xmlDoc = parseXml(xmlString);
|
|
1182
|
+
if (!xmlDoc) return {
|
|
1183
|
+
type: "empty"
|
|
1184
|
+
};
|
|
1185
|
+
var root = xmlDoc.documentElement;
|
|
1186
|
+
var adElements = Array.from(root.querySelectorAll(":scope > Ad"));
|
|
1187
|
+
var adElement = (_adElements_find = adElements.find(function(el) {
|
|
1188
|
+
return getAdSequence(el) === void 0;
|
|
1189
|
+
})) !== null && _adElements_find !== void 0 ? _adElements_find : adElements[0];
|
|
1016
1190
|
if (!adElement) {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
};
|
|
1191
|
+
var _root_getAttribute;
|
|
1192
|
+
console.warn("[HlsAdPlayer] No Ad element found in VAST ".concat((_root_getAttribute = root.getAttribute("version")) !== null && _root_getAttribute !== void 0 ? _root_getAttribute : "", " response"));
|
|
1193
|
+
return emptyVastResult(root);
|
|
1021
1194
|
}
|
|
1022
|
-
var
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
var wrapperUri = (_xmlDoc_querySelector2 = xmlDoc.querySelector("VASTAdTagURI")) === null || _xmlDoc_querySelector2 === void 0 ? void 0 : (_xmlDoc_querySelector_textContent1 = _xmlDoc_querySelector2.textContent) === null || _xmlDoc_querySelector_textContent1 === void 0 ? void 0 : _xmlDoc_querySelector_textContent1.trim();
|
|
1026
|
-
if (wrapperUri) {
|
|
1027
|
-
console.log("[HlsAdPlayer] VAST wrapper detected, following VASTAdTagURI: ".concat(wrapperUri));
|
|
1028
|
-
return {
|
|
1029
|
-
type: "wrapper",
|
|
1030
|
-
vastAdTagUri: wrapperUri,
|
|
1031
|
-
trackingUrls: extractTrackingUrls(xmlDoc),
|
|
1032
|
-
clickThrough: clickThrough
|
|
1033
|
-
};
|
|
1034
|
-
}
|
|
1035
|
-
var isNoAdAvailable = adId === "empty" || title.toLowerCase().includes("no ad available") || title.toLowerCase() === "no ad available";
|
|
1036
|
-
var durationText = ((_xmlDoc_querySelector3 = xmlDoc.querySelector("Duration")) === null || _xmlDoc_querySelector3 === void 0 ? void 0 : _xmlDoc_querySelector3.textContent) || "00:00:30";
|
|
1037
|
-
var durationParts = durationText.split(":");
|
|
1038
|
-
var duration = parseInt(durationParts[0] || "0", 10) * 3600 + parseInt(durationParts[1] || "0", 10) * 60 + parseInt(durationParts[2] || "0", 10);
|
|
1039
|
-
var mediaFiles = collectVideoMediaFiles(xmlDoc, true);
|
|
1040
|
-
if (mediaFiles.length === 0) {
|
|
1041
|
-
if (isNoAdAvailable) {
|
|
1042
|
-
console.warn("[HlsAdPlayer] No ads available (VAST response indicates no ads)");
|
|
1043
|
-
} else {
|
|
1044
|
-
console.warn("[HlsAdPlayer] No supported media files found in VAST XML");
|
|
1045
|
-
}
|
|
1046
|
-
return {
|
|
1047
|
-
type: "empty"
|
|
1048
|
-
};
|
|
1195
|
+
var parsed = parseAdElement(adElement, true);
|
|
1196
|
+
if (parsed.type === "wrapper") {
|
|
1197
|
+
console.log("[HlsAdPlayer] VAST wrapper detected, following VASTAdTagURI: ".concat(parsed.vastAdTagUri));
|
|
1049
1198
|
}
|
|
1050
|
-
return
|
|
1051
|
-
type: "inline",
|
|
1052
|
-
ad: {
|
|
1053
|
-
id: adId,
|
|
1054
|
-
title: title,
|
|
1055
|
-
duration: duration,
|
|
1056
|
-
mediaFiles: mediaFiles,
|
|
1057
|
-
trackingUrls: extractTrackingUrls(xmlDoc),
|
|
1058
|
-
clickThrough: clickThrough
|
|
1059
|
-
}
|
|
1060
|
-
};
|
|
1199
|
+
return parsed;
|
|
1061
1200
|
} catch (error) {
|
|
1062
1201
|
console.error("[HlsAdPlayer] Error parsing VAST XML:", error);
|
|
1063
1202
|
return {
|
|
@@ -1066,48 +1205,101 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1066
1205
|
}
|
|
1067
1206
|
}
|
|
1068
1207
|
function parseAdElement(adElement) {
|
|
1208
|
+
var verbose = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1069
1209
|
try {
|
|
1070
|
-
var
|
|
1071
|
-
var
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1210
|
+
var _parseVastTime;
|
|
1211
|
+
var wrapper = adElement.querySelector(":scope > Wrapper");
|
|
1212
|
+
if (wrapper) {
|
|
1213
|
+
var vastAdTagUri = textOf(wrapper.querySelector(":scope > VASTAdTagURI"));
|
|
1214
|
+
if (!vastAdTagUri) {
|
|
1215
|
+
console.warn("[HlsAdPlayer] <Wrapper> has no VASTAdTagURI");
|
|
1216
|
+
return {
|
|
1217
|
+
type: "empty"
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
var trackingUrls2 = createEmptyTrackingUrls();
|
|
1221
|
+
collectAdLevelTracking(wrapper, trackingUrls2);
|
|
1222
|
+
wrapper.querySelectorAll(":scope > Creatives > Creative > Linear").forEach(function(linear2) {
|
|
1223
|
+
return collectLinearTracking(linear2, trackingUrls2);
|
|
1224
|
+
});
|
|
1076
1225
|
return {
|
|
1077
1226
|
type: "wrapper",
|
|
1078
|
-
vastAdTagUri:
|
|
1079
|
-
trackingUrls:
|
|
1080
|
-
|
|
1227
|
+
vastAdTagUri: vastAdTagUri,
|
|
1228
|
+
trackingUrls: trackingUrls2,
|
|
1229
|
+
rules: {
|
|
1230
|
+
followAdditionalWrappers: wrapper.getAttribute("followAdditionalWrappers") !== "false"
|
|
1231
|
+
}
|
|
1081
1232
|
};
|
|
1082
1233
|
}
|
|
1083
|
-
var
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
var duration = parseInt(durationParts[0] || "0", 10) * 3600 + parseInt(durationParts[1] || "0", 10) * 60 + parseInt(durationParts[2] || "0", 10);
|
|
1087
|
-
var mediaFiles = collectVideoMediaFiles(adElement, false);
|
|
1088
|
-
if (mediaFiles.length === 0) {
|
|
1089
|
-
if (isNoAdAvailable) {
|
|
1090
|
-
console.warn("[HlsAdPlayer] Pod <Ad> indicates no ad available");
|
|
1091
|
-
} else {
|
|
1092
|
-
console.warn("[HlsAdPlayer] No supported media files in pod <Ad>");
|
|
1093
|
-
}
|
|
1234
|
+
var inLine = adElement.querySelector(":scope > InLine");
|
|
1235
|
+
if (!inLine) {
|
|
1236
|
+
console.warn("[HlsAdPlayer] <Ad> has neither <InLine> nor <Wrapper>");
|
|
1094
1237
|
return {
|
|
1095
1238
|
type: "empty"
|
|
1096
1239
|
};
|
|
1097
1240
|
}
|
|
1241
|
+
var errorUrls = [];
|
|
1242
|
+
pushUrls(errorUrls, inLine.querySelectorAll(":scope > Error"));
|
|
1243
|
+
if (adElement.getAttribute("conditionalAd") === "true") {
|
|
1244
|
+
console.warn("[HlsAdPlayer] Skipping conditional <Ad> (VPAID-only)");
|
|
1245
|
+
return {
|
|
1246
|
+
type: "empty",
|
|
1247
|
+
errorUrls: errorUrls,
|
|
1248
|
+
errorCode: VAST_ERROR_NO_SUPPORTED_MEDIA
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
var linear;
|
|
1252
|
+
var mediaFiles = [];
|
|
1253
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1254
|
+
try {
|
|
1255
|
+
for(var _iterator = Array.from(inLine.querySelectorAll(":scope > Creatives > Creative > Linear"))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1256
|
+
var candidate = _step.value;
|
|
1257
|
+
var files = collectVideoMediaFiles(candidate, verbose);
|
|
1258
|
+
if (files.length > 0) {
|
|
1259
|
+
linear = candidate;
|
|
1260
|
+
mediaFiles = files;
|
|
1261
|
+
break;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
} catch (err) {
|
|
1265
|
+
_didIteratorError = true;
|
|
1266
|
+
_iteratorError = err;
|
|
1267
|
+
} finally{
|
|
1268
|
+
try {
|
|
1269
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1270
|
+
_iterator.return();
|
|
1271
|
+
}
|
|
1272
|
+
} finally{
|
|
1273
|
+
if (_didIteratorError) {
|
|
1274
|
+
throw _iteratorError;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
if (!linear) {
|
|
1279
|
+
console.warn("[HlsAdPlayer] No supported linear media files in <Ad>");
|
|
1280
|
+
return {
|
|
1281
|
+
type: "empty",
|
|
1282
|
+
errorUrls: errorUrls,
|
|
1283
|
+
errorCode: VAST_ERROR_NO_SUPPORTED_MEDIA
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
var trackingUrls = createEmptyTrackingUrls();
|
|
1287
|
+
collectAdLevelTracking(inLine, trackingUrls);
|
|
1288
|
+
collectLinearTracking(linear, trackingUrls);
|
|
1098
1289
|
return {
|
|
1099
1290
|
type: "inline",
|
|
1100
1291
|
ad: {
|
|
1101
|
-
id:
|
|
1102
|
-
title:
|
|
1103
|
-
duration:
|
|
1292
|
+
id: adElement.getAttribute("id") || "unknown",
|
|
1293
|
+
title: textOf(inLine.querySelector(":scope > AdTitle")) || "Ad",
|
|
1294
|
+
duration: (_parseVastTime = parseVastTime(textOf(linear.querySelector(":scope > Duration")))) !== null && _parseVastTime !== void 0 ? _parseVastTime : 30,
|
|
1104
1295
|
mediaFiles: mediaFiles,
|
|
1105
|
-
trackingUrls:
|
|
1106
|
-
clickThrough:
|
|
1296
|
+
trackingUrls: trackingUrls,
|
|
1297
|
+
clickThrough: textOf(linear.querySelector(":scope > VideoClicks > ClickThrough")),
|
|
1298
|
+
adServingId: textOf(inLine.querySelector(":scope > AdServingId"))
|
|
1107
1299
|
}
|
|
1108
1300
|
};
|
|
1109
1301
|
} catch (error) {
|
|
1110
|
-
console.error("[HlsAdPlayer] Error parsing
|
|
1302
|
+
console.error("[HlsAdPlayer] Error parsing <Ad> element:", error);
|
|
1111
1303
|
return {
|
|
1112
1304
|
type: "empty"
|
|
1113
1305
|
};
|
|
@@ -1186,30 +1378,63 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1186
1378
|
}
|
|
1187
1379
|
function fetchAndParseVastAd(_0) {
|
|
1188
1380
|
return _async_to_generator(function(vastTagUrl) {
|
|
1189
|
-
var depth, accumulatedTracking, vastXml, parsed;
|
|
1381
|
+
var depth, accumulatedTracking, rules, vastXml, error, parsed, _parsed_errorUrls, _parsed_errorCode;
|
|
1190
1382
|
var _arguments = arguments;
|
|
1191
1383
|
return _ts_generator(this, function(_state) {
|
|
1192
1384
|
switch(_state.label){
|
|
1193
1385
|
case 0:
|
|
1194
|
-
depth = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : 0, accumulatedTracking = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : createEmptyTrackingUrls()
|
|
1386
|
+
depth = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : 0, accumulatedTracking = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : createEmptyTrackingUrls(), rules = _arguments.length > 3 && _arguments[3] !== void 0 ? _arguments[3] : {
|
|
1387
|
+
followAdditionalWrappers: true
|
|
1388
|
+
};
|
|
1389
|
+
_state.label = 1;
|
|
1390
|
+
case 1:
|
|
1391
|
+
_state.trys.push([
|
|
1392
|
+
1,
|
|
1393
|
+
3,
|
|
1394
|
+
,
|
|
1395
|
+
4
|
|
1396
|
+
]);
|
|
1195
1397
|
return [
|
|
1196
1398
|
4,
|
|
1197
1399
|
fetchVastXml(vastTagUrl, depth === 0 ? "include" : "omit")
|
|
1198
1400
|
];
|
|
1199
|
-
case
|
|
1401
|
+
case 2:
|
|
1200
1402
|
vastXml = _state.sent();
|
|
1403
|
+
return [
|
|
1404
|
+
3,
|
|
1405
|
+
4
|
|
1406
|
+
];
|
|
1407
|
+
case 3:
|
|
1408
|
+
error = _state.sent();
|
|
1409
|
+
if (depth === 0) throw error;
|
|
1410
|
+
console.warn("[HlsAdPlayer] Wrapped VAST request failed:", error);
|
|
1411
|
+
fireTrackingPixels(accumulatedTracking.error, {
|
|
1412
|
+
errorCode: VAST_ERROR_WRAPPER_TIMEOUT
|
|
1413
|
+
});
|
|
1414
|
+
return [
|
|
1415
|
+
2,
|
|
1416
|
+
null
|
|
1417
|
+
];
|
|
1418
|
+
case 4:
|
|
1201
1419
|
console.log("[HlsAdPlayer] VAST XML received");
|
|
1202
1420
|
console.log("[HlsAdPlayer] VAST XML content (first 2000 chars):", vastXml.substring(0, 2e3));
|
|
1203
1421
|
parsed = parseVastXml(vastXml);
|
|
1204
1422
|
if (parsed.type === "empty") {
|
|
1423
|
+
;
|
|
1424
|
+
fireTrackingPixels(((_parsed_errorUrls = parsed.errorUrls) !== null && _parsed_errorUrls !== void 0 ? _parsed_errorUrls : []).concat(accumulatedTracking.error), {
|
|
1425
|
+
errorCode: (_parsed_errorCode = parsed.errorCode) !== null && _parsed_errorCode !== void 0 ? _parsed_errorCode : VAST_ERROR_WRAPPER_NO_ADS
|
|
1426
|
+
});
|
|
1205
1427
|
return [
|
|
1206
1428
|
2,
|
|
1207
1429
|
null
|
|
1208
1430
|
];
|
|
1209
1431
|
}
|
|
1210
1432
|
if (parsed.type === "wrapper") {
|
|
1211
|
-
if (depth >= MAX_VAST_WRAPPER_DEPTH) {
|
|
1212
|
-
console.warn("[HlsAdPlayer] VAST wrapper depth limit (".concat(MAX_VAST_WRAPPER_DEPTH, ") reached, aborting redirect chain"));
|
|
1433
|
+
if (depth >= MAX_VAST_WRAPPER_DEPTH || !rules.followAdditionalWrappers) {
|
|
1434
|
+
console.warn(rules.followAdditionalWrappers ? "[HlsAdPlayer] VAST wrapper depth limit (".concat(MAX_VAST_WRAPPER_DEPTH, ") reached, aborting redirect chain") : '[HlsAdPlayer] Parent wrapper set followAdditionalWrappers="false"; rejecting nested wrapper');
|
|
1435
|
+
fireTrackingPixels(accumulatedTracking.error.concat(parsed.trackingUrls.error), {
|
|
1436
|
+
errorCode: VAST_ERROR_WRAPPER_LIMIT
|
|
1437
|
+
});
|
|
1213
1438
|
return [
|
|
1214
1439
|
2,
|
|
1215
1440
|
null
|
|
@@ -1218,7 +1443,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1218
1443
|
mergeTrackingUrls(accumulatedTracking, parsed.trackingUrls);
|
|
1219
1444
|
return [
|
|
1220
1445
|
2,
|
|
1221
|
-
fetchAndParseVastAd(parsed.vastAdTagUri, depth + 1, accumulatedTracking)
|
|
1446
|
+
fetchAndParseVastAd(parsed.vastAdTagUri, depth + 1, accumulatedTracking, parsed.rules)
|
|
1222
1447
|
];
|
|
1223
1448
|
}
|
|
1224
1449
|
mergeTrackingUrls(parsed.ad.trackingUrls, accumulatedTracking);
|
|
@@ -1232,7 +1457,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1232
1457
|
}
|
|
1233
1458
|
function fetchAndParsePod(vastTagUrl) {
|
|
1234
1459
|
return _async_to_generator(function() {
|
|
1235
|
-
var vastXml, trimmedXml,
|
|
1460
|
+
var _root_getAttribute, vastXml, trimmedXml, xmlDoc, root, adElements, _root_getAttribute1, _empty_errorUrls, empty, _empty_errorCode, resolveAd, podElements, buffet, ads, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, adElement, ad, err, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, adElement1, ad1, err;
|
|
1236
1461
|
return _ts_generator(this, function(_state) {
|
|
1237
1462
|
switch(_state.label){
|
|
1238
1463
|
case 0:
|
|
@@ -1251,125 +1476,212 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1251
1476
|
[]
|
|
1252
1477
|
];
|
|
1253
1478
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
console.error("[HlsAdPlayer] Pod VAST XML parsing error (malformed). Content (first 2000 chars):", vastXml.substring(0, 2e3));
|
|
1479
|
+
xmlDoc = parseXml(vastXml);
|
|
1480
|
+
if (!xmlDoc) {
|
|
1481
|
+
console.error("[HlsAdPlayer] Pod VAST XML content (first 2000 chars):", vastXml.substring(0, 2e3));
|
|
1258
1482
|
return [
|
|
1259
1483
|
2,
|
|
1260
1484
|
[]
|
|
1261
1485
|
];
|
|
1262
1486
|
}
|
|
1263
|
-
|
|
1487
|
+
root = xmlDoc.documentElement;
|
|
1488
|
+
adElements = Array.from(root.querySelectorAll(":scope > Ad"));
|
|
1264
1489
|
if (adElements.length === 0) {
|
|
1265
|
-
|
|
1490
|
+
;
|
|
1491
|
+
;
|
|
1492
|
+
console.warn("[HlsAdPlayer] No <Ad> elements in VAST ".concat((_root_getAttribute1 = root.getAttribute("version")) !== null && _root_getAttribute1 !== void 0 ? _root_getAttribute1 : "", " pod response (no fill)"));
|
|
1493
|
+
empty = emptyVastResult(root);
|
|
1494
|
+
if (empty.type === "empty" && ((_empty_errorUrls = empty.errorUrls) === null || _empty_errorUrls === void 0 ? void 0 : _empty_errorUrls.length)) {
|
|
1495
|
+
;
|
|
1496
|
+
fireTrackingPixels(empty.errorUrls, {
|
|
1497
|
+
errorCode: (_empty_errorCode = empty.errorCode) !== null && _empty_errorCode !== void 0 ? _empty_errorCode : VAST_ERROR_WRAPPER_NO_ADS
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1266
1500
|
return [
|
|
1267
1501
|
2,
|
|
1268
1502
|
[]
|
|
1269
1503
|
];
|
|
1270
1504
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1505
|
+
resolveAd = function resolveAd(adElement) {
|
|
1506
|
+
return _async_to_generator(function() {
|
|
1507
|
+
var _parsed_errorUrls, parsed, _parsed_errorCode;
|
|
1508
|
+
return _ts_generator(this, function(_state) {
|
|
1509
|
+
parsed = parseAdElement(adElement);
|
|
1510
|
+
if (parsed.type === "inline") return [
|
|
1511
|
+
2,
|
|
1512
|
+
parsed.ad
|
|
1513
|
+
];
|
|
1514
|
+
if (parsed.type === "wrapper") {
|
|
1515
|
+
return [
|
|
1516
|
+
2,
|
|
1517
|
+
fetchAndParseVastAd(parsed.vastAdTagUri, 1, parsed.trackingUrls, parsed.rules)
|
|
1518
|
+
];
|
|
1519
|
+
}
|
|
1520
|
+
if ((_parsed_errorUrls = parsed.errorUrls) === null || _parsed_errorUrls === void 0 ? void 0 : _parsed_errorUrls.length) {
|
|
1521
|
+
;
|
|
1522
|
+
fireTrackingPixels(parsed.errorUrls, {
|
|
1523
|
+
errorCode: (_parsed_errorCode = parsed.errorCode) !== null && _parsed_errorCode !== void 0 ? _parsed_errorCode : VAST_ERROR_NO_SUPPORTED_MEDIA
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
return [
|
|
1527
|
+
2,
|
|
1528
|
+
null
|
|
1529
|
+
];
|
|
1530
|
+
});
|
|
1531
|
+
})();
|
|
1532
|
+
};
|
|
1533
|
+
podElements = adElements.filter(function(el) {
|
|
1534
|
+
return getAdSequence(el) !== void 0;
|
|
1535
|
+
}).sort(function(a, b) {
|
|
1536
|
+
return getAdSequence(a) - getAdSequence(b);
|
|
1537
|
+
});
|
|
1538
|
+
buffet = adElements.filter(function(el) {
|
|
1539
|
+
return getAdSequence(el) === void 0;
|
|
1277
1540
|
});
|
|
1278
1541
|
ads = [];
|
|
1542
|
+
if (!(podElements.length === 0)) return [
|
|
1543
|
+
3,
|
|
1544
|
+
10
|
|
1545
|
+
];
|
|
1279
1546
|
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1280
1547
|
_state.label = 2;
|
|
1281
1548
|
case 2:
|
|
1282
1549
|
_state.trys.push([
|
|
1283
1550
|
2,
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1551
|
+
7,
|
|
1552
|
+
8,
|
|
1553
|
+
9
|
|
1287
1554
|
]);
|
|
1288
|
-
_iterator =
|
|
1555
|
+
_iterator = buffet[Symbol.iterator]();
|
|
1289
1556
|
_state.label = 3;
|
|
1290
1557
|
case 3:
|
|
1291
1558
|
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
1292
1559
|
3,
|
|
1293
|
-
|
|
1560
|
+
6
|
|
1294
1561
|
];
|
|
1295
1562
|
adElement = _step.value;
|
|
1296
|
-
|
|
1297
|
-
|
|
1563
|
+
return [
|
|
1564
|
+
4,
|
|
1565
|
+
resolveAd(adElement)
|
|
1566
|
+
];
|
|
1567
|
+
case 4:
|
|
1568
|
+
ad = _state.sent();
|
|
1569
|
+
if (ad) ads.push(ad);
|
|
1570
|
+
_state.label = 5;
|
|
1571
|
+
case 5:
|
|
1572
|
+
_iteratorNormalCompletion = true;
|
|
1573
|
+
return [
|
|
1298
1574
|
3,
|
|
1299
|
-
|
|
1575
|
+
3
|
|
1300
1576
|
];
|
|
1301
|
-
|
|
1577
|
+
case 6:
|
|
1302
1578
|
return [
|
|
1303
1579
|
3,
|
|
1304
|
-
|
|
1580
|
+
9
|
|
1305
1581
|
];
|
|
1306
|
-
case
|
|
1307
|
-
|
|
1582
|
+
case 7:
|
|
1583
|
+
err = _state.sent();
|
|
1584
|
+
_didIteratorError = true;
|
|
1585
|
+
_iteratorError = err;
|
|
1586
|
+
return [
|
|
1308
1587
|
3,
|
|
1309
|
-
|
|
1588
|
+
9
|
|
1310
1589
|
];
|
|
1311
|
-
|
|
1312
|
-
|
|
1590
|
+
case 8:
|
|
1591
|
+
try {
|
|
1592
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1593
|
+
_iterator.return();
|
|
1594
|
+
}
|
|
1595
|
+
} finally{
|
|
1596
|
+
if (_didIteratorError) {
|
|
1597
|
+
throw _iteratorError;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
return [
|
|
1601
|
+
7
|
|
1602
|
+
];
|
|
1603
|
+
case 9:
|
|
1604
|
+
return [
|
|
1605
|
+
3,
|
|
1606
|
+
21
|
|
1607
|
+
];
|
|
1608
|
+
case 10:
|
|
1609
|
+
_iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
1610
|
+
_state.label = 11;
|
|
1611
|
+
case 11:
|
|
1313
1612
|
_state.trys.push([
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
,
|
|
1317
|
-
|
|
1613
|
+
11,
|
|
1614
|
+
19,
|
|
1615
|
+
20,
|
|
1616
|
+
21
|
|
1318
1617
|
]);
|
|
1618
|
+
_iterator1 = podElements[Symbol.iterator]();
|
|
1619
|
+
_state.label = 12;
|
|
1620
|
+
case 12:
|
|
1621
|
+
if (!!(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done)) return [
|
|
1622
|
+
3,
|
|
1623
|
+
18
|
|
1624
|
+
];
|
|
1625
|
+
adElement1 = _step1.value;
|
|
1319
1626
|
return [
|
|
1320
1627
|
4,
|
|
1321
|
-
|
|
1628
|
+
resolveAd(adElement1)
|
|
1629
|
+
];
|
|
1630
|
+
case 13:
|
|
1631
|
+
ad1 = _state.sent();
|
|
1632
|
+
_state.label = 14;
|
|
1633
|
+
case 14:
|
|
1634
|
+
if (!(!ad1 && buffet.length > 0)) return [
|
|
1635
|
+
3,
|
|
1636
|
+
16
|
|
1322
1637
|
];
|
|
1323
|
-
case 6:
|
|
1324
|
-
resolved = _state.sent();
|
|
1325
|
-
if (resolved) {
|
|
1326
|
-
ads.push(resolved);
|
|
1327
|
-
}
|
|
1328
1638
|
return [
|
|
1329
|
-
|
|
1330
|
-
|
|
1639
|
+
4,
|
|
1640
|
+
resolveAd(buffet.shift())
|
|
1331
1641
|
];
|
|
1332
|
-
case
|
|
1333
|
-
|
|
1334
|
-
console.warn("[HlsAdPlayer] Failed to resolve wrapper <Ad> in pod:", error);
|
|
1642
|
+
case 15:
|
|
1643
|
+
ad1 = _state.sent();
|
|
1335
1644
|
return [
|
|
1336
1645
|
3,
|
|
1337
|
-
|
|
1646
|
+
14
|
|
1338
1647
|
];
|
|
1339
|
-
case
|
|
1340
|
-
|
|
1648
|
+
case 16:
|
|
1649
|
+
if (ad1) ads.push(ad1);
|
|
1650
|
+
_state.label = 17;
|
|
1651
|
+
case 17:
|
|
1652
|
+
_iteratorNormalCompletion1 = true;
|
|
1341
1653
|
return [
|
|
1342
1654
|
3,
|
|
1343
|
-
|
|
1655
|
+
12
|
|
1344
1656
|
];
|
|
1345
|
-
case
|
|
1657
|
+
case 18:
|
|
1346
1658
|
return [
|
|
1347
1659
|
3,
|
|
1348
|
-
|
|
1660
|
+
21
|
|
1349
1661
|
];
|
|
1350
|
-
case
|
|
1662
|
+
case 19:
|
|
1351
1663
|
err = _state.sent();
|
|
1352
|
-
|
|
1353
|
-
|
|
1664
|
+
_didIteratorError1 = true;
|
|
1665
|
+
_iteratorError1 = err;
|
|
1354
1666
|
return [
|
|
1355
1667
|
3,
|
|
1356
|
-
|
|
1668
|
+
21
|
|
1357
1669
|
];
|
|
1358
|
-
case
|
|
1670
|
+
case 20:
|
|
1359
1671
|
try {
|
|
1360
|
-
if (!
|
|
1361
|
-
|
|
1672
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
1673
|
+
_iterator1.return();
|
|
1362
1674
|
}
|
|
1363
1675
|
} finally{
|
|
1364
|
-
if (
|
|
1365
|
-
throw
|
|
1676
|
+
if (_didIteratorError1) {
|
|
1677
|
+
throw _iteratorError1;
|
|
1366
1678
|
}
|
|
1367
1679
|
}
|
|
1368
1680
|
return [
|
|
1369
1681
|
7
|
|
1370
1682
|
];
|
|
1371
|
-
case
|
|
1372
|
-
console.log("[HlsAdPlayer] Parsed ".concat(ads.length, " ad(s) from pod
|
|
1683
|
+
case 21:
|
|
1684
|
+
console.log("[HlsAdPlayer] Parsed ".concat(ads.length, " ad(s) from VAST ").concat((_root_getAttribute = root.getAttribute("version")) !== null && _root_getAttribute !== void 0 ? _root_getAttribute : "", " pod response"));
|
|
1373
1685
|
return [
|
|
1374
1686
|
2,
|
|
1375
1687
|
ads
|
|
@@ -1399,7 +1711,40 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1399
1711
|
var onTimeUpdate = function onTimeUpdate() {
|
|
1400
1712
|
if (!currentAd || !adVideoElement) return;
|
|
1401
1713
|
noteAdProgress();
|
|
1402
|
-
|
|
1714
|
+
sampleViewability();
|
|
1715
|
+
var currentTime = adVideoElement.currentTime;
|
|
1716
|
+
if (trackingFired.start) {
|
|
1717
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1718
|
+
try {
|
|
1719
|
+
for(var _iterator = currentAd.trackingUrls.progress[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1720
|
+
var event = _step.value;
|
|
1721
|
+
var _event_offsetSeconds, _event_offsetPercent;
|
|
1722
|
+
if (trackingFired.progressFired.has(event)) continue;
|
|
1723
|
+
var threshold = (_event_offsetSeconds = event.offsetSeconds) !== null && _event_offsetSeconds !== void 0 ? _event_offsetSeconds : ((_event_offsetPercent = event.offsetPercent) !== null && _event_offsetPercent !== void 0 ? _event_offsetPercent : 0) / 100 * currentAd.duration;
|
|
1724
|
+
if (currentTime >= threshold) {
|
|
1725
|
+
trackingFired.progressFired.add(event);
|
|
1726
|
+
fireTrackingPixels([
|
|
1727
|
+
event.url
|
|
1728
|
+
]);
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
} catch (err) {
|
|
1732
|
+
_didIteratorError = true;
|
|
1733
|
+
_iteratorError = err;
|
|
1734
|
+
} finally{
|
|
1735
|
+
try {
|
|
1736
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1737
|
+
_iterator.return();
|
|
1738
|
+
}
|
|
1739
|
+
} finally{
|
|
1740
|
+
if (_didIteratorError) {
|
|
1741
|
+
throw _iteratorError;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
if (!(currentAd.duration > 0)) return;
|
|
1747
|
+
var progress = currentTime / currentAd.duration;
|
|
1403
1748
|
if (progress >= 0.25 && !trackingFired.firstQuartile) {
|
|
1404
1749
|
trackingFired.firstQuartile = true;
|
|
1405
1750
|
fireTrackingPixels(currentAd.trackingUrls.firstQuartile);
|
|
@@ -1421,15 +1766,38 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1421
1766
|
handleVideoDecodeFailure();
|
|
1422
1767
|
}
|
|
1423
1768
|
};
|
|
1769
|
+
var onCanPlay = function onCanPlay() {
|
|
1770
|
+
if (!currentAd || trackingFired.loaded) return;
|
|
1771
|
+
trackingFired.loaded = true;
|
|
1772
|
+
fireTrackingPixels(currentAd.trackingUrls.loaded);
|
|
1773
|
+
};
|
|
1424
1774
|
var onPlaying = function onPlaying() {
|
|
1425
1775
|
startStallWatchdog();
|
|
1426
|
-
if (!currentAd ||
|
|
1776
|
+
if (!currentAd || !adVideoElement) return;
|
|
1777
|
+
if (!trackingFired.impression) {
|
|
1778
|
+
trackingFired.impression = true;
|
|
1779
|
+
resolvedAds.add(currentAd);
|
|
1780
|
+
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1781
|
+
fireTrackingPixels(currentAd.trackingUrls.creativeView);
|
|
1782
|
+
fireTrackingPixels(currentAd.trackingUrls.verificationNotExecuted, {
|
|
1783
|
+
reason: VERIFICATION_NOT_SUPPORTED_REASON
|
|
1784
|
+
});
|
|
1785
|
+
emit("ad_impression", {
|
|
1786
|
+
adId: currentAd.id,
|
|
1787
|
+
index: podIndex,
|
|
1788
|
+
total: podAds.length || 1
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
if (trackingFired.start) return;
|
|
1427
1792
|
trackingFired.start = true;
|
|
1793
|
+
trackingFired.lastMuted = adVideoElement.muted || adVideoElement.volume === 0;
|
|
1428
1794
|
fireTrackingPixels(currentAd.trackingUrls.start);
|
|
1429
1795
|
console.log("[HlsAdPlayer] Ad started playing");
|
|
1430
1796
|
};
|
|
1431
1797
|
var onEnded = function onEnded() {
|
|
1432
1798
|
if (!currentAd || trackingFired.complete) return;
|
|
1799
|
+
sampleViewability();
|
|
1800
|
+
settleViewability();
|
|
1433
1801
|
trackingFired.complete = true;
|
|
1434
1802
|
fireTrackingPixels(currentAd.trackingUrls.complete);
|
|
1435
1803
|
console.log("[HlsAdPlayer] Ad completed");
|
|
@@ -1441,11 +1809,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1441
1809
|
var onError = function onError(e) {
|
|
1442
1810
|
if (!adPlaying) return;
|
|
1443
1811
|
console.error("[HlsAdPlayer] Ad video error:", e);
|
|
1444
|
-
|
|
1445
|
-
fireTrackingPixels(currentAd.trackingUrls.error, {
|
|
1446
|
-
errorCode: toVastMediaErrorCode(adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.error)
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1812
|
+
reportCurrentAdError(toVastMediaErrorCode(adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.error));
|
|
1449
1813
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
1450
1814
|
return;
|
|
1451
1815
|
}
|
|
@@ -1453,19 +1817,26 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1453
1817
|
};
|
|
1454
1818
|
var onVolumeChange = function onVolumeChange() {
|
|
1455
1819
|
if (!currentAd || !adVideoElement) return;
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1820
|
+
var muted = adVideoElement.muted || adVideoElement.volume === 0;
|
|
1821
|
+
if (!trackingFired.start) {
|
|
1822
|
+
trackingFired.lastMuted = muted;
|
|
1823
|
+
return;
|
|
1460
1824
|
}
|
|
1825
|
+
if (muted === trackingFired.lastMuted) return;
|
|
1826
|
+
trackingFired.lastMuted = muted;
|
|
1827
|
+
fireTrackingPixels(muted ? currentAd.trackingUrls.mute : currentAd.trackingUrls.unmute);
|
|
1828
|
+
};
|
|
1829
|
+
var isTrackablePlayback = function isTrackablePlayback() {
|
|
1830
|
+
return adPlaying && !!currentAd && !!adVideoElement && trackingFired.start && !trackingFired.complete && !adVideoElement.ended;
|
|
1461
1831
|
};
|
|
1462
1832
|
var onPause = function onPause() {
|
|
1463
|
-
|
|
1833
|
+
continuousVisibleS = 0;
|
|
1834
|
+
if (isTrackablePlayback()) {
|
|
1464
1835
|
fireTrackingPixels(currentAd.trackingUrls.pause);
|
|
1465
1836
|
}
|
|
1466
1837
|
};
|
|
1467
1838
|
var onPlay = function onPlay() {
|
|
1468
|
-
if (
|
|
1839
|
+
if (isTrackablePlayback()) {
|
|
1469
1840
|
fireTrackingPixels(currentAd.trackingUrls.resume);
|
|
1470
1841
|
}
|
|
1471
1842
|
};
|
|
@@ -1478,6 +1849,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1478
1849
|
type: "loadedmetadata",
|
|
1479
1850
|
handler: onLoadedMetadata
|
|
1480
1851
|
},
|
|
1852
|
+
{
|
|
1853
|
+
type: "canplay",
|
|
1854
|
+
handler: onCanPlay
|
|
1855
|
+
},
|
|
1481
1856
|
{
|
|
1482
1857
|
type: "playing",
|
|
1483
1858
|
handler: onPlaying
|
|
@@ -1549,6 +1924,229 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1549
1924
|
}
|
|
1550
1925
|
adEventHandlers = [];
|
|
1551
1926
|
}
|
|
1927
|
+
function handleAdClick() {
|
|
1928
|
+
if (!adPlaying || !currentAd) return;
|
|
1929
|
+
fireTrackingPixels(currentAd.trackingUrls.clickTracking);
|
|
1930
|
+
emit("ad_click", {
|
|
1931
|
+
adId: currentAd.id,
|
|
1932
|
+
clickThrough: currentAd.clickThrough
|
|
1933
|
+
});
|
|
1934
|
+
if (currentAd.clickThrough) {
|
|
1935
|
+
try {
|
|
1936
|
+
window.open(currentAd.clickThrough, "_blank", "noopener");
|
|
1937
|
+
} catch (error) {
|
|
1938
|
+
console.warn("[HlsAdPlayer] Failed to open ClickThrough URL:", error);
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
function reportCurrentAdError(errorCode) {
|
|
1943
|
+
if (!currentAd) return;
|
|
1944
|
+
resolvedAds.add(currentAd);
|
|
1945
|
+
fireTrackingPixels(currentAd.trackingUrls.error, {
|
|
1946
|
+
errorCode: errorCode
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
function fireNotUsedForUnplayedAds() {
|
|
1950
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1951
|
+
try {
|
|
1952
|
+
for(var _iterator = podAds[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1953
|
+
var ad = _step.value;
|
|
1954
|
+
if (resolvedAds.has(ad)) continue;
|
|
1955
|
+
resolvedAds.add(ad);
|
|
1956
|
+
fireTrackingPixels(ad.trackingUrls.notUsed, {
|
|
1957
|
+
ad: ad
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
} catch (err) {
|
|
1961
|
+
_didIteratorError = true;
|
|
1962
|
+
_iteratorError = err;
|
|
1963
|
+
} finally{
|
|
1964
|
+
try {
|
|
1965
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1966
|
+
_iterator.return();
|
|
1967
|
+
}
|
|
1968
|
+
} finally{
|
|
1969
|
+
if (_didIteratorError) {
|
|
1970
|
+
throw _iteratorError;
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
function sampleViewability() {
|
|
1976
|
+
if (!currentAd || !adVideoElement || !viewObserver || !trackingFired.impression || trackingFired.viewabilitySettled) {
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
var now = adVideoElement.currentTime;
|
|
1980
|
+
var inView = visibleRatio >= VIEWABLE_MIN_VISIBLE_RATIO && document.visibilityState === "visible" && !adVideoElement.paused;
|
|
1981
|
+
if (!inView) {
|
|
1982
|
+
continuousVisibleS = 0;
|
|
1983
|
+
} else if (lastViewSampleTime !== void 0 && now >= lastViewSampleTime) {
|
|
1984
|
+
continuousVisibleS += now - lastViewSampleTime;
|
|
1985
|
+
}
|
|
1986
|
+
lastViewSampleTime = now;
|
|
1987
|
+
if (continuousVisibleS >= VIEWABLE_MIN_CONTINUOUS_S) {
|
|
1988
|
+
trackingFired.viewabilitySettled = true;
|
|
1989
|
+
fireTrackingPixels(currentAd.trackingUrls.viewable);
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
function settleViewability() {
|
|
1993
|
+
if (!currentAd || !trackingFired.impression || trackingFired.viewabilitySettled) {
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1996
|
+
trackingFired.viewabilitySettled = true;
|
|
1997
|
+
fireTrackingPixels(viewObserver ? currentAd.trackingUrls.notViewable : currentAd.trackingUrls.viewUndetermined);
|
|
1998
|
+
}
|
|
1999
|
+
function handleFullscreenChange() {
|
|
2000
|
+
var _document_fullscreenElement;
|
|
2001
|
+
if (!adPlaying || !currentAd || !adContainerEl || !trackingFired.start) return;
|
|
2002
|
+
var fullscreenEl = (_document_fullscreenElement = document.fullscreenElement) !== null && _document_fullscreenElement !== void 0 ? _document_fullscreenElement : document.webkitFullscreenElement;
|
|
2003
|
+
var expanded = !!fullscreenEl && fullscreenEl.contains(adContainerEl);
|
|
2004
|
+
if (expanded === lastPlayerExpanded) return;
|
|
2005
|
+
lastPlayerExpanded = expanded;
|
|
2006
|
+
var urls = currentAd.trackingUrls;
|
|
2007
|
+
fireTrackingPixels(expanded ? urls.fullscreen.concat(urls.playerExpand) : urls.exitFullscreen.concat(urls.playerCollapse));
|
|
2008
|
+
}
|
|
2009
|
+
function attachContainerHandlers() {
|
|
2010
|
+
if (!adContainerEl || containerHandlers.length > 0) return;
|
|
2011
|
+
var onClick = function onClick() {
|
|
2012
|
+
return handleAdClick();
|
|
2013
|
+
};
|
|
2014
|
+
var onInteraction = function onInteraction(event) {
|
|
2015
|
+
if (adPlaying) emit("ad_interaction", event);
|
|
2016
|
+
};
|
|
2017
|
+
containerHandlers = [
|
|
2018
|
+
{
|
|
2019
|
+
type: "click",
|
|
2020
|
+
handler: onClick
|
|
2021
|
+
},
|
|
2022
|
+
{
|
|
2023
|
+
type: "mousedown",
|
|
2024
|
+
handler: onInteraction
|
|
2025
|
+
},
|
|
2026
|
+
{
|
|
2027
|
+
type: "touchstart",
|
|
2028
|
+
handler: onInteraction
|
|
2029
|
+
}
|
|
2030
|
+
];
|
|
2031
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2032
|
+
try {
|
|
2033
|
+
for(var _iterator = containerHandlers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2034
|
+
var _step_value = _step.value, type = _step_value.type, handler = _step_value.handler;
|
|
2035
|
+
adContainerEl.addEventListener(type, handler);
|
|
2036
|
+
}
|
|
2037
|
+
} catch (err) {
|
|
2038
|
+
_didIteratorError = true;
|
|
2039
|
+
_iteratorError = err;
|
|
2040
|
+
} finally{
|
|
2041
|
+
try {
|
|
2042
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2043
|
+
_iterator.return();
|
|
2044
|
+
}
|
|
2045
|
+
} finally{
|
|
2046
|
+
if (_didIteratorError) {
|
|
2047
|
+
throw _iteratorError;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
var onFullscreenChange = function onFullscreenChange() {
|
|
2052
|
+
return handleFullscreenChange();
|
|
2053
|
+
};
|
|
2054
|
+
documentHandlers = [
|
|
2055
|
+
{
|
|
2056
|
+
type: "fullscreenchange",
|
|
2057
|
+
handler: onFullscreenChange
|
|
2058
|
+
},
|
|
2059
|
+
{
|
|
2060
|
+
type: "webkitfullscreenchange",
|
|
2061
|
+
handler: onFullscreenChange
|
|
2062
|
+
}
|
|
2063
|
+
];
|
|
2064
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
2065
|
+
try {
|
|
2066
|
+
for(var _iterator1 = documentHandlers[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2067
|
+
var _step_value1 = _step1.value, type1 = _step_value1.type, handler1 = _step_value1.handler;
|
|
2068
|
+
document.addEventListener(type1, handler1);
|
|
2069
|
+
}
|
|
2070
|
+
} catch (err) {
|
|
2071
|
+
_didIteratorError1 = true;
|
|
2072
|
+
_iteratorError1 = err;
|
|
2073
|
+
} finally{
|
|
2074
|
+
try {
|
|
2075
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
2076
|
+
_iterator1.return();
|
|
2077
|
+
}
|
|
2078
|
+
} finally{
|
|
2079
|
+
if (_didIteratorError1) {
|
|
2080
|
+
throw _iteratorError1;
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
if (typeof IntersectionObserver !== "undefined") {
|
|
2085
|
+
viewObserver = new IntersectionObserver(function(entries) {
|
|
2086
|
+
var entry = entries[entries.length - 1];
|
|
2087
|
+
if (entry) {
|
|
2088
|
+
visibleRatio = entry.isIntersecting ? entry.intersectionRatio : 0;
|
|
2089
|
+
}
|
|
2090
|
+
}, {
|
|
2091
|
+
threshold: [
|
|
2092
|
+
0,
|
|
2093
|
+
0.25,
|
|
2094
|
+
0.5,
|
|
2095
|
+
0.75,
|
|
2096
|
+
1
|
|
2097
|
+
]
|
|
2098
|
+
});
|
|
2099
|
+
viewObserver.observe(adContainerEl);
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
function detachContainerHandlers() {
|
|
2103
|
+
if (adContainerEl) {
|
|
2104
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2105
|
+
try {
|
|
2106
|
+
for(var _iterator = containerHandlers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2107
|
+
var _step_value = _step.value, type = _step_value.type, handler = _step_value.handler;
|
|
2108
|
+
adContainerEl.removeEventListener(type, handler);
|
|
2109
|
+
}
|
|
2110
|
+
} catch (err) {
|
|
2111
|
+
_didIteratorError = true;
|
|
2112
|
+
_iteratorError = err;
|
|
2113
|
+
} finally{
|
|
2114
|
+
try {
|
|
2115
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2116
|
+
_iterator.return();
|
|
2117
|
+
}
|
|
2118
|
+
} finally{
|
|
2119
|
+
if (_didIteratorError) {
|
|
2120
|
+
throw _iteratorError;
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
containerHandlers = [];
|
|
2126
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
2127
|
+
try {
|
|
2128
|
+
for(var _iterator1 = documentHandlers[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2129
|
+
var _step_value1 = _step1.value, type1 = _step_value1.type, handler1 = _step_value1.handler;
|
|
2130
|
+
document.removeEventListener(type1, handler1);
|
|
2131
|
+
}
|
|
2132
|
+
} catch (err) {
|
|
2133
|
+
_didIteratorError1 = true;
|
|
2134
|
+
_iteratorError1 = err;
|
|
2135
|
+
} finally{
|
|
2136
|
+
try {
|
|
2137
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
2138
|
+
_iterator1.return();
|
|
2139
|
+
}
|
|
2140
|
+
} finally{
|
|
2141
|
+
if (_didIteratorError1) {
|
|
2142
|
+
throw _iteratorError1;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
documentHandlers = [];
|
|
2147
|
+
viewObserver === null || viewObserver === void 0 ? void 0 : viewObserver.disconnect();
|
|
2148
|
+
viewObserver = void 0;
|
|
2149
|
+
}
|
|
1552
2150
|
function setAdPlayingFlag(isPlaying) {
|
|
1553
2151
|
if (isPlaying) {
|
|
1554
2152
|
contentVideo.dataset.stormcloudAdPlaying = "true";
|
|
@@ -1556,15 +2154,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1556
2154
|
delete contentVideo.dataset.stormcloudAdPlaying;
|
|
1557
2155
|
}
|
|
1558
2156
|
}
|
|
1559
|
-
function
|
|
1560
|
-
trackingFired =
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
firstQuartile: false,
|
|
1564
|
-
midpoint: false,
|
|
1565
|
-
thirdQuartile: false,
|
|
1566
|
-
complete: false
|
|
1567
|
-
};
|
|
2157
|
+
function resetAdTracking() {
|
|
2158
|
+
trackingFired = createTrackingState();
|
|
2159
|
+
continuousVisibleS = 0;
|
|
2160
|
+
lastViewSampleTime = void 0;
|
|
1568
2161
|
}
|
|
1569
2162
|
function isRvfcSupported(video) {
|
|
1570
2163
|
return typeof video.requestVideoFrameCallback === "function";
|
|
@@ -1631,21 +2224,21 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1631
2224
|
currentAdMediaFile = mediaFile;
|
|
1632
2225
|
var isHlsAd = isHlsMediaFile(mediaFile);
|
|
1633
2226
|
console.log("[HlsAdPlayer] Loading ".concat(isHlsAd ? "HLS" : "progressive", " ad (pod ").concat(podIndex + 1, "/").concat(podAds.length || 1, ") from: ").concat(mediaFile.url));
|
|
1634
|
-
if (isHlsAd &&
|
|
2227
|
+
if (isHlsAd && import_hls.default.isSupported()) {
|
|
1635
2228
|
if (adHls) {
|
|
1636
2229
|
adHls.destroy();
|
|
1637
2230
|
}
|
|
1638
|
-
adHls = new
|
|
2231
|
+
adHls = new import_hls.default({
|
|
1639
2232
|
enableWorker: true,
|
|
1640
2233
|
lowLatencyMode: false
|
|
1641
2234
|
});
|
|
1642
2235
|
adHls.loadSource(mediaFile.url);
|
|
1643
2236
|
adHls.attachMedia(adVideoElement);
|
|
1644
|
-
adHls.on(
|
|
2237
|
+
adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
|
|
1645
2238
|
console.log("[HlsAdPlayer] HLS manifest parsed, starting playback");
|
|
1646
2239
|
startAdPlayback("HLS ad playback");
|
|
1647
2240
|
});
|
|
1648
|
-
adHls.on(
|
|
2241
|
+
adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
|
|
1649
2242
|
console.error("[HlsAdPlayer] HLS error:", data);
|
|
1650
2243
|
if (data.fatal) {
|
|
1651
2244
|
handleAdError();
|
|
@@ -1670,13 +2263,12 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1670
2263
|
if (podIndex >= podAds.length - 1) {
|
|
1671
2264
|
return false;
|
|
1672
2265
|
}
|
|
2266
|
+
settleViewability();
|
|
1673
2267
|
podIndex++;
|
|
1674
2268
|
currentAd = podAds[podIndex];
|
|
1675
2269
|
currentAdMediaFile = void 0;
|
|
1676
|
-
|
|
2270
|
+
resetAdTracking();
|
|
1677
2271
|
if (currentAd) {
|
|
1678
|
-
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1679
|
-
trackingFired.impression = true;
|
|
1680
2272
|
console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
|
|
1681
2273
|
}
|
|
1682
2274
|
clearStallWatchdog();
|
|
@@ -1714,11 +2306,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1714
2306
|
function handleAdStall() {
|
|
1715
2307
|
console.warn("[HlsAdPlayer] Ad playback stalled (no progress) - recovering to avoid a blank frame");
|
|
1716
2308
|
clearStallWatchdog();
|
|
1717
|
-
|
|
1718
|
-
fireTrackingPixels(currentAd.trackingUrls.error, {
|
|
1719
|
-
errorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
1720
|
-
});
|
|
1721
|
-
}
|
|
2309
|
+
reportCurrentAdError(VAST_ERROR_MEDIA_DISPLAY);
|
|
1722
2310
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
1723
2311
|
return;
|
|
1724
2312
|
}
|
|
@@ -1784,11 +2372,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1784
2372
|
function handleVideoDecodeFailure() {
|
|
1785
2373
|
console.warn("[HlsAdPlayer] Ad audio is advancing but no video frames decoded (black screen) - skipping this creative");
|
|
1786
2374
|
clearStallWatchdog();
|
|
1787
|
-
|
|
1788
|
-
fireTrackingPixels(currentAd.trackingUrls.error, {
|
|
1789
|
-
errorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
1790
|
-
});
|
|
1791
|
-
}
|
|
2375
|
+
reportCurrentAdError(VAST_ERROR_MEDIA_DISPLAY);
|
|
1792
2376
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
1793
2377
|
return;
|
|
1794
2378
|
}
|
|
@@ -1843,6 +2427,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1843
2427
|
}
|
|
1844
2428
|
function handleAdComplete() {
|
|
1845
2429
|
console.log("[HlsAdPlayer] Handling ad completion");
|
|
2430
|
+
settleViewability();
|
|
1846
2431
|
clearStallWatchdog();
|
|
1847
2432
|
adPlaying = false;
|
|
1848
2433
|
setAdPlayingFlag(false);
|
|
@@ -1866,6 +2451,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1866
2451
|
}
|
|
1867
2452
|
function handleAdError() {
|
|
1868
2453
|
console.log("[HlsAdPlayer] Handling ad error");
|
|
2454
|
+
settleViewability();
|
|
1869
2455
|
clearStallWatchdog();
|
|
1870
2456
|
adPlaying = false;
|
|
1871
2457
|
setAdPlayingFlag(false);
|
|
@@ -1898,6 +2484,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1898
2484
|
adContainerEl = container;
|
|
1899
2485
|
}
|
|
1900
2486
|
contentVideo[AD_CONTAINER_PROP] = adContainerEl;
|
|
2487
|
+
attachContainerHandlers();
|
|
1901
2488
|
},
|
|
1902
2489
|
requestAds: function requestAds(vastTagUrl) {
|
|
1903
2490
|
return _async_to_generator(function() {
|
|
@@ -1960,10 +2547,6 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1960
2547
|
currentAd = ads[0];
|
|
1961
2548
|
currentAdMediaFile = void 0;
|
|
1962
2549
|
console.log("[HlsAdPlayer] Pod parsed: ".concat(ads.length, ' ad(s), first="').concat(currentAd === null || currentAd === void 0 ? void 0 : currentAd.title, '", duration=').concat(currentAd === null || currentAd === void 0 ? void 0 : currentAd.duration, "s"));
|
|
1963
|
-
if (currentAd) {
|
|
1964
|
-
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1965
|
-
trackingFired.impression = true;
|
|
1966
|
-
}
|
|
1967
2550
|
return [
|
|
1968
2551
|
2,
|
|
1969
2552
|
Promise.resolve()
|
|
@@ -2003,7 +2586,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2003
2586
|
contentVideo[AD_VIDEO_PROP] = adVideoElement;
|
|
2004
2587
|
}
|
|
2005
2588
|
setupAdEventListeners();
|
|
2006
|
-
|
|
2589
|
+
resetAdTracking();
|
|
2007
2590
|
contentVolume = contentVideo.volume;
|
|
2008
2591
|
originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
|
|
2009
2592
|
if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
@@ -2074,6 +2657,8 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2074
2657
|
var previousMutedState;
|
|
2075
2658
|
return _ts_generator(this, function(_state) {
|
|
2076
2659
|
console.log("[HlsAdPlayer] Stopping ad");
|
|
2660
|
+
settleViewability();
|
|
2661
|
+
fireNotUsedForUnplayedAds();
|
|
2077
2662
|
clearStallWatchdog();
|
|
2078
2663
|
adPlaying = false;
|
|
2079
2664
|
setAdPlayingFlag(false);
|
|
@@ -2104,6 +2689,8 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2104
2689
|
},
|
|
2105
2690
|
destroy: function destroy() {
|
|
2106
2691
|
console.log("[HlsAdPlayer] Destroying");
|
|
2692
|
+
settleViewability();
|
|
2693
|
+
fireNotUsedForUnplayedAds();
|
|
2107
2694
|
destroyed = true;
|
|
2108
2695
|
clearStallWatchdog();
|
|
2109
2696
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -2132,6 +2719,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2132
2719
|
contentVideo.muted = originalMutedState;
|
|
2133
2720
|
contentVideo.volume = Math.max(0, Math.min(1, originalVolume));
|
|
2134
2721
|
teardownAdEventListeners();
|
|
2722
|
+
detachContainerHandlers();
|
|
2135
2723
|
releaseAdDecoder();
|
|
2136
2724
|
currentAd = void 0;
|
|
2137
2725
|
currentAdMediaFile = void 0;
|
|
@@ -2277,6 +2865,7 @@ function toDevSafeUrl(rawUrl) {
|
|
|
2277
2865
|
// src/sdk/pal.ts
|
|
2278
2866
|
var PAL_SDK_URL = "https://imasdk.googleapis.com/pal/sdkloader/pal.js";
|
|
2279
2867
|
var _nonceLoader;
|
|
2868
|
+
var _nonceLoaderAllowStorage;
|
|
2280
2869
|
var _palLoadPromise;
|
|
2281
2870
|
function loadPalSdk() {
|
|
2282
2871
|
var _window_goog;
|
|
@@ -2319,12 +2908,15 @@ function loadPalSdk() {
|
|
|
2319
2908
|
});
|
|
2320
2909
|
return _palLoadPromise;
|
|
2321
2910
|
}
|
|
2322
|
-
function getOrCreateNonceLoader() {
|
|
2323
|
-
if (_nonceLoader)
|
|
2911
|
+
function getOrCreateNonceLoader(allowStorage) {
|
|
2912
|
+
if (_nonceLoader && _nonceLoaderAllowStorage === allowStorage) {
|
|
2913
|
+
return _nonceLoader;
|
|
2914
|
+
}
|
|
2324
2915
|
var goog = window.goog;
|
|
2325
2916
|
var consentSettings = new goog.pal.ConsentSettings();
|
|
2326
|
-
consentSettings.allowStorage =
|
|
2917
|
+
consentSettings.allowStorage = allowStorage;
|
|
2327
2918
|
_nonceLoader = new goog.pal.NonceLoader(consentSettings);
|
|
2919
|
+
_nonceLoaderAllowStorage = allowStorage;
|
|
2328
2920
|
return _nonceLoader;
|
|
2329
2921
|
}
|
|
2330
2922
|
function createPalNonceManager() {
|
|
@@ -2333,7 +2925,7 @@ function createPalNonceManager() {
|
|
|
2333
2925
|
return {
|
|
2334
2926
|
generateNonce: function generateNonce() {
|
|
2335
2927
|
return _async_to_generator(function() {
|
|
2336
|
-
var options, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
|
|
2928
|
+
var options, _options_allowStorage, _options_adWillAutoPlay, _options_adWillPlayMuted, _options_playerVolume, _options_continuousPlayback, loader, goog, request, manager, error;
|
|
2337
2929
|
var _arguments = arguments;
|
|
2338
2930
|
return _ts_generator(this, function(_state) {
|
|
2339
2931
|
switch(_state.label){
|
|
@@ -2353,7 +2945,7 @@ function createPalNonceManager() {
|
|
|
2353
2945
|
];
|
|
2354
2946
|
case 2:
|
|
2355
2947
|
_state.sent();
|
|
2356
|
-
loader = getOrCreateNonceLoader();
|
|
2948
|
+
loader = getOrCreateNonceLoader((_options_allowStorage = options.allowStorage) !== null && _options_allowStorage !== void 0 ? _options_allowStorage : true);
|
|
2357
2949
|
goog = window.goog;
|
|
2358
2950
|
request = new goog.pal.NonceRequest();
|
|
2359
2951
|
request.adWillAutoPlay = (_options_adWillAutoPlay = options.adWillAutoPlay) !== null && _options_adWillAutoPlay !== void 0 ? _options_adWillAutoPlay : true;
|
|
@@ -2464,12 +3056,6 @@ var DEFAULT_TRACKING_INGEST_CONFIG = {
|
|
|
2464
3056
|
baseUrl: "https://player-analytics-ingest-api-760490581852.us-central1.run.app/api/adstorm/player-tracking"
|
|
2465
3057
|
};
|
|
2466
3058
|
var trackingIngestConfig = _object_spread({}, DEFAULT_TRACKING_INGEST_CONFIG);
|
|
2467
|
-
function applyTrackingIngestConfig(overrides) {
|
|
2468
|
-
Object.assign(trackingIngestConfig, overrides);
|
|
2469
|
-
}
|
|
2470
|
-
function configureTrackingIngest(overrides) {
|
|
2471
|
-
applyTrackingIngestConfig(overrides);
|
|
2472
|
-
}
|
|
2473
3059
|
function isTrackingIngestEnabled() {
|
|
2474
3060
|
return trackingIngestConfig.enabled === true;
|
|
2475
3061
|
}
|
|
@@ -2544,6 +3130,8 @@ function ingestPlayerTracking(licenseKey, channel, body) {
|
|
|
2544
3130
|
}
|
|
2545
3131
|
// src/utils/vastEnvironmentSignals.ts
|
|
2546
3132
|
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
3133
|
+
var WEB_SESSION_STORAGE_KEY = "stormcloud.web.sid";
|
|
3134
|
+
var inMemoryWebSessionId;
|
|
2547
3135
|
var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
|
|
2548
3136
|
var DEVICE_ID_STORAGE_KEYS = [
|
|
2549
3137
|
"rdid",
|
|
@@ -2565,7 +3153,7 @@ function resolveVastEnvironmentSignals(isCtv) {
|
|
|
2565
3153
|
var _ref;
|
|
2566
3154
|
var bridgeSignals = readNativeBridgeSignals();
|
|
2567
3155
|
var platformDevice = readPlatformNativeDeviceId();
|
|
2568
|
-
var realDeviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId;
|
|
3156
|
+
var realDeviceId = bridgeSignals.deviceId || (isCtv ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
|
|
2569
3157
|
var deviceId = realDeviceId;
|
|
2570
3158
|
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
|
|
2571
3159
|
var platformLat = bridgeSignals.deviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
|
|
@@ -2579,6 +3167,7 @@ function resolveVastEnvironmentSignals(isCtv) {
|
|
|
2579
3167
|
limitAdTracking = (_ref1 = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref1 !== void 0 ? _ref1 : false;
|
|
2580
3168
|
}
|
|
2581
3169
|
}
|
|
3170
|
+
var deviceTypeHint = resolveDeviceTypeHint(isCtv);
|
|
2582
3171
|
if (isCtv) {
|
|
2583
3172
|
return _object_spread_props(_object_spread({
|
|
2584
3173
|
isCtv: true,
|
|
@@ -2590,18 +3179,157 @@ function resolveVastEnvironmentSignals(isCtv) {
|
|
|
2590
3179
|
} : {}, deviceId && limitAdTracking != null ? {
|
|
2591
3180
|
limitAdTracking: limitAdTracking
|
|
2592
3181
|
} : {}), {
|
|
2593
|
-
deviceTypeHint:
|
|
3182
|
+
deviceTypeHint: deviceTypeHint
|
|
2594
3183
|
});
|
|
2595
3184
|
}
|
|
2596
|
-
|
|
3185
|
+
var webSessionId = getOrCreateWebSessionId();
|
|
3186
|
+
return _object_spread_props(_object_spread({
|
|
2597
3187
|
isCtv: false
|
|
2598
|
-
},
|
|
3188
|
+
}, webSessionId ? {
|
|
3189
|
+
sessionId: webSessionId
|
|
3190
|
+
} : {}, deviceId ? {
|
|
2599
3191
|
deviceId: deviceId
|
|
2600
3192
|
} : {}, deviceId && deviceIdType ? {
|
|
2601
3193
|
deviceIdType: deviceIdType
|
|
2602
3194
|
} : {}, deviceId && limitAdTracking != null ? {
|
|
2603
3195
|
limitAdTracking: limitAdTracking
|
|
2604
|
-
} : {})
|
|
3196
|
+
} : {}), {
|
|
3197
|
+
deviceTypeHint: deviceTypeHint
|
|
3198
|
+
});
|
|
3199
|
+
}
|
|
3200
|
+
var DEVICE_TYPE_HINT = {
|
|
3201
|
+
FEATURE_PHONE: 1,
|
|
3202
|
+
SMARTPHONE: 2,
|
|
3203
|
+
DESKTOP: 3,
|
|
3204
|
+
TABLET: 4,
|
|
3205
|
+
CONNECTED_TV: 5,
|
|
3206
|
+
GAME_CONSOLE: 6,
|
|
3207
|
+
SET_TOP_BOX: 7
|
|
3208
|
+
};
|
|
3209
|
+
var DEVICE_TYPE_HINT_ALIASES = {
|
|
3210
|
+
featurephone: DEVICE_TYPE_HINT.FEATURE_PHONE,
|
|
3211
|
+
smartphone: DEVICE_TYPE_HINT.SMARTPHONE,
|
|
3212
|
+
mobile: DEVICE_TYPE_HINT.SMARTPHONE,
|
|
3213
|
+
phone: DEVICE_TYPE_HINT.SMARTPHONE,
|
|
3214
|
+
desktop: DEVICE_TYPE_HINT.DESKTOP,
|
|
3215
|
+
pc: DEVICE_TYPE_HINT.DESKTOP,
|
|
3216
|
+
tablet: DEVICE_TYPE_HINT.TABLET,
|
|
3217
|
+
ctv: DEVICE_TYPE_HINT.CONNECTED_TV,
|
|
3218
|
+
tv: DEVICE_TYPE_HINT.CONNECTED_TV,
|
|
3219
|
+
connectedtv: DEVICE_TYPE_HINT.CONNECTED_TV,
|
|
3220
|
+
smarttv: DEVICE_TYPE_HINT.CONNECTED_TV,
|
|
3221
|
+
console: DEVICE_TYPE_HINT.GAME_CONSOLE,
|
|
3222
|
+
gameconsole: DEVICE_TYPE_HINT.GAME_CONSOLE,
|
|
3223
|
+
stb: DEVICE_TYPE_HINT.SET_TOP_BOX,
|
|
3224
|
+
settopbox: DEVICE_TYPE_HINT.SET_TOP_BOX
|
|
3225
|
+
};
|
|
3226
|
+
var SET_TOP_BOX_UA = /LGSTB|\bSTB\b|STB\d|Set-?Top|SetTopBox|TV ?Box|Kaon|Humax|Arris|Technicolor|Sagemcom|Infomir|MAG\d{3}|KreaTV|Amino|Formuler|Dune ?HD|TiVo|MiBOX|Mi Box|SHIELD Android TV|\bAFT[A-Z]|Roku|AppleTV|Apple TV|CrKey/i;
|
|
3227
|
+
var GAME_CONSOLE_UA = /PlayStation|Xbox|Nintendo/i;
|
|
3228
|
+
var CONNECTED_TV_UA = /Web0S|webOS|Tizen|SMART-TV|SmartTV|NetCast|BRAVIA|HbbTV|VIDAA|Hisense|Philips|Viera|AQUOS|Android TV|Google TV|\bTV\b/i;
|
|
3229
|
+
var FEATURE_PHONE_UA = /KAIOS|MIDP|J2ME|Series40|Opera Mini/i;
|
|
3230
|
+
function resolveDeviceTypeHint(isCtv) {
|
|
3231
|
+
var override = readDeviceTypeHintOverride(isCtv);
|
|
3232
|
+
if (override != null) return override;
|
|
3233
|
+
return inferDeviceTypeHint(isCtv);
|
|
3234
|
+
}
|
|
3235
|
+
function inferDeviceTypeHint(isCtv) {
|
|
3236
|
+
var fallback = isCtv ? DEVICE_TYPE_HINT.CONNECTED_TV : DEVICE_TYPE_HINT.DESKTOP;
|
|
3237
|
+
if (typeof navigator === "undefined") return fallback;
|
|
3238
|
+
var ua = navigator.userAgent || "";
|
|
3239
|
+
var maxTouchPoints = navigator.maxTouchPoints || 0;
|
|
3240
|
+
if (SET_TOP_BOX_UA.test(ua)) return DEVICE_TYPE_HINT.SET_TOP_BOX;
|
|
3241
|
+
if (GAME_CONSOLE_UA.test(ua)) return DEVICE_TYPE_HINT.GAME_CONSOLE;
|
|
3242
|
+
if (CONNECTED_TV_UA.test(ua) && !/Mobile/i.test(ua)) {
|
|
3243
|
+
return DEVICE_TYPE_HINT.CONNECTED_TV;
|
|
3244
|
+
}
|
|
3245
|
+
if (FEATURE_PHONE_UA.test(ua)) return DEVICE_TYPE_HINT.FEATURE_PHONE;
|
|
3246
|
+
if (/iPad/i.test(ua) || /Macintosh/i.test(ua) && maxTouchPoints > 1) {
|
|
3247
|
+
return DEVICE_TYPE_HINT.TABLET;
|
|
3248
|
+
}
|
|
3249
|
+
if (/iPhone|iPod/i.test(ua)) return DEVICE_TYPE_HINT.SMARTPHONE;
|
|
3250
|
+
if (/Android/i.test(ua)) {
|
|
3251
|
+
if (/Mobile/i.test(ua)) return DEVICE_TYPE_HINT.SMARTPHONE;
|
|
3252
|
+
if (maxTouchPoints === 0) return DEVICE_TYPE_HINT.SET_TOP_BOX;
|
|
3253
|
+
return DEVICE_TYPE_HINT.TABLET;
|
|
3254
|
+
}
|
|
3255
|
+
if (/Mobile|Windows Phone|BlackBerry/i.test(ua)) return DEVICE_TYPE_HINT.SMARTPHONE;
|
|
3256
|
+
return fallback;
|
|
3257
|
+
}
|
|
3258
|
+
function readDeviceTypeHintOverride(isCtv) {
|
|
3259
|
+
if (typeof window === "undefined") return void 0;
|
|
3260
|
+
var keys = [
|
|
3261
|
+
"dth",
|
|
3262
|
+
"deviceTypeHint"
|
|
3263
|
+
];
|
|
3264
|
+
var fromGlobal = normalizeDeviceTypeHint(window.__STORMCLOUD_DTH__);
|
|
3265
|
+
if (fromGlobal != null) return fromGlobal;
|
|
3266
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3267
|
+
try {
|
|
3268
|
+
for(var _iterator = getNativeBridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3269
|
+
var source = _step.value;
|
|
3270
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
3271
|
+
try {
|
|
3272
|
+
for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
3273
|
+
var key = _step1.value;
|
|
3274
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
3275
|
+
var normalized = normalizeDeviceTypeHint(typeof value === "function" ? safeCall(value, source) : value);
|
|
3276
|
+
if (normalized != null) return normalized;
|
|
3277
|
+
}
|
|
3278
|
+
} catch (err) {
|
|
3279
|
+
_didIteratorError1 = true;
|
|
3280
|
+
_iteratorError1 = err;
|
|
3281
|
+
} finally{
|
|
3282
|
+
try {
|
|
3283
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
3284
|
+
_iterator1.return();
|
|
3285
|
+
}
|
|
3286
|
+
} finally{
|
|
3287
|
+
if (_didIteratorError1) {
|
|
3288
|
+
throw _iteratorError1;
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
} catch (err) {
|
|
3294
|
+
_didIteratorError = true;
|
|
3295
|
+
_iteratorError = err;
|
|
3296
|
+
} finally{
|
|
3297
|
+
try {
|
|
3298
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3299
|
+
_iterator.return();
|
|
3300
|
+
}
|
|
3301
|
+
} finally{
|
|
3302
|
+
if (_didIteratorError) {
|
|
3303
|
+
throw _iteratorError;
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
if (!isCtv) return void 0;
|
|
3308
|
+
for(var _i = 0, _iter = [
|
|
3309
|
+
"stormcloud.dth",
|
|
3310
|
+
"dth"
|
|
3311
|
+
]; _i < _iter.length; _i++){
|
|
3312
|
+
var key1 = _iter[_i];
|
|
3313
|
+
var normalized1 = normalizeDeviceTypeHint(readStoredString(key1));
|
|
3314
|
+
if (normalized1 != null) return normalized1;
|
|
3315
|
+
}
|
|
3316
|
+
return void 0;
|
|
3317
|
+
}
|
|
3318
|
+
function normalizeDeviceTypeHint(value) {
|
|
3319
|
+
if (typeof value === "number") {
|
|
3320
|
+
return Number.isInteger(value) && value >= 1 && value <= 7 ? value : void 0;
|
|
3321
|
+
}
|
|
3322
|
+
if (typeof value !== "string") return void 0;
|
|
3323
|
+
var trimmed = value.trim();
|
|
3324
|
+
if (/^[1-7]$/.test(trimmed)) return parseInt(trimmed, 10);
|
|
3325
|
+
return DEVICE_TYPE_HINT_ALIASES[trimmed.toLowerCase().replace(/[\s_-]/g, "")];
|
|
3326
|
+
}
|
|
3327
|
+
function safeCall(fn, thisArg) {
|
|
3328
|
+
try {
|
|
3329
|
+
return fn.call(thisArg);
|
|
3330
|
+
} catch (unused) {
|
|
3331
|
+
return void 0;
|
|
3332
|
+
}
|
|
2605
3333
|
}
|
|
2606
3334
|
function inferDeviceIdType() {
|
|
2607
3335
|
if (typeof navigator === "undefined") {
|
|
@@ -2625,9 +3353,10 @@ function isEquivalentDeviceIdType(tagType, runtimeType) {
|
|
|
2625
3353
|
return ANDROID_ID_TYPES.has(tag) && ANDROID_ID_TYPES.has(runtime);
|
|
2626
3354
|
}
|
|
2627
3355
|
function resolveNativeDeviceId() {
|
|
3356
|
+
var includeStored = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
2628
3357
|
var bridgeSignals = readNativeBridgeSignals();
|
|
2629
3358
|
var platformDevice = readPlatformNativeDeviceId();
|
|
2630
|
-
var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId;
|
|
3359
|
+
var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
|
|
2631
3360
|
if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
|
|
2632
3361
|
return void 0;
|
|
2633
3362
|
}
|
|
@@ -2656,6 +3385,21 @@ function getOrCreateCtvSessionId() {
|
|
|
2656
3385
|
writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
2657
3386
|
return sessionId;
|
|
2658
3387
|
}
|
|
3388
|
+
function getOrCreateWebSessionId() {
|
|
3389
|
+
if (typeof window === "undefined") return void 0;
|
|
3390
|
+
try {
|
|
3391
|
+
var _window_sessionStorage;
|
|
3392
|
+
var existing = (_window_sessionStorage = window.sessionStorage) === null || _window_sessionStorage === void 0 ? void 0 : _window_sessionStorage.getItem(WEB_SESSION_STORAGE_KEY);
|
|
3393
|
+
if (existing && !isMacroPlaceholder(existing)) return existing;
|
|
3394
|
+
} catch (unused) {}
|
|
3395
|
+
var sessionId = inMemoryWebSessionId || createUuid();
|
|
3396
|
+
inMemoryWebSessionId = sessionId;
|
|
3397
|
+
try {
|
|
3398
|
+
var _window_sessionStorage1;
|
|
3399
|
+
(_window_sessionStorage1 = window.sessionStorage) === null || _window_sessionStorage1 === void 0 ? void 0 : _window_sessionStorage1.setItem(WEB_SESSION_STORAGE_KEY, sessionId);
|
|
3400
|
+
} catch (unused) {}
|
|
3401
|
+
return sessionId;
|
|
3402
|
+
}
|
|
2659
3403
|
function readPersistentId(storageKey) {
|
|
2660
3404
|
return readStoredString(storageKey) || readCookie(storageKey);
|
|
2661
3405
|
}
|
|
@@ -2796,33 +3540,20 @@ function readPlatformNativeDeviceId() {
|
|
|
2796
3540
|
return {};
|
|
2797
3541
|
}
|
|
2798
3542
|
var ZEROED_AD_ID_PATTERNS = /* @__PURE__ */ new Set([
|
|
2799
|
-
"38400000-8cf0-11bd-b23e-10b96e40000d",
|
|
2800
|
-
"00000000-0000-0000-0000-000000000000"
|
|
2801
|
-
]);
|
|
2802
|
-
function isMacroPlaceholder(value) {
|
|
2803
|
-
var t = value.trim();
|
|
2804
|
-
return !t || /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/.test(t) || /^(unknown|null|undefined|none|n\/a|\$\{[^}]+\})$/i.test(t) || ZEROED_AD_ID_PATTERNS.has(t.toLowerCase());
|
|
2805
|
-
}
|
|
2806
|
-
function isZeroedAdId(value) {
|
|
2807
|
-
return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
|
|
2808
|
-
}
|
|
2809
|
-
function readNativeBridgeSignals() {
|
|
2810
|
-
if (typeof window === "undefined") {
|
|
2811
|
-
return {};
|
|
2812
|
-
}
|
|
2813
|
-
var candidates = [
|
|
2814
|
-
window.__STORMCLOUD_CTV_AD_INFO__,
|
|
2815
|
-
window.__STORMCLOUD_CTV__,
|
|
2816
|
-
window.stormcloudCtv,
|
|
2817
|
-
window.AiryTV,
|
|
2818
|
-
window.Android,
|
|
2819
|
-
window.webOS,
|
|
2820
|
-
window.tizen,
|
|
2821
|
-
window.amazon
|
|
2822
|
-
].filter(Boolean);
|
|
3543
|
+
"38400000-8cf0-11bd-b23e-10b96e40000d",
|
|
3544
|
+
"00000000-0000-0000-0000-000000000000"
|
|
3545
|
+
]);
|
|
3546
|
+
function isMacroPlaceholder(value) {
|
|
3547
|
+
var t = value.trim();
|
|
3548
|
+
return !t || /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/.test(t) || /^(unknown|null|undefined|none|n\/a|\$\{[^}]+\})$/i.test(t) || ZEROED_AD_ID_PATTERNS.has(t.toLowerCase());
|
|
3549
|
+
}
|
|
3550
|
+
function isZeroedAdId(value) {
|
|
3551
|
+
return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
|
|
3552
|
+
}
|
|
3553
|
+
function readNativeBridgeSignals() {
|
|
2823
3554
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2824
3555
|
try {
|
|
2825
|
-
for(var _iterator =
|
|
3556
|
+
for(var _iterator = getNativeBridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2826
3557
|
var source = _step.value;
|
|
2827
3558
|
var contentUrl = readBridgeValue(source, [
|
|
2828
3559
|
"contentUrl",
|
|
@@ -2897,6 +3628,21 @@ function readNativeBridgeSignals() {
|
|
|
2897
3628
|
}
|
|
2898
3629
|
return {};
|
|
2899
3630
|
}
|
|
3631
|
+
function getNativeBridgeSources() {
|
|
3632
|
+
if (typeof window === "undefined") {
|
|
3633
|
+
return [];
|
|
3634
|
+
}
|
|
3635
|
+
return [
|
|
3636
|
+
window.__STORMCLOUD_CTV_AD_INFO__,
|
|
3637
|
+
window.__STORMCLOUD_CTV__,
|
|
3638
|
+
window.stormcloudCtv,
|
|
3639
|
+
window.AiryTV,
|
|
3640
|
+
window.Android,
|
|
3641
|
+
window.webOS,
|
|
3642
|
+
window.tizen,
|
|
3643
|
+
window.amazon
|
|
3644
|
+
].filter(Boolean);
|
|
3645
|
+
}
|
|
2900
3646
|
function readBridgeValue(source, keys) {
|
|
2901
3647
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2902
3648
|
try {
|
|
@@ -3255,7 +4001,7 @@ function sha256Hex(input) {
|
|
|
3255
4001
|
})();
|
|
3256
4002
|
}
|
|
3257
4003
|
function resolvePlayerIdentitySeed(clientInfo) {
|
|
3258
|
-
var nativeDeviceId = resolveNativeDeviceId();
|
|
4004
|
+
var nativeDeviceId = resolveNativeDeviceId(clientInfo.isSmartTV);
|
|
3259
4005
|
if (nativeDeviceId) {
|
|
3260
4006
|
return "device:".concat(nativeDeviceId);
|
|
3261
4007
|
}
|
|
@@ -3609,7 +4355,6 @@ function polyfillURLSearchParams() {
|
|
|
3609
4355
|
return;
|
|
3610
4356
|
}
|
|
3611
4357
|
var URLSearchParamsPolyfill = /*#__PURE__*/ function() {
|
|
3612
|
-
"use strict";
|
|
3613
4358
|
function URLSearchParamsPolyfill(init) {
|
|
3614
4359
|
var _this = this;
|
|
3615
4360
|
_class_call_check(this, URLSearchParamsPolyfill);
|
|
@@ -3723,7 +4468,6 @@ function polyfillTextEncoder() {
|
|
|
3723
4468
|
return;
|
|
3724
4469
|
}
|
|
3725
4470
|
var TextEncoderPolyfill = /*#__PURE__*/ function() {
|
|
3726
|
-
"use strict";
|
|
3727
4471
|
function TextEncoderPolyfill() {
|
|
3728
4472
|
_class_call_check(this, TextEncoderPolyfill);
|
|
3729
4473
|
this.encoding = "utf-8";
|
|
@@ -4026,6 +4770,12 @@ function applyDeviceIdentityParams(params, ctx) {
|
|
|
4026
4770
|
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : isMacroPlaceholder2(tagLat) ? "0" : tagLat);
|
|
4027
4771
|
return;
|
|
4028
4772
|
}
|
|
4773
|
+
if (!ctx.isCtv) {
|
|
4774
|
+
params.delete("rdid");
|
|
4775
|
+
params.delete("idtype");
|
|
4776
|
+
params.delete("is_lat");
|
|
4777
|
+
return;
|
|
4778
|
+
}
|
|
4029
4779
|
var tagRdidValid = Boolean(tagRdid && !isMacroPlaceholder2(tagRdid));
|
|
4030
4780
|
var tagTypeValid = Boolean(tagType && !isMacroPlaceholder2(tagType));
|
|
4031
4781
|
if (tagRdidValid && tagTypeValid && runtimeType && !isEquivalentDeviceIdType(tagType, runtimeType)) {
|
|
@@ -4180,15 +4930,24 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
4180
4930
|
if (ctx.podMaxAds != null) {
|
|
4181
4931
|
params.set("pmad", String(Math.max(1, Math.round(ctx.podMaxAds))));
|
|
4182
4932
|
}
|
|
4183
|
-
if (!ctx.isCtv && ctx.pageUrl) {
|
|
4184
|
-
params.set("url", ctx.pageUrl);
|
|
4185
|
-
params.set("description_url", ctx.pageUrl);
|
|
4186
|
-
}
|
|
4187
4933
|
var existingUrl = params.get("url") || "";
|
|
4188
4934
|
if (EXAMPLE_COM_URL.test(existingUrl)) {
|
|
4189
4935
|
params.delete("url");
|
|
4190
4936
|
params.delete("description_url");
|
|
4191
4937
|
}
|
|
4938
|
+
if (!ctx.isCtv && ctx.pageUrl) {
|
|
4939
|
+
if (isMacroPlaceholder2(params.get("url"))) {
|
|
4940
|
+
params.set("url", ctx.pageUrl);
|
|
4941
|
+
}
|
|
4942
|
+
if (isMacroPlaceholder2(params.get("description_url"))) {
|
|
4943
|
+
params.set("description_url", params.get("url") || ctx.pageUrl);
|
|
4944
|
+
}
|
|
4945
|
+
}
|
|
4946
|
+
if (!ctx.isCtv) {
|
|
4947
|
+
params.delete("an");
|
|
4948
|
+
params.delete("msid");
|
|
4949
|
+
params.delete("sid");
|
|
4950
|
+
}
|
|
4192
4951
|
if (ctx.adWillPlayMuted != null) {
|
|
4193
4952
|
params.set("vpmute", ctx.adWillPlayMuted ? "1" : "0");
|
|
4194
4953
|
}
|
|
@@ -4222,6 +4981,9 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
4222
4981
|
if (ctx.programTitle) {
|
|
4223
4982
|
params.set("ct_ti", ctx.programTitle);
|
|
4224
4983
|
}
|
|
4984
|
+
if (ctx.channelName) {
|
|
4985
|
+
params.set("ct_ch", ctx.channelName);
|
|
4986
|
+
}
|
|
4225
4987
|
var staleKeys = [];
|
|
4226
4988
|
params.forEach(function(value, key) {
|
|
4227
4989
|
if (isMacroPlaceholder2(value)) {
|
|
@@ -4274,8 +5036,10 @@ function fetchConsentSignals() {
|
|
|
4274
5036
|
tcfApi("addEventListener", 2, function(tcData, success) {
|
|
4275
5037
|
if (settled) return;
|
|
4276
5038
|
if (success && tcData && (tcData.eventStatus === "tcloaded" || tcData.eventStatus === "useractioncomplete")) {
|
|
5039
|
+
var _tcData_purpose_consents, _tcData_purpose;
|
|
4277
5040
|
settled = true;
|
|
4278
5041
|
signals.gdpr = tcData.gdprApplies ? "1" : "0";
|
|
5042
|
+
signals.storageAllowed = tcData.gdprApplies ? ((_tcData_purpose = tcData.purpose) === null || _tcData_purpose === void 0 ? void 0 : (_tcData_purpose_consents = _tcData_purpose.consents) === null || _tcData_purpose_consents === void 0 ? void 0 : _tcData_purpose_consents[1]) === true : true;
|
|
4279
5043
|
if (typeof tcData.tcString === "string" && tcData.tcString) {
|
|
4280
5044
|
signals.gdprConsent = tcData.tcString;
|
|
4281
5045
|
}
|
|
@@ -4822,7 +5586,6 @@ function parseScte35FromTsPackets(data, tsScte35Pids, pmtPids, processedSections
|
|
|
4822
5586
|
return markers;
|
|
4823
5587
|
}
|
|
4824
5588
|
var BitReader = /*#__PURE__*/ function() {
|
|
4825
|
-
"use strict";
|
|
4826
5589
|
function BitReader(buf) {
|
|
4827
5590
|
_class_call_check(this, BitReader);
|
|
4828
5591
|
this.buf = buf;
|
|
@@ -5082,7 +5845,6 @@ function parseScte35Binary(data) {
|
|
|
5082
5845
|
}
|
|
5083
5846
|
// src/player/Scte35CueManager.ts
|
|
5084
5847
|
var Scte35CueManager = /*#__PURE__*/ function() {
|
|
5085
|
-
"use strict";
|
|
5086
5848
|
function Scte35CueManager(debug, callbacks) {
|
|
5087
5849
|
_class_call_check(this, Scte35CueManager);
|
|
5088
5850
|
this.pendingScte35Cues = /* @__PURE__ */ new Map();
|
|
@@ -5337,7 +6099,6 @@ var Scte35CueManager = /*#__PURE__*/ function() {
|
|
|
5337
6099
|
}();
|
|
5338
6100
|
// src/player/AdConfigManager.ts
|
|
5339
6101
|
var AdConfigManager = /*#__PURE__*/ function() {
|
|
5340
|
-
"use strict";
|
|
5341
6102
|
function AdConfigManager(config, video) {
|
|
5342
6103
|
_class_call_check(this, AdConfigManager);
|
|
5343
6104
|
this.vmapBreaks = [];
|
|
@@ -5811,7 +6572,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5811
6572
|
pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? toDevSafeUrl(window.location.href) : void 0,
|
|
5812
6573
|
adWillPlayMuted: adWillPlayMuted,
|
|
5813
6574
|
adWillAutoPlay: !!this.config.autoplay,
|
|
5814
|
-
sessionId: envSignals.sessionId,
|
|
6575
|
+
sessionId: envSignals.isCtv || this.consentSignals.storageAllowed !== false ? envSignals.sessionId : void 0,
|
|
5815
6576
|
deviceId: envSignals.deviceId,
|
|
5816
6577
|
deviceIdType: envSignals.deviceIdType,
|
|
5817
6578
|
limitAdTracking: envSignals.limitAdTracking,
|
|
@@ -5819,6 +6580,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5819
6580
|
adTest: this.config.adTest
|
|
5820
6581
|
}, this.config.programTitle ? {
|
|
5821
6582
|
programTitle: this.config.programTitle
|
|
6583
|
+
} : {}, this.config.channelName ? {
|
|
6584
|
+
channelName: this.config.channelName
|
|
5822
6585
|
} : {}), {
|
|
5823
6586
|
consent: this.consentSignals
|
|
5824
6587
|
}));
|
|
@@ -5875,7 +6638,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5875
6638
|
}();
|
|
5876
6639
|
// src/player/AdTimingService.ts
|
|
5877
6640
|
var AdTimingService = /*#__PURE__*/ function() {
|
|
5878
|
-
"use strict";
|
|
5879
6641
|
function AdTimingService(config, video, callbacks) {
|
|
5880
6642
|
_class_call_check(this, AdTimingService);
|
|
5881
6643
|
this.adRequestWatchdogToken = null;
|
|
@@ -6440,7 +7202,6 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
6440
7202
|
}();
|
|
6441
7203
|
// src/player/PlaceholderLayer.ts
|
|
6442
7204
|
var PlaceholderLayer = /*#__PURE__*/ function() {
|
|
6443
|
-
"use strict";
|
|
6444
7205
|
function PlaceholderLayer(video, debug) {
|
|
6445
7206
|
_class_call_check(this, PlaceholderLayer);
|
|
6446
7207
|
this.video = video;
|
|
@@ -6549,9 +7310,8 @@ var PlaceholderLayer = /*#__PURE__*/ function() {
|
|
|
6549
7310
|
return PlaceholderLayer;
|
|
6550
7311
|
}();
|
|
6551
7312
|
// src/player/HlsEngine.ts
|
|
6552
|
-
|
|
7313
|
+
var import_hls2 = __toESM(require("hls.js"), 1);
|
|
6553
7314
|
var HlsEngine = /*#__PURE__*/ function() {
|
|
6554
|
-
"use strict";
|
|
6555
7315
|
function HlsEngine(config, video, cueManager, timing, callbacks) {
|
|
6556
7316
|
_class_call_check(this, HlsEngine);
|
|
6557
7317
|
this.isLiveStream = false;
|
|
@@ -6630,7 +7390,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6630
7390
|
key: "setupHls",
|
|
6631
7391
|
value: function setupHls() {
|
|
6632
7392
|
var _this = this;
|
|
6633
|
-
this.hls = new
|
|
7393
|
+
this.hls = new import_hls2.default({
|
|
6634
7394
|
enableWorker: true,
|
|
6635
7395
|
backBufferLength: 30,
|
|
6636
7396
|
liveDurationInfinity: true,
|
|
@@ -6645,11 +7405,11 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6645
7405
|
nudgeMaxRetry: 5,
|
|
6646
7406
|
startPosition: -1
|
|
6647
7407
|
});
|
|
6648
|
-
this.hls.on(
|
|
7408
|
+
this.hls.on(import_hls2.default.Events.MEDIA_ATTACHED, function() {
|
|
6649
7409
|
var _this_hls;
|
|
6650
7410
|
(_this_hls = _this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.loadSource(_this.config.src);
|
|
6651
7411
|
});
|
|
6652
|
-
this.hls.on(
|
|
7412
|
+
this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, _data) {
|
|
6653
7413
|
return _async_to_generator(function() {
|
|
6654
7414
|
var _this_config_isLiveStream, _ref, _this_config_minSegmentsBeforePlay, _this_hls_levels, _this_hls, minSegments, _this_video_play;
|
|
6655
7415
|
return _ts_generator(this, function(_state) {
|
|
@@ -6699,7 +7459,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6699
7459
|
});
|
|
6700
7460
|
}).call(_this);
|
|
6701
7461
|
});
|
|
6702
|
-
this.hls.on(
|
|
7462
|
+
this.hls.on(import_hls2.default.Events.LEVEL_LOADED, function(_evt, data) {
|
|
6703
7463
|
_this.applyStreamLatencyProfile(data === null || data === void 0 ? void 0 : data.details);
|
|
6704
7464
|
if (_this.callbacks.isInAdBreak() || _this.callbacks.hasPendingAdBreak()) {
|
|
6705
7465
|
return;
|
|
@@ -6773,7 +7533,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6773
7533
|
}
|
|
6774
7534
|
}
|
|
6775
7535
|
});
|
|
6776
|
-
this.hls.on(
|
|
7536
|
+
this.hls.on(import_hls2.default.Events.FRAG_BUFFERED, function(_evt, _data) {
|
|
6777
7537
|
return _async_to_generator(function() {
|
|
6778
7538
|
var _this, _this_config_minSegmentsBeforePlay, minSegments, _this_video_play;
|
|
6779
7539
|
return _ts_generator(this, function(_state) {
|
|
@@ -6821,7 +7581,7 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6821
7581
|
});
|
|
6822
7582
|
}).call(_this);
|
|
6823
7583
|
});
|
|
6824
|
-
this.hls.on(
|
|
7584
|
+
this.hls.on(import_hls2.default.Events.FRAG_PARSING_METADATA, function(_evt, data) {
|
|
6825
7585
|
var id3Tags = ((data === null || data === void 0 ? void 0 : data.samples) || []).map(function(s) {
|
|
6826
7586
|
return {
|
|
6827
7587
|
key: "ID3",
|
|
@@ -6833,15 +7593,15 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6833
7593
|
return _this.onId3Tag(tag);
|
|
6834
7594
|
});
|
|
6835
7595
|
});
|
|
6836
|
-
this.hls.on(
|
|
7596
|
+
this.hls.on(import_hls2.default.Events.FRAG_LOADED, function(_evt, data) {
|
|
6837
7597
|
var _data_frag;
|
|
6838
7598
|
_this.processFragmentScte35Payload(data === null || data === void 0 ? void 0 : data.payload, typeof (data === null || data === void 0 ? void 0 : (_data_frag = data.frag) === null || _data_frag === void 0 ? void 0 : _data_frag.sn) === "number" ? data.frag.sn : void 0, getFragmentStartSeconds(data === null || data === void 0 ? void 0 : data.frag));
|
|
6839
7599
|
});
|
|
6840
|
-
this.hls.on(
|
|
7600
|
+
this.hls.on(import_hls2.default.Events.FRAG_DECRYPTED, function(_evt, data) {
|
|
6841
7601
|
var _data_frag;
|
|
6842
7602
|
_this.processFragmentScte35Payload(data === null || data === void 0 ? void 0 : data.payload, typeof (data === null || data === void 0 ? void 0 : (_data_frag = data.frag) === null || _data_frag === void 0 ? void 0 : _data_frag.sn) === "number" ? data.frag.sn : void 0, getFragmentStartSeconds(data === null || data === void 0 ? void 0 : data.frag));
|
|
6843
7603
|
});
|
|
6844
|
-
this.hls.on(
|
|
7604
|
+
this.hls.on(import_hls2.default.Events.FRAG_CHANGED, function(_evt, data) {
|
|
6845
7605
|
var frag = data === null || data === void 0 ? void 0 : data.frag;
|
|
6846
7606
|
var tagList = frag === null || frag === void 0 ? void 0 : frag.tagList;
|
|
6847
7607
|
if (!Array.isArray(tagList)) {
|
|
@@ -6954,14 +7714,14 @@ var HlsEngine = /*#__PURE__*/ function() {
|
|
|
6954
7714
|
}
|
|
6955
7715
|
_this.callbacks.activatePendingCuesForFragment(frag);
|
|
6956
7716
|
});
|
|
6957
|
-
this.hls.on(
|
|
7717
|
+
this.hls.on(import_hls2.default.Events.ERROR, function(_evt, data) {
|
|
6958
7718
|
if (data === null || data === void 0 ? void 0 : data.fatal) {
|
|
6959
7719
|
switch(data.type){
|
|
6960
|
-
case
|
|
7720
|
+
case import_hls2.default.ErrorTypes.NETWORK_ERROR:
|
|
6961
7721
|
var _this_hls;
|
|
6962
7722
|
(_this_hls = _this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.startLoad();
|
|
6963
7723
|
break;
|
|
6964
|
-
case
|
|
7724
|
+
case import_hls2.default.ErrorTypes.MEDIA_ERROR:
|
|
6965
7725
|
var _this_hls1;
|
|
6966
7726
|
(_this_hls1 = _this.hls) === null || _this_hls1 === void 0 ? void 0 : _this_hls1.recoverMediaError();
|
|
6967
7727
|
break;
|
|
@@ -7307,7 +8067,6 @@ function resizePlayer(video, adPlayer, debug) {
|
|
|
7307
8067
|
}
|
|
7308
8068
|
// src/player/AdBreakOrchestrator.ts
|
|
7309
8069
|
var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
7310
|
-
"use strict";
|
|
7311
8070
|
function AdBreakOrchestrator(host, timing, adConfig, cueManager, placeholder) {
|
|
7312
8071
|
_class_call_check(this, AdBreakOrchestrator);
|
|
7313
8072
|
this.inAdBreak = false;
|
|
@@ -7362,6 +8121,12 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
7362
8121
|
console.log("[POD] Playing pod ad ".concat((payload === null || payload === void 0 ? void 0 : payload.index) != null ? payload.index + 1 : "?", "/").concat((_ref = payload === null || payload === void 0 ? void 0 : payload.total) !== null && _ref !== void 0 ? _ref : "?"));
|
|
7363
8122
|
}
|
|
7364
8123
|
});
|
|
8124
|
+
adPlayer.on("ad_click", function() {
|
|
8125
|
+
_this.host.onAdClick();
|
|
8126
|
+
});
|
|
8127
|
+
adPlayer.on("ad_interaction", function(event) {
|
|
8128
|
+
if (event) _this.host.onAdInteraction(event);
|
|
8129
|
+
});
|
|
7365
8130
|
adPlayer.on("all_ads_completed", function() {
|
|
7366
8131
|
sendAdImpressionTracking(_this.host.config.licenseKey, {
|
|
7367
8132
|
source: "hls",
|
|
@@ -8783,7 +9548,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8783
9548
|
}();
|
|
8784
9549
|
// src/player/StormcloudVideoPlayer.ts
|
|
8785
9550
|
var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
8786
|
-
"use strict";
|
|
8787
9551
|
function StormcloudVideoPlayer(config) {
|
|
8788
9552
|
var _this = this;
|
|
8789
9553
|
_class_call_check(this, StormcloudVideoPlayer);
|
|
@@ -8892,6 +9656,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8892
9656
|
},
|
|
8893
9657
|
generatePodVastUrl: function generatePodVastUrl(base, breakDurationMs) {
|
|
8894
9658
|
return _this.generatePodVastUrl(base, breakDurationMs);
|
|
9659
|
+
},
|
|
9660
|
+
onAdClick: function onAdClick() {
|
|
9661
|
+
return _this.palNonce.sendAdClick();
|
|
9662
|
+
},
|
|
9663
|
+
onAdInteraction: function onAdInteraction(event) {
|
|
9664
|
+
return _this.palNonce.sendAdTouch(event);
|
|
8895
9665
|
}
|
|
8896
9666
|
}, this.timing, this.adConfig, this.cueManager, this.placeholder);
|
|
8897
9667
|
}
|
|
@@ -8932,7 +9702,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8932
9702
|
// ───────────────────────────────────────────────────────────────
|
|
8933
9703
|
function load() {
|
|
8934
9704
|
return _async_to_generator(function() {
|
|
8935
|
-
var _this,
|
|
9705
|
+
var _this, error, palDescriptionUrl, continueLiveStreamDuringAds;
|
|
8936
9706
|
return _ts_generator(this, function(_state) {
|
|
8937
9707
|
switch(_state.label){
|
|
8938
9708
|
case 0:
|
|
@@ -8968,19 +9738,25 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8968
9738
|
4
|
|
8969
9739
|
];
|
|
8970
9740
|
case 4:
|
|
8971
|
-
palDescriptionUrl = this.adConfig.getPalDescriptionUrl();
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
adWillPlayMuted: true,
|
|
8977
|
-
playerVolume: 0,
|
|
8978
|
-
continuousPlayback: (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
|
|
8979
|
-
}, palDescriptionUrl ? {
|
|
8980
|
-
descriptionUrl: palDescriptionUrl
|
|
8981
|
-
} : {})).catch(function() {});
|
|
8982
|
-
fetchConsentSignals().then(function(signals) {
|
|
9741
|
+
palDescriptionUrl = this.config.ctvAdRequest ? this.adConfig.getPalDescriptionUrl() : void 0;
|
|
9742
|
+
fetchConsentSignals().catch(function() {
|
|
9743
|
+
return {};
|
|
9744
|
+
}).then(function(signals) {
|
|
9745
|
+
var _this_config_lowLatencyMode;
|
|
8983
9746
|
_this.adConfig.consentSignals = signals;
|
|
9747
|
+
var muted = _this.video.muted;
|
|
9748
|
+
return _this.palNonce.generateNonce(_object_spread({
|
|
9749
|
+
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
9750
|
+
videoHeight: _this.video.offsetHeight || _this.video.clientHeight || 480,
|
|
9751
|
+
adWillAutoPlay: !!_this.config.autoplay,
|
|
9752
|
+
adWillPlayMuted: muted,
|
|
9753
|
+
playerVolume: muted ? 0 : _this.video.volume,
|
|
9754
|
+
continuousPlayback: (_this_config_lowLatencyMode = _this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
|
|
9755
|
+
}, palDescriptionUrl ? {
|
|
9756
|
+
descriptionUrl: palDescriptionUrl
|
|
9757
|
+
} : {}, signals.storageAllowed != null ? {
|
|
9758
|
+
allowStorage: signals.storageAllowed
|
|
9759
|
+
} : {}));
|
|
8984
9760
|
}).catch(function() {});
|
|
8985
9761
|
this.adConfig.initializeTracking();
|
|
8986
9762
|
if (!this.hlsEngine.shouldUseNativeHls(function() {
|
|
@@ -9626,1424 +10402,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9626
10402
|
]);
|
|
9627
10403
|
return StormcloudVideoPlayer;
|
|
9628
10404
|
}();
|
|
9629
|
-
// src/ui/StormcloudVideoPlayer.tsx
|
|
9630
|
-
import { FaPlay, FaPause, FaVolumeUp, FaVolumeMute, FaVolumeDown } from "react-icons/fa";
|
|
9631
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9632
|
-
var ExpandIcon = function ExpandIcon(param) {
|
|
9633
|
-
var _param_size = param.size, size = _param_size === void 0 ? 18 : _param_size;
|
|
9634
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
9635
|
-
width: size,
|
|
9636
|
-
height: size,
|
|
9637
|
-
viewBox: "0 0 24 24",
|
|
9638
|
-
fill: "none",
|
|
9639
|
-
stroke: "currentColor",
|
|
9640
|
-
strokeWidth: 2,
|
|
9641
|
-
strokeLinecap: "round",
|
|
9642
|
-
strokeLinejoin: "round",
|
|
9643
|
-
"aria-hidden": "true",
|
|
9644
|
-
focusable: "false",
|
|
9645
|
-
children: [
|
|
9646
|
-
/* @__PURE__ */ jsx("path", {
|
|
9647
|
-
d: "M9 4H4v5"
|
|
9648
|
-
}),
|
|
9649
|
-
/* @__PURE__ */ jsx("path", {
|
|
9650
|
-
d: "M20 9V4h-5"
|
|
9651
|
-
}),
|
|
9652
|
-
/* @__PURE__ */ jsx("path", {
|
|
9653
|
-
d: "M15 20h5v-5"
|
|
9654
|
-
}),
|
|
9655
|
-
/* @__PURE__ */ jsx("path", {
|
|
9656
|
-
d: "M4 15v5h5"
|
|
9657
|
-
})
|
|
9658
|
-
]
|
|
9659
|
-
});
|
|
9660
|
-
};
|
|
9661
|
-
var CompressIcon = function CompressIcon(param) {
|
|
9662
|
-
var _param_size = param.size, size = _param_size === void 0 ? 18 : _param_size;
|
|
9663
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
9664
|
-
width: size,
|
|
9665
|
-
height: size,
|
|
9666
|
-
viewBox: "0 0 24 24",
|
|
9667
|
-
fill: "none",
|
|
9668
|
-
stroke: "currentColor",
|
|
9669
|
-
strokeWidth: 2,
|
|
9670
|
-
strokeLinecap: "round",
|
|
9671
|
-
strokeLinejoin: "round",
|
|
9672
|
-
"aria-hidden": "true",
|
|
9673
|
-
focusable: "false",
|
|
9674
|
-
children: [
|
|
9675
|
-
/* @__PURE__ */ jsx("path", {
|
|
9676
|
-
d: "M4 9h5V4"
|
|
9677
|
-
}),
|
|
9678
|
-
/* @__PURE__ */ jsx("path", {
|
|
9679
|
-
d: "M15 4v5h5"
|
|
9680
|
-
}),
|
|
9681
|
-
/* @__PURE__ */ jsx("path", {
|
|
9682
|
-
d: "M20 15h-5v5"
|
|
9683
|
-
}),
|
|
9684
|
-
/* @__PURE__ */ jsx("path", {
|
|
9685
|
-
d: "M9 20v-5H4"
|
|
9686
|
-
})
|
|
9687
|
-
]
|
|
9688
|
-
});
|
|
9689
|
-
};
|
|
9690
|
-
var CRITICAL_PROPS = [
|
|
9691
|
-
"src",
|
|
9692
|
-
"allowNativeHls",
|
|
9693
|
-
"isLiveStream",
|
|
9694
|
-
"licenseKey",
|
|
9695
|
-
"isVmap",
|
|
9696
|
-
"vmapUrl",
|
|
9697
|
-
"lowLatencyMode",
|
|
9698
|
-
"driftToleranceMs",
|
|
9699
|
-
"vastMode",
|
|
9700
|
-
"ctvAdRequest"
|
|
9701
|
-
];
|
|
9702
|
-
var CONTROLS_HIDE_DELAY = 3e3;
|
|
9703
|
-
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
9704
|
-
var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
9705
|
-
var src = props.src, autoplay = props.autoplay, muted = props.muted, lowLatencyMode = props.lowLatencyMode, allowNativeHls = props.allowNativeHls, isLiveStream = props.isLiveStream, driftToleranceMs = props.driftToleranceMs, immediateManifestAds = props.immediateManifestAds, debugAdTiming = props.debugAdTiming, showCustomControls = props.showCustomControls, hideLoadingIndicator = props.hideLoadingIndicator, onVolumeToggle = props.onVolumeToggle, onFullscreenToggle = props.onFullscreenToggle, onControlClick = props.onControlClick, onReady = props.onReady, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, className = props.className, style = props.style, controls = props.controls, playsInline = props.playsInline, preload = props.preload, poster = props.poster, children = props.children, licenseKey = props.licenseKey, vastMode = props.vastMode, vastTagUrl = props.vastTagUrl, isVmap = props.isVmap, vmapUrl = props.vmapUrl, minSegmentsBeforePlay = props.minSegmentsBeforePlay, ctvAdRequest = props.ctvAdRequest, programTitle = props.programTitle, restVideoAttrs = _object_without_properties(props, [
|
|
9706
|
-
"src",
|
|
9707
|
-
"autoplay",
|
|
9708
|
-
"muted",
|
|
9709
|
-
"lowLatencyMode",
|
|
9710
|
-
"allowNativeHls",
|
|
9711
|
-
"isLiveStream",
|
|
9712
|
-
"driftToleranceMs",
|
|
9713
|
-
"immediateManifestAds",
|
|
9714
|
-
"debugAdTiming",
|
|
9715
|
-
"showCustomControls",
|
|
9716
|
-
"hideLoadingIndicator",
|
|
9717
|
-
"onVolumeToggle",
|
|
9718
|
-
"onFullscreenToggle",
|
|
9719
|
-
"onControlClick",
|
|
9720
|
-
"onReady",
|
|
9721
|
-
"wrapperClassName",
|
|
9722
|
-
"wrapperStyle",
|
|
9723
|
-
"className",
|
|
9724
|
-
"style",
|
|
9725
|
-
"controls",
|
|
9726
|
-
"playsInline",
|
|
9727
|
-
"preload",
|
|
9728
|
-
"poster",
|
|
9729
|
-
"children",
|
|
9730
|
-
"licenseKey",
|
|
9731
|
-
"vastMode",
|
|
9732
|
-
"vastTagUrl",
|
|
9733
|
-
"isVmap",
|
|
9734
|
-
"vmapUrl",
|
|
9735
|
-
"minSegmentsBeforePlay",
|
|
9736
|
-
"ctvAdRequest",
|
|
9737
|
-
"programTitle"
|
|
9738
|
-
]);
|
|
9739
|
-
var videoRef = useRef(null);
|
|
9740
|
-
var playerRef = useRef(null);
|
|
9741
|
-
var bufferingTimeoutRef = useRef(null);
|
|
9742
|
-
var controlsTimerRef = useRef(null);
|
|
9743
|
-
var wrapperRef = useRef(null);
|
|
9744
|
-
var _React_useState = _sliced_to_array(React.useState({
|
|
9745
|
-
showAds: false,
|
|
9746
|
-
currentIndex: 0,
|
|
9747
|
-
totalAds: 0,
|
|
9748
|
-
remainingSeconds: 0
|
|
9749
|
-
}), 2), adStatus = _React_useState[0], setAdStatus = _React_useState[1];
|
|
9750
|
-
var _React_useState1 = _sliced_to_array(React.useState(true), 2), shouldShowNativeControls = _React_useState1[0], setShouldShowNativeControls = _React_useState1[1];
|
|
9751
|
-
var _React_useState2 = _sliced_to_array(React.useState(false), 2), isMuted2 = _React_useState2[0], setIsMuted = _React_useState2[1];
|
|
9752
|
-
var _React_useState3 = _sliced_to_array(React.useState(false), 2), isFullscreen2 = _React_useState3[0], setIsFullscreen = _React_useState3[1];
|
|
9753
|
-
var _React_useState4 = _sliced_to_array(React.useState(false), 2), isPlaying = _React_useState4[0], setIsPlaying = _React_useState4[1];
|
|
9754
|
-
var _React_useState5 = _sliced_to_array(React.useState(0), 2), currentTime = _React_useState5[0], setCurrentTime = _React_useState5[1];
|
|
9755
|
-
var _React_useState6 = _sliced_to_array(React.useState(0), 2), duration = _React_useState6[0], setDuration = _React_useState6[1];
|
|
9756
|
-
var _React_useState7 = _sliced_to_array(React.useState(1), 2), volume = _React_useState7[0], setVolume2 = _React_useState7[1];
|
|
9757
|
-
var _React_useState8 = _sliced_to_array(React.useState(1), 2), playbackRate = _React_useState8[0], setPlaybackRate = _React_useState8[1];
|
|
9758
|
-
var _React_useState9 = _sliced_to_array(React.useState(false), 2), showVolumeSlider = _React_useState9[0], setShowVolumeSlider = _React_useState9[1];
|
|
9759
|
-
var _React_useState10 = _sliced_to_array(React.useState(false), 2), showSpeedMenu = _React_useState10[0], setShowSpeedMenu = _React_useState10[1];
|
|
9760
|
-
var _React_useState11 = _sliced_to_array(React.useState(true), 2), isLoading = _React_useState11[0], setIsLoading = _React_useState11[1];
|
|
9761
|
-
var _React_useState12 = _sliced_to_array(React.useState(false), 2), isBuffering = _React_useState12[0], setIsBuffering = _React_useState12[1];
|
|
9762
|
-
var _React_useState13 = _sliced_to_array(React.useState(false), 2), showCenterPlay = _React_useState13[0], setShowCenterPlay = _React_useState13[1];
|
|
9763
|
-
var _React_useState14 = _sliced_to_array(React.useState(false), 2), showLicenseWarning = _React_useState14[0], setShowLicenseWarning = _React_useState14[1];
|
|
9764
|
-
var _React_useState15 = _sliced_to_array(React.useState(true), 2), controlsVisible = _React_useState15[0], setControlsVisible = _React_useState15[1];
|
|
9765
|
-
var _React_useState16 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerWidth : 1920), 2), viewportWidth = _React_useState16[0], setViewportWidth = _React_useState16[1];
|
|
9766
|
-
var _React_useState17 = _sliced_to_array(React.useState(typeof window !== "undefined" ? window.innerHeight > window.innerWidth : false), 2), isPortrait = _React_useState17[0], setIsPortrait = _React_useState17[1];
|
|
9767
|
-
var _React_useState18 = _sliced_to_array(React.useState(DEFAULT_PLAYER_ASPECT_RATIO), 2), playerAspectRatio = _React_useState18[0], setPlayerAspectRatio = _React_useState18[1];
|
|
9768
|
-
var getResponsiveScale = function getResponsiveScale() {
|
|
9769
|
-
if (viewportWidth < 480) return 0.7;
|
|
9770
|
-
if (viewportWidth < 768) return 0.8;
|
|
9771
|
-
if (viewportWidth < 1024) return 0.9;
|
|
9772
|
-
return 1;
|
|
9773
|
-
};
|
|
9774
|
-
var responsiveScale = getResponsiveScale();
|
|
9775
|
-
var resetControlsTimer = useCallback(function() {
|
|
9776
|
-
if (controlsTimerRef.current) {
|
|
9777
|
-
clearTimeout(controlsTimerRef.current);
|
|
9778
|
-
}
|
|
9779
|
-
setControlsVisible(true);
|
|
9780
|
-
controlsTimerRef.current = window.setTimeout(function() {
|
|
9781
|
-
if (!showVolumeSlider && !showSpeedMenu) {
|
|
9782
|
-
setControlsVisible(false);
|
|
9783
|
-
}
|
|
9784
|
-
}, CONTROLS_HIDE_DELAY);
|
|
9785
|
-
}, [
|
|
9786
|
-
showVolumeSlider,
|
|
9787
|
-
showSpeedMenu
|
|
9788
|
-
]);
|
|
9789
|
-
var handleWrapperMouseMove = useCallback(function() {
|
|
9790
|
-
resetControlsTimer();
|
|
9791
|
-
}, [
|
|
9792
|
-
resetControlsTimer
|
|
9793
|
-
]);
|
|
9794
|
-
var handleWrapperMouseLeave = useCallback(function() {
|
|
9795
|
-
if (!showVolumeSlider && !showSpeedMenu) {
|
|
9796
|
-
setControlsVisible(false);
|
|
9797
|
-
}
|
|
9798
|
-
}, [
|
|
9799
|
-
showVolumeSlider,
|
|
9800
|
-
showSpeedMenu
|
|
9801
|
-
]);
|
|
9802
|
-
var formatTime = function formatTime(seconds) {
|
|
9803
|
-
if (!isFinite(seconds)) return "0:00:00";
|
|
9804
|
-
var hours = Math.floor(seconds / 3600);
|
|
9805
|
-
var minutes = Math.floor(seconds % 3600 / 60);
|
|
9806
|
-
var remainingSeconds = Math.floor(seconds % 60);
|
|
9807
|
-
return "".concat(hours, ":").concat(minutes.toString().padStart(2, "0"), ":").concat(remainingSeconds.toString().padStart(2, "0"));
|
|
9808
|
-
};
|
|
9809
|
-
var handlePlayPause = function handlePlayPause() {
|
|
9810
|
-
if (videoRef.current) {
|
|
9811
|
-
if (videoRef.current.paused) {
|
|
9812
|
-
var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
|
|
9813
|
-
if (hasValidSource) {
|
|
9814
|
-
var _videoRef_current_play;
|
|
9815
|
-
(_videoRef_current_play = videoRef.current.play()) === null || _videoRef_current_play === void 0 ? void 0 : _videoRef_current_play.catch(function(error) {
|
|
9816
|
-
console.error("[StormcloudVideoPlayer] Failed to play:", error);
|
|
9817
|
-
});
|
|
9818
|
-
setShowCenterPlay(false);
|
|
9819
|
-
} else {
|
|
9820
|
-
console.warn("[StormcloudVideoPlayer] Cannot play: video has no valid source");
|
|
9821
|
-
}
|
|
9822
|
-
} else {
|
|
9823
|
-
videoRef.current.pause();
|
|
9824
|
-
setShowCenterPlay(true);
|
|
9825
|
-
}
|
|
9826
|
-
}
|
|
9827
|
-
resetControlsTimer();
|
|
9828
|
-
};
|
|
9829
|
-
var handleCenterPlayClick = function handleCenterPlayClick() {
|
|
9830
|
-
if (videoRef.current && videoRef.current.paused) {
|
|
9831
|
-
var hasValidSource = videoRef.current.src || videoRef.current.currentSrc && videoRef.current.currentSrc !== "" || videoRef.current.readyState >= 1;
|
|
9832
|
-
if (hasValidSource) {
|
|
9833
|
-
var _videoRef_current_play;
|
|
9834
|
-
(_videoRef_current_play = videoRef.current.play()) === null || _videoRef_current_play === void 0 ? void 0 : _videoRef_current_play.catch(function(error) {
|
|
9835
|
-
console.error("[StormcloudVideoPlayer] Failed to play:", error);
|
|
9836
|
-
});
|
|
9837
|
-
setShowCenterPlay(false);
|
|
9838
|
-
} else {
|
|
9839
|
-
console.warn("[StormcloudVideoPlayer] Cannot play: video has no valid source");
|
|
9840
|
-
}
|
|
9841
|
-
}
|
|
9842
|
-
};
|
|
9843
|
-
var handleTimelineSeek = function handleTimelineSeek(e) {
|
|
9844
|
-
if (videoRef.current && duration > 0 && isFinite(duration)) {
|
|
9845
|
-
var rect = e.currentTarget.getBoundingClientRect();
|
|
9846
|
-
var clickX = e.clientX - rect.left;
|
|
9847
|
-
var progress = Math.max(0, Math.min(1, clickX / rect.width));
|
|
9848
|
-
var newTime = progress * duration;
|
|
9849
|
-
if (isFinite(newTime) && newTime >= 0 && newTime <= duration) {
|
|
9850
|
-
videoRef.current.currentTime = newTime;
|
|
9851
|
-
}
|
|
9852
|
-
}
|
|
9853
|
-
resetControlsTimer();
|
|
9854
|
-
};
|
|
9855
|
-
var handleVolumeChange = function handleVolumeChange(newVolume) {
|
|
9856
|
-
if (playerRef.current && isFinite(newVolume)) {
|
|
9857
|
-
var clampedVolume = Math.max(0, Math.min(1, newVolume));
|
|
9858
|
-
playerRef.current.setVolume(clampedVolume);
|
|
9859
|
-
}
|
|
9860
|
-
};
|
|
9861
|
-
var handlePlaybackRateChange = function handlePlaybackRateChange(rate) {
|
|
9862
|
-
if (videoRef.current && isFinite(rate) && rate > 0) {
|
|
9863
|
-
videoRef.current.playbackRate = rate;
|
|
9864
|
-
}
|
|
9865
|
-
setShowSpeedMenu(false);
|
|
9866
|
-
};
|
|
9867
|
-
var isHlsStream = (src === null || src === void 0 ? void 0 : src.toLowerCase().includes(".m3u8")) || (src === null || src === void 0 ? void 0 : src.toLowerCase().includes("/hls/"));
|
|
9868
|
-
var isLiveUiMode = isLiveStream === true;
|
|
9869
|
-
var shouldShowEnhancedControls = showCustomControls && (isHlsStream ? !isLiveUiMode : true);
|
|
9870
|
-
var criticalPropsKey = useMemo(function() {
|
|
9871
|
-
return CRITICAL_PROPS.map(function(prop) {
|
|
9872
|
-
return "".concat(prop, ":").concat(props[prop]);
|
|
9873
|
-
}).join("|");
|
|
9874
|
-
}, [
|
|
9875
|
-
src,
|
|
9876
|
-
allowNativeHls,
|
|
9877
|
-
isLiveStream,
|
|
9878
|
-
licenseKey,
|
|
9879
|
-
isVmap,
|
|
9880
|
-
vmapUrl,
|
|
9881
|
-
lowLatencyMode,
|
|
9882
|
-
driftToleranceMs,
|
|
9883
|
-
vastMode
|
|
9884
|
-
]);
|
|
9885
|
-
useEffect(function() {
|
|
9886
|
-
if (typeof window === "undefined") return;
|
|
9887
|
-
var el = videoRef.current;
|
|
9888
|
-
if (!el || !src) return;
|
|
9889
|
-
if (!licenseKey) {
|
|
9890
|
-
setShowLicenseWarning(true);
|
|
9891
|
-
setIsLoading(false);
|
|
9892
|
-
console.warn("StormcloudVideoPlayer: License key is required but not provided. Please set the licenseKey prop to use the player.");
|
|
9893
|
-
return;
|
|
9894
|
-
}
|
|
9895
|
-
setShowLicenseWarning(false);
|
|
9896
|
-
if (debugAdTiming) {
|
|
9897
|
-
console.log("[StormcloudUI] Initializing player, isLoading=true");
|
|
9898
|
-
}
|
|
9899
|
-
if (playerRef.current) {
|
|
9900
|
-
try {
|
|
9901
|
-
playerRef.current.destroy();
|
|
9902
|
-
} catch (unused) {}
|
|
9903
|
-
playerRef.current = null;
|
|
9904
|
-
}
|
|
9905
|
-
var cfg = {
|
|
9906
|
-
src: src,
|
|
9907
|
-
videoElement: el
|
|
9908
|
-
};
|
|
9909
|
-
if (autoplay !== void 0) cfg.autoplay = autoplay;
|
|
9910
|
-
if (muted !== void 0) cfg.muted = muted;
|
|
9911
|
-
if (lowLatencyMode !== void 0) cfg.lowLatencyMode = lowLatencyMode;
|
|
9912
|
-
if (allowNativeHls !== void 0) cfg.allowNativeHls = allowNativeHls;
|
|
9913
|
-
if (isLiveStream !== void 0) cfg.isLiveStream = isLiveStream;
|
|
9914
|
-
if (driftToleranceMs !== void 0) cfg.driftToleranceMs = driftToleranceMs;
|
|
9915
|
-
if (immediateManifestAds !== void 0) cfg.immediateManifestAds = immediateManifestAds;
|
|
9916
|
-
if (debugAdTiming !== void 0) cfg.debugAdTiming = debugAdTiming;
|
|
9917
|
-
if (showCustomControls !== void 0) cfg.showCustomControls = showCustomControls;
|
|
9918
|
-
if (onVolumeToggle !== void 0) cfg.onVolumeToggle = onVolumeToggle;
|
|
9919
|
-
if (onFullscreenToggle !== void 0) cfg.onFullscreenToggle = onFullscreenToggle;
|
|
9920
|
-
if (onControlClick !== void 0) cfg.onControlClick = onControlClick;
|
|
9921
|
-
if (licenseKey !== void 0) cfg.licenseKey = licenseKey;
|
|
9922
|
-
if (vastMode !== void 0) cfg.vastMode = vastMode;
|
|
9923
|
-
if (vastTagUrl !== void 0) cfg.vastTagUrl = vastTagUrl;
|
|
9924
|
-
if (isVmap !== void 0) cfg.isVmap = isVmap;
|
|
9925
|
-
if (vmapUrl !== void 0) cfg.vmapUrl = vmapUrl;
|
|
9926
|
-
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
9927
|
-
if (ctvAdRequest !== void 0) cfg.ctvAdRequest = ctvAdRequest;
|
|
9928
|
-
if (programTitle !== void 0) cfg.programTitle = programTitle;
|
|
9929
|
-
var player = new StormcloudVideoPlayer(cfg);
|
|
9930
|
-
playerRef.current = player;
|
|
9931
|
-
player.load().then(function() {
|
|
9932
|
-
var showNative = player.shouldShowNativeControls();
|
|
9933
|
-
setShouldShowNativeControls(showNative);
|
|
9934
|
-
if (debugAdTiming) {
|
|
9935
|
-
console.log("[StormcloudUI] Player loaded successfully, waiting for video ready");
|
|
9936
|
-
}
|
|
9937
|
-
onReady === null || onReady === void 0 ? void 0 : onReady(player);
|
|
9938
|
-
}).catch(function(error) {
|
|
9939
|
-
console.error("StormcloudVideoPlayer: Failed to load player:", error);
|
|
9940
|
-
setIsLoading(false);
|
|
9941
|
-
onReady === null || onReady === void 0 ? void 0 : onReady(player);
|
|
9942
|
-
});
|
|
9943
|
-
return function() {
|
|
9944
|
-
try {
|
|
9945
|
-
player.destroy();
|
|
9946
|
-
} catch (unused) {}
|
|
9947
|
-
playerRef.current = null;
|
|
9948
|
-
};
|
|
9949
|
-
}, [
|
|
9950
|
-
criticalPropsKey
|
|
9951
|
-
]);
|
|
9952
|
-
useEffect(function() {
|
|
9953
|
-
if (!playerRef.current) return;
|
|
9954
|
-
try {
|
|
9955
|
-
if (autoplay !== void 0 && playerRef.current.videoElement) {
|
|
9956
|
-
playerRef.current.videoElement.autoplay = autoplay;
|
|
9957
|
-
}
|
|
9958
|
-
if (muted !== void 0 && !playerRef.current.isShowingAds()) {
|
|
9959
|
-
playerRef.current.setMuted(muted);
|
|
9960
|
-
}
|
|
9961
|
-
} catch (error) {
|
|
9962
|
-
console.warn("Failed to update player properties:", error);
|
|
9963
|
-
}
|
|
9964
|
-
}, [
|
|
9965
|
-
autoplay,
|
|
9966
|
-
muted
|
|
9967
|
-
]);
|
|
9968
|
-
useEffect(function() {
|
|
9969
|
-
if (!playerRef.current) return;
|
|
9970
|
-
var checkAdStatus = function checkAdStatus() {
|
|
9971
|
-
if (playerRef.current) {
|
|
9972
|
-
var _videoRef_current_dataset, _videoRef_current;
|
|
9973
|
-
var showAdsFromMethod = playerRef.current.isShowingAds();
|
|
9974
|
-
var showAdsFromAttribute = ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : (_videoRef_current_dataset = _videoRef_current.dataset) === null || _videoRef_current_dataset === void 0 ? void 0 : _videoRef_current_dataset.stormcloudAdPlaying) === "true";
|
|
9975
|
-
var showAds = showAdsFromMethod || showAdsFromAttribute;
|
|
9976
|
-
var currentIndex = playerRef.current.getCurrentAdIndex();
|
|
9977
|
-
var totalAds = playerRef.current.getTotalAdsInBreak();
|
|
9978
|
-
var remainingMs = playerRef.current.getAdRemainingMs();
|
|
9979
|
-
var remainingSeconds = showAds ? Math.max(0, Math.ceil(remainingMs / 1e3)) : 0;
|
|
9980
|
-
setAdStatus(function(prev) {
|
|
9981
|
-
if (prev.showAds !== showAds || prev.currentIndex !== currentIndex || prev.totalAds !== totalAds || prev.remainingSeconds !== remainingSeconds) {
|
|
9982
|
-
if (showAds && !prev.showAds) {
|
|
9983
|
-
setShowCenterPlay(false);
|
|
9984
|
-
}
|
|
9985
|
-
return {
|
|
9986
|
-
showAds: showAds,
|
|
9987
|
-
currentIndex: currentIndex,
|
|
9988
|
-
totalAds: totalAds,
|
|
9989
|
-
remainingSeconds: remainingSeconds
|
|
9990
|
-
};
|
|
9991
|
-
}
|
|
9992
|
-
return prev;
|
|
9993
|
-
});
|
|
9994
|
-
}
|
|
9995
|
-
};
|
|
9996
|
-
var interval = setInterval(checkAdStatus, 50);
|
|
9997
|
-
return function() {
|
|
9998
|
-
return clearInterval(interval);
|
|
9999
|
-
};
|
|
10000
|
-
}, []);
|
|
10001
|
-
useEffect(function() {
|
|
10002
|
-
if (typeof window === "undefined" || !playerRef.current) return;
|
|
10003
|
-
var handleResize = function handleResize() {
|
|
10004
|
-
if (playerRef.current && videoRef.current) {
|
|
10005
|
-
if (typeof playerRef.current.resize === "function") {
|
|
10006
|
-
playerRef.current.resize();
|
|
10007
|
-
}
|
|
10008
|
-
}
|
|
10009
|
-
setViewportWidth(window.innerWidth);
|
|
10010
|
-
setIsPortrait(window.innerHeight > window.innerWidth);
|
|
10011
|
-
};
|
|
10012
|
-
window.addEventListener("resize", handleResize);
|
|
10013
|
-
return function() {
|
|
10014
|
-
return window.removeEventListener("resize", handleResize);
|
|
10015
|
-
};
|
|
10016
|
-
}, []);
|
|
10017
|
-
useEffect(function() {
|
|
10018
|
-
if (!playerRef.current || !videoRef.current) return;
|
|
10019
|
-
var updateStates = function updateStates() {
|
|
10020
|
-
if (playerRef.current && videoRef.current) {
|
|
10021
|
-
setIsMuted(playerRef.current.isMuted());
|
|
10022
|
-
setIsPlaying(!videoRef.current.paused);
|
|
10023
|
-
var currentTimeValue = videoRef.current.currentTime;
|
|
10024
|
-
setCurrentTime(isFinite(currentTimeValue) ? currentTimeValue : 0);
|
|
10025
|
-
var durationValue = videoRef.current.duration;
|
|
10026
|
-
setDuration(isFinite(durationValue) ? durationValue : 0);
|
|
10027
|
-
var volumeValue = playerRef.current.getVolume();
|
|
10028
|
-
setVolume2(isFinite(volumeValue) ? Math.max(0, Math.min(1, volumeValue)) : 1);
|
|
10029
|
-
var rateValue = videoRef.current.playbackRate;
|
|
10030
|
-
setPlaybackRate(isFinite(rateValue) && rateValue > 0 ? rateValue : 1);
|
|
10031
|
-
}
|
|
10032
|
-
setIsFullscreen(document.fullscreenElement === wrapperRef.current);
|
|
10033
|
-
};
|
|
10034
|
-
var interval = setInterval(updateStates, 200);
|
|
10035
|
-
var handleFullscreenChange = function handleFullscreenChange() {
|
|
10036
|
-
setIsFullscreen(document.fullscreenElement === wrapperRef.current);
|
|
10037
|
-
};
|
|
10038
|
-
document.addEventListener("fullscreenchange", handleFullscreenChange);
|
|
10039
|
-
return function() {
|
|
10040
|
-
clearInterval(interval);
|
|
10041
|
-
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
10042
|
-
};
|
|
10043
|
-
}, []);
|
|
10044
|
-
useEffect(function() {
|
|
10045
|
-
if (!videoRef.current) return;
|
|
10046
|
-
var handleLoadedMetadata = function handleLoadedMetadata() {
|
|
10047
|
-
var video2 = videoRef.current;
|
|
10048
|
-
if (video2) {
|
|
10049
|
-
if (video2.videoWidth > 0 && video2.videoHeight > 0) {
|
|
10050
|
-
setPlayerAspectRatio(video2.videoWidth / video2.videoHeight);
|
|
10051
|
-
}
|
|
10052
|
-
void video2.offsetHeight;
|
|
10053
|
-
}
|
|
10054
|
-
if (debugAdTiming) {
|
|
10055
|
-
var _videoRef_current;
|
|
10056
|
-
console.log("[StormcloudUI] Video event: loadedmetadata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
|
|
10057
|
-
}
|
|
10058
|
-
};
|
|
10059
|
-
var handleLoadedData = function handleLoadedData() {
|
|
10060
|
-
if (debugAdTiming) {
|
|
10061
|
-
var _videoRef_current;
|
|
10062
|
-
console.log("[StormcloudUI] Video event: loadeddata, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
|
|
10063
|
-
}
|
|
10064
|
-
};
|
|
10065
|
-
var handleLoadStart = function handleLoadStart() {
|
|
10066
|
-
if (debugAdTiming) {
|
|
10067
|
-
var _videoRef_current;
|
|
10068
|
-
console.log("[StormcloudUI] Video event: loadstart, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState);
|
|
10069
|
-
}
|
|
10070
|
-
};
|
|
10071
|
-
var handleCanPlay = function handleCanPlay() {
|
|
10072
|
-
setIsLoading(false);
|
|
10073
|
-
if (bufferingTimeoutRef.current) {
|
|
10074
|
-
clearTimeout(bufferingTimeoutRef.current);
|
|
10075
|
-
bufferingTimeoutRef.current = null;
|
|
10076
|
-
}
|
|
10077
|
-
setIsBuffering(false);
|
|
10078
|
-
if (debugAdTiming) {
|
|
10079
|
-
var _videoRef_current;
|
|
10080
|
-
console.log("[StormcloudUI] Video event: canplay, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- clearing loading state, isLoading=false");
|
|
10081
|
-
}
|
|
10082
|
-
};
|
|
10083
|
-
var handleCanPlayThrough = function handleCanPlayThrough() {
|
|
10084
|
-
setIsLoading(false);
|
|
10085
|
-
if (bufferingTimeoutRef.current) {
|
|
10086
|
-
clearTimeout(bufferingTimeoutRef.current);
|
|
10087
|
-
bufferingTimeoutRef.current = null;
|
|
10088
|
-
}
|
|
10089
|
-
setIsBuffering(false);
|
|
10090
|
-
if (debugAdTiming) {
|
|
10091
|
-
var _videoRef_current;
|
|
10092
|
-
console.log("[StormcloudUI] Video event: canplaythrough, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- clearing loading state, isLoading=false");
|
|
10093
|
-
}
|
|
10094
|
-
};
|
|
10095
|
-
var handleWaiting = function handleWaiting() {
|
|
10096
|
-
if (bufferingTimeoutRef.current) {
|
|
10097
|
-
clearTimeout(bufferingTimeoutRef.current);
|
|
10098
|
-
}
|
|
10099
|
-
bufferingTimeoutRef.current = window.setTimeout(function() {
|
|
10100
|
-
setIsBuffering(true);
|
|
10101
|
-
if (debugAdTiming) {
|
|
10102
|
-
var _videoRef_current;
|
|
10103
|
-
console.log("[StormcloudUI] Video buffering detected (after 300ms delay), readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- showing spinner, isBuffering=true");
|
|
10104
|
-
}
|
|
10105
|
-
}, 300);
|
|
10106
|
-
if (debugAdTiming) {
|
|
10107
|
-
var _videoRef_current;
|
|
10108
|
-
console.log("[StormcloudUI] Video event: waiting, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- buffering delay started (300ms)");
|
|
10109
|
-
}
|
|
10110
|
-
};
|
|
10111
|
-
var handlePlaying = function handlePlaying() {
|
|
10112
|
-
setIsLoading(false);
|
|
10113
|
-
if (bufferingTimeoutRef.current) {
|
|
10114
|
-
clearTimeout(bufferingTimeoutRef.current);
|
|
10115
|
-
bufferingTimeoutRef.current = null;
|
|
10116
|
-
}
|
|
10117
|
-
setIsBuffering(false);
|
|
10118
|
-
setShowCenterPlay(false);
|
|
10119
|
-
if (debugAdTiming) {
|
|
10120
|
-
var _videoRef_current;
|
|
10121
|
-
console.log("[StormcloudUI] Video event: playing, readyState:", (_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : _videoRef_current.readyState, "- playback started, isLoading=false, isBuffering=false");
|
|
10122
|
-
}
|
|
10123
|
-
};
|
|
10124
|
-
var handlePause = function handlePause() {
|
|
10125
|
-
var _playerRef_current, _videoRef_current_dataset, _videoRef_current;
|
|
10126
|
-
var isAdActive = ((_playerRef_current = playerRef.current) === null || _playerRef_current === void 0 ? void 0 : _playerRef_current.isShowingAds()) || ((_videoRef_current = videoRef.current) === null || _videoRef_current === void 0 ? void 0 : (_videoRef_current_dataset = _videoRef_current.dataset) === null || _videoRef_current_dataset === void 0 ? void 0 : _videoRef_current_dataset.stormcloudAdPlaying) === "true";
|
|
10127
|
-
if (playerRef.current && !isAdActive) {
|
|
10128
|
-
setShowCenterPlay(true);
|
|
10129
|
-
} else {
|
|
10130
|
-
setShowCenterPlay(false);
|
|
10131
|
-
}
|
|
10132
|
-
};
|
|
10133
|
-
var handleEnded = function handleEnded() {
|
|
10134
|
-
setShowCenterPlay(true);
|
|
10135
|
-
};
|
|
10136
|
-
var video = videoRef.current;
|
|
10137
|
-
video.addEventListener("loadstart", handleLoadStart);
|
|
10138
|
-
video.addEventListener("loadedmetadata", handleLoadedMetadata);
|
|
10139
|
-
video.addEventListener("loadeddata", handleLoadedData);
|
|
10140
|
-
video.addEventListener("canplay", handleCanPlay);
|
|
10141
|
-
video.addEventListener("canplaythrough", handleCanPlayThrough);
|
|
10142
|
-
video.addEventListener("waiting", handleWaiting);
|
|
10143
|
-
video.addEventListener("playing", handlePlaying);
|
|
10144
|
-
video.addEventListener("pause", handlePause);
|
|
10145
|
-
video.addEventListener("ended", handleEnded);
|
|
10146
|
-
if (video.paused) {
|
|
10147
|
-
setShowCenterPlay(true);
|
|
10148
|
-
}
|
|
10149
|
-
return function() {
|
|
10150
|
-
if (bufferingTimeoutRef.current) {
|
|
10151
|
-
clearTimeout(bufferingTimeoutRef.current);
|
|
10152
|
-
bufferingTimeoutRef.current = null;
|
|
10153
|
-
}
|
|
10154
|
-
video.removeEventListener("loadstart", handleLoadStart);
|
|
10155
|
-
video.removeEventListener("loadedmetadata", handleLoadedMetadata);
|
|
10156
|
-
video.removeEventListener("loadeddata", handleLoadedData);
|
|
10157
|
-
video.removeEventListener("canplay", handleCanPlay);
|
|
10158
|
-
video.removeEventListener("canplaythrough", handleCanPlayThrough);
|
|
10159
|
-
video.removeEventListener("waiting", handleWaiting);
|
|
10160
|
-
video.removeEventListener("playing", handlePlaying);
|
|
10161
|
-
video.removeEventListener("pause", handlePause);
|
|
10162
|
-
video.removeEventListener("ended", handleEnded);
|
|
10163
|
-
};
|
|
10164
|
-
}, [
|
|
10165
|
-
debugAdTiming
|
|
10166
|
-
]);
|
|
10167
|
-
useEffect(function() {
|
|
10168
|
-
setPlayerAspectRatio(DEFAULT_PLAYER_ASPECT_RATIO);
|
|
10169
|
-
}, [
|
|
10170
|
-
src
|
|
10171
|
-
]);
|
|
10172
|
-
useEffect(function() {
|
|
10173
|
-
return function() {
|
|
10174
|
-
if (controlsTimerRef.current) {
|
|
10175
|
-
clearTimeout(controlsTimerRef.current);
|
|
10176
|
-
}
|
|
10177
|
-
};
|
|
10178
|
-
}, []);
|
|
10179
|
-
var progressPercent = duration > 0 ? currentTime / duration * 100 : 0;
|
|
10180
|
-
var VolumeIcon = isMuted2 || volume === 0 ? FaVolumeMute : volume < 0.5 ? FaVolumeDown : FaVolumeUp;
|
|
10181
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
10182
|
-
children: [
|
|
10183
|
-
/* @__PURE__ */ jsx("style", {
|
|
10184
|
-
children: "\n @keyframes sc-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n @keyframes sc-loading-glow {\n 0%, 100% { opacity: 0.85; transform: scale(1); }\n 50% { opacity: 1; transform: scale(1.05); }\n }\n @keyframes sc-pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.6; }\n }\n @keyframes sc-fade-in {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n }\n .sc-wrapper:fullscreen,\n .sc-wrapper:has(*:fullscreen) {\n border-radius: 0 !important;\n box-shadow: none !important;\n width: 100vw !important;\n height: 100vh !important;\n max-width: 100vw !important;\n max-height: 100vh !important;\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n z-index: 999999 !important;\n background: #000 !important;\n display: flex !important;\n align-items: center !important;\n justify-content: center !important;\n }\n .sc-ctrl-btn {\n background: none;\n border: none;\n color: #fff;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n padding: 8px;\n transition: background 0.15s ease, opacity 0.15s ease;\n opacity: 0.9;\n }\n .sc-ctrl-btn:hover {\n opacity: 1;\n background: rgba(255, 255, 255, 0.1);\n }\n .sc-ctrl-btn:active {\n opacity: 0.7;\n }\n .sc-controls-bar {\n transition: opacity 0.35s ease, transform 0.35s ease;\n }\n .sc-progress-track:hover .sc-progress-thumb {\n transform: translate(-50%, -50%) scale(1) !important;\n }\n .sc-loading-hidden .sc-loading-indicator {\n display: none !important;\n }\n "
|
|
10185
|
-
}),
|
|
10186
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10187
|
-
ref: wrapperRef,
|
|
10188
|
-
className: "sc-wrapper ".concat(wrapperClassName || ""),
|
|
10189
|
-
onMouseMove: handleWrapperMouseMove,
|
|
10190
|
-
onMouseLeave: handleWrapperMouseLeave,
|
|
10191
|
-
style: _object_spread({
|
|
10192
|
-
display: "flex",
|
|
10193
|
-
alignItems: "center",
|
|
10194
|
-
justifyContent: "center",
|
|
10195
|
-
position: isFullscreen2 ? "fixed" : "relative",
|
|
10196
|
-
top: isFullscreen2 ? 0 : void 0,
|
|
10197
|
-
left: isFullscreen2 ? 0 : void 0,
|
|
10198
|
-
overflow: "hidden",
|
|
10199
|
-
width: isFullscreen2 ? "100vw" : "100%",
|
|
10200
|
-
height: isFullscreen2 ? "100vh" : "auto",
|
|
10201
|
-
minHeight: isFullscreen2 ? "100vh" : "auto",
|
|
10202
|
-
aspectRatio: isFullscreen2 ? void 0 : playerAspectRatio,
|
|
10203
|
-
maxWidth: isFullscreen2 ? "100vw" : "100%",
|
|
10204
|
-
maxHeight: isFullscreen2 ? "100vh" : "none",
|
|
10205
|
-
zIndex: isFullscreen2 ? 999999 : void 0,
|
|
10206
|
-
backgroundColor: "#000",
|
|
10207
|
-
borderRadius: isFullscreen2 ? 0 : void 0,
|
|
10208
|
-
boxShadow: isFullscreen2 ? "none" : void 0
|
|
10209
|
-
}, wrapperStyle),
|
|
10210
|
-
children: [
|
|
10211
|
-
/* @__PURE__ */ jsx("video", _object_spread_props(_object_spread({
|
|
10212
|
-
ref: videoRef,
|
|
10213
|
-
className: className,
|
|
10214
|
-
style: _object_spread({
|
|
10215
|
-
display: "block",
|
|
10216
|
-
width: "100%",
|
|
10217
|
-
height: "100%",
|
|
10218
|
-
maxWidth: "100%",
|
|
10219
|
-
maxHeight: isFullscreen2 ? "100%" : "none",
|
|
10220
|
-
objectFit: isFullscreen2 ? "cover" : "contain",
|
|
10221
|
-
backgroundColor: "#000",
|
|
10222
|
-
aspectRatio: isFullscreen2 ? "unset" : void 0
|
|
10223
|
-
}, style),
|
|
10224
|
-
controls: shouldShowNativeControls && controls && !showCustomControls,
|
|
10225
|
-
playsInline: playsInline,
|
|
10226
|
-
preload: preload,
|
|
10227
|
-
poster: poster
|
|
10228
|
-
}, restVideoAttrs), {
|
|
10229
|
-
children: children
|
|
10230
|
-
})),
|
|
10231
|
-
(isLoading || isBuffering) && !hideLoadingIndicator && /* @__PURE__ */ jsxs("div", {
|
|
10232
|
-
className: "sc-loading-indicator",
|
|
10233
|
-
style: {
|
|
10234
|
-
position: "absolute",
|
|
10235
|
-
top: "50%",
|
|
10236
|
-
left: "50%",
|
|
10237
|
-
transform: "translate(-50%, -50%)",
|
|
10238
|
-
zIndex: 20,
|
|
10239
|
-
width: "".concat(Math.max(34, 38 * responsiveScale), "px"),
|
|
10240
|
-
height: "".concat(Math.max(34, 38 * responsiveScale), "px"),
|
|
10241
|
-
display: "flex",
|
|
10242
|
-
alignItems: "center",
|
|
10243
|
-
justifyContent: "center",
|
|
10244
|
-
animation: "sc-loading-glow 1.4s ease-in-out infinite",
|
|
10245
|
-
filter: "drop-shadow(0 6px 14px rgba(0, 0, 0, 0.55))"
|
|
10246
|
-
},
|
|
10247
|
-
children: [
|
|
10248
|
-
/* @__PURE__ */ jsx("div", {
|
|
10249
|
-
style: {
|
|
10250
|
-
position: "absolute",
|
|
10251
|
-
inset: 0,
|
|
10252
|
-
borderRadius: "50%",
|
|
10253
|
-
border: "3px solid rgba(255, 255, 255, 0.25)",
|
|
10254
|
-
borderTopColor: "#ff0000",
|
|
10255
|
-
borderRightColor: "rgba(255, 255, 255, 0.85)",
|
|
10256
|
-
animation: "sc-spin 0.8s linear infinite"
|
|
10257
|
-
}
|
|
10258
|
-
}),
|
|
10259
|
-
/* @__PURE__ */ jsx("div", {
|
|
10260
|
-
style: {
|
|
10261
|
-
width: "7px",
|
|
10262
|
-
height: "7px",
|
|
10263
|
-
borderRadius: "50%",
|
|
10264
|
-
background: "#ff0000",
|
|
10265
|
-
boxShadow: "0 0 10px rgba(255, 0, 0, 0.65)"
|
|
10266
|
-
}
|
|
10267
|
-
})
|
|
10268
|
-
]
|
|
10269
|
-
}),
|
|
10270
|
-
showLicenseWarning && /* @__PURE__ */ jsxs("div", {
|
|
10271
|
-
style: {
|
|
10272
|
-
position: "absolute",
|
|
10273
|
-
top: "50%",
|
|
10274
|
-
left: "50%",
|
|
10275
|
-
transform: "translate(-50%, -50%)",
|
|
10276
|
-
zIndex: 25,
|
|
10277
|
-
background: "rgba(220, 38, 38, 0.92)",
|
|
10278
|
-
backdropFilter: "blur(24px)",
|
|
10279
|
-
color: "white",
|
|
10280
|
-
padding: "28px 36px",
|
|
10281
|
-
borderRadius: "14px",
|
|
10282
|
-
border: "1px solid rgba(255, 255, 255, 0.15)",
|
|
10283
|
-
boxShadow: "0 24px 64px rgba(0, 0, 0, 0.5)",
|
|
10284
|
-
textAlign: "center",
|
|
10285
|
-
maxWidth: "400px",
|
|
10286
|
-
margin: "0 16px"
|
|
10287
|
-
},
|
|
10288
|
-
children: [
|
|
10289
|
-
/* @__PURE__ */ jsx("div", {
|
|
10290
|
-
style: {
|
|
10291
|
-
fontSize: "18px",
|
|
10292
|
-
fontWeight: "700",
|
|
10293
|
-
marginBottom: "10px",
|
|
10294
|
-
letterSpacing: "-0.02em"
|
|
10295
|
-
},
|
|
10296
|
-
children: "License Key Required"
|
|
10297
|
-
}),
|
|
10298
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10299
|
-
style: {
|
|
10300
|
-
fontSize: "13px",
|
|
10301
|
-
lineHeight: "1.6",
|
|
10302
|
-
color: "rgba(255, 255, 255, 0.85)"
|
|
10303
|
-
},
|
|
10304
|
-
children: [
|
|
10305
|
-
"Please provide a valid license key to use the Stormcloud Video Player.",
|
|
10306
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
10307
|
-
"Contact your administrator for licensing information."
|
|
10308
|
-
]
|
|
10309
|
-
})
|
|
10310
|
-
]
|
|
10311
|
-
}),
|
|
10312
|
-
adStatus.showAds && /* @__PURE__ */ jsx("div", {
|
|
10313
|
-
style: {
|
|
10314
|
-
position: "absolute",
|
|
10315
|
-
top: "".concat(12 * responsiveScale, "px"),
|
|
10316
|
-
left: "".concat(12 * responsiveScale, "px"),
|
|
10317
|
-
zIndex: 50,
|
|
10318
|
-
display: "flex",
|
|
10319
|
-
alignItems: "center",
|
|
10320
|
-
gap: "8px",
|
|
10321
|
-
pointerEvents: "none",
|
|
10322
|
-
animation: "sc-fade-in 0.3s ease"
|
|
10323
|
-
},
|
|
10324
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
10325
|
-
style: {
|
|
10326
|
-
background: "rgba(234, 179, 8, 0.95)",
|
|
10327
|
-
color: "#111",
|
|
10328
|
-
padding: "".concat(4 * responsiveScale, "px ").concat(12 * responsiveScale, "px"),
|
|
10329
|
-
borderRadius: "6px",
|
|
10330
|
-
fontSize: "".concat(11 * responsiveScale, "px"),
|
|
10331
|
-
fontWeight: 700,
|
|
10332
|
-
letterSpacing: "0.08em",
|
|
10333
|
-
textTransform: "uppercase",
|
|
10334
|
-
boxShadow: "0 2px 12px rgba(234, 179, 8, 0.35)"
|
|
10335
|
-
},
|
|
10336
|
-
children: "Ad ".concat(Math.max(1, adStatus.currentIndex))
|
|
10337
|
-
})
|
|
10338
|
-
}),
|
|
10339
|
-
showCenterPlay && !isLoading && !isBuffering && !showLicenseWarning && !adStatus.showAds && /* @__PURE__ */ jsx("div", {
|
|
10340
|
-
onClick: handleCenterPlayClick,
|
|
10341
|
-
style: {
|
|
10342
|
-
position: "absolute",
|
|
10343
|
-
top: "50%",
|
|
10344
|
-
left: "50%",
|
|
10345
|
-
transform: "translate(-50%, -50%)",
|
|
10346
|
-
zIndex: 15,
|
|
10347
|
-
cursor: "pointer",
|
|
10348
|
-
background: "rgba(0, 0, 0, 0.55)",
|
|
10349
|
-
backdropFilter: "blur(8px)",
|
|
10350
|
-
borderRadius: "50%",
|
|
10351
|
-
width: "".concat(92 * responsiveScale, "px"),
|
|
10352
|
-
height: "".concat(92 * responsiveScale, "px"),
|
|
10353
|
-
display: "flex",
|
|
10354
|
-
alignItems: "center",
|
|
10355
|
-
justifyContent: "center",
|
|
10356
|
-
transition: "background 0.2s ease, transform 0.2s ease",
|
|
10357
|
-
animation: "sc-fade-in 0.2s ease"
|
|
10358
|
-
},
|
|
10359
|
-
onMouseEnter: function onMouseEnter(e) {
|
|
10360
|
-
e.currentTarget.style.background = "rgba(0, 0, 0, 0.72)";
|
|
10361
|
-
e.currentTarget.style.transform = "translate(-50%, -50%) scale(1.06)";
|
|
10362
|
-
},
|
|
10363
|
-
onMouseLeave: function onMouseLeave(e) {
|
|
10364
|
-
e.currentTarget.style.background = "rgba(0, 0, 0, 0.55)";
|
|
10365
|
-
e.currentTarget.style.transform = "translate(-50%, -50%) scale(1)";
|
|
10366
|
-
},
|
|
10367
|
-
title: "Play",
|
|
10368
|
-
children: /* @__PURE__ */ jsx(FaPlay, {
|
|
10369
|
-
size: Math.max(24, 32 * responsiveScale),
|
|
10370
|
-
color: "white",
|
|
10371
|
-
style: {
|
|
10372
|
-
marginLeft: "4px"
|
|
10373
|
-
}
|
|
10374
|
-
})
|
|
10375
|
-
}),
|
|
10376
|
-
shouldShowEnhancedControls && !showLicenseWarning ? /* @__PURE__ */ jsxs("div", {
|
|
10377
|
-
className: "sc-controls-bar",
|
|
10378
|
-
style: {
|
|
10379
|
-
position: "absolute",
|
|
10380
|
-
bottom: 0,
|
|
10381
|
-
left: 0,
|
|
10382
|
-
right: 0,
|
|
10383
|
-
background: "linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.35) 60%, transparent 100%)",
|
|
10384
|
-
padding: "".concat(20 * responsiveScale, "px ").concat(12 * responsiveScale, "px ").concat(8 * responsiveScale, "px"),
|
|
10385
|
-
zIndex: 10,
|
|
10386
|
-
opacity: controlsVisible || adStatus.showAds ? 1 : 0,
|
|
10387
|
-
transform: controlsVisible || adStatus.showAds ? "translateY(0)" : "translateY(6px)",
|
|
10388
|
-
pointerEvents: controlsVisible || adStatus.showAds ? "auto" : "none"
|
|
10389
|
-
},
|
|
10390
|
-
children: [
|
|
10391
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10392
|
-
className: "sc-progress-track",
|
|
10393
|
-
style: {
|
|
10394
|
-
width: "100%",
|
|
10395
|
-
height: "3px",
|
|
10396
|
-
background: "rgba(255, 255, 255, 0.2)",
|
|
10397
|
-
borderRadius: "1.5px",
|
|
10398
|
-
marginBottom: "".concat(8 * responsiveScale, "px"),
|
|
10399
|
-
cursor: "pointer",
|
|
10400
|
-
position: "relative",
|
|
10401
|
-
transition: "height 0.1s ease"
|
|
10402
|
-
},
|
|
10403
|
-
onClick: handleTimelineSeek,
|
|
10404
|
-
onMouseEnter: function onMouseEnter(e) {
|
|
10405
|
-
e.currentTarget.style.height = "5px";
|
|
10406
|
-
},
|
|
10407
|
-
onMouseLeave: function onMouseLeave(e) {
|
|
10408
|
-
e.currentTarget.style.height = "3px";
|
|
10409
|
-
},
|
|
10410
|
-
children: [
|
|
10411
|
-
/* @__PURE__ */ jsx("div", {
|
|
10412
|
-
style: {
|
|
10413
|
-
position: "absolute",
|
|
10414
|
-
top: 0,
|
|
10415
|
-
left: 0,
|
|
10416
|
-
bottom: 0,
|
|
10417
|
-
background: adStatus.showAds ? "#f5c518" : "#ff0000",
|
|
10418
|
-
borderRadius: "1.5px",
|
|
10419
|
-
width: "".concat(progressPercent, "%"),
|
|
10420
|
-
transition: "width 0.15s linear"
|
|
10421
|
-
}
|
|
10422
|
-
}),
|
|
10423
|
-
/* @__PURE__ */ jsx("div", {
|
|
10424
|
-
className: "sc-progress-thumb",
|
|
10425
|
-
style: {
|
|
10426
|
-
position: "absolute",
|
|
10427
|
-
top: "50%",
|
|
10428
|
-
left: "".concat(progressPercent, "%"),
|
|
10429
|
-
transform: "translate(-50%, -50%) scale(0)",
|
|
10430
|
-
width: "13px",
|
|
10431
|
-
height: "13px",
|
|
10432
|
-
background: adStatus.showAds ? "#f5c518" : "#ff0000",
|
|
10433
|
-
borderRadius: "50%",
|
|
10434
|
-
boxShadow: "0 0 4px rgba(0, 0, 0, 0.3)",
|
|
10435
|
-
transition: "transform 0.1s ease, left 0.15s linear"
|
|
10436
|
-
}
|
|
10437
|
-
})
|
|
10438
|
-
]
|
|
10439
|
-
}),
|
|
10440
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10441
|
-
style: {
|
|
10442
|
-
display: "flex",
|
|
10443
|
-
alignItems: "center",
|
|
10444
|
-
justifyContent: "space-between",
|
|
10445
|
-
color: "white",
|
|
10446
|
-
gap: "".concat(8 * responsiveScale, "px")
|
|
10447
|
-
},
|
|
10448
|
-
children: [
|
|
10449
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10450
|
-
style: {
|
|
10451
|
-
display: "flex",
|
|
10452
|
-
alignItems: "center",
|
|
10453
|
-
gap: "".concat(8 * responsiveScale, "px")
|
|
10454
|
-
},
|
|
10455
|
-
children: [
|
|
10456
|
-
/* @__PURE__ */ jsx("button", {
|
|
10457
|
-
className: "sc-ctrl-btn",
|
|
10458
|
-
onClick: handlePlayPause,
|
|
10459
|
-
style: {
|
|
10460
|
-
padding: "".concat(8 * responsiveScale, "px"),
|
|
10461
|
-
borderRadius: "50%",
|
|
10462
|
-
minWidth: "".concat(36 * responsiveScale, "px"),
|
|
10463
|
-
minHeight: "".concat(36 * responsiveScale, "px")
|
|
10464
|
-
},
|
|
10465
|
-
title: isPlaying ? "Pause" : "Play",
|
|
10466
|
-
children: isPlaying ? /* @__PURE__ */ jsx(FaPause, {
|
|
10467
|
-
size: Math.max(14, 18 * responsiveScale)
|
|
10468
|
-
}) : /* @__PURE__ */ jsx(FaPlay, {
|
|
10469
|
-
size: Math.max(14, 18 * responsiveScale),
|
|
10470
|
-
style: {
|
|
10471
|
-
marginLeft: "2px"
|
|
10472
|
-
}
|
|
10473
|
-
})
|
|
10474
|
-
}),
|
|
10475
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10476
|
-
style: {
|
|
10477
|
-
display: "flex",
|
|
10478
|
-
alignItems: "center",
|
|
10479
|
-
paddingRight: "".concat(6 * responsiveScale, "px")
|
|
10480
|
-
},
|
|
10481
|
-
onMouseEnter: function onMouseEnter() {
|
|
10482
|
-
return setShowVolumeSlider(true);
|
|
10483
|
-
},
|
|
10484
|
-
onMouseLeave: function onMouseLeave() {
|
|
10485
|
-
return setShowVolumeSlider(false);
|
|
10486
|
-
},
|
|
10487
|
-
children: [
|
|
10488
|
-
/* @__PURE__ */ jsx("button", {
|
|
10489
|
-
className: "sc-ctrl-btn",
|
|
10490
|
-
onClick: function onClick() {
|
|
10491
|
-
if (playerRef.current) playerRef.current.toggleMute();
|
|
10492
|
-
onVolumeToggle === null || onVolumeToggle === void 0 ? void 0 : onVolumeToggle();
|
|
10493
|
-
resetControlsTimer();
|
|
10494
|
-
},
|
|
10495
|
-
style: {
|
|
10496
|
-
padding: "".concat(8 * responsiveScale, "px"),
|
|
10497
|
-
borderRadius: "50%",
|
|
10498
|
-
minWidth: "".concat(36 * responsiveScale, "px"),
|
|
10499
|
-
minHeight: "".concat(36 * responsiveScale, "px")
|
|
10500
|
-
},
|
|
10501
|
-
title: isMuted2 ? "Unmute" : "Mute",
|
|
10502
|
-
children: /* @__PURE__ */ jsx(VolumeIcon, {
|
|
10503
|
-
size: Math.max(14, 18 * responsiveScale)
|
|
10504
|
-
})
|
|
10505
|
-
}),
|
|
10506
|
-
/* @__PURE__ */ jsx("div", {
|
|
10507
|
-
style: {
|
|
10508
|
-
width: showVolumeSlider ? "".concat(68 * responsiveScale, "px") : "0px",
|
|
10509
|
-
overflow: "hidden",
|
|
10510
|
-
transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
10511
|
-
display: "flex",
|
|
10512
|
-
alignItems: "center",
|
|
10513
|
-
paddingLeft: showVolumeSlider ? "".concat(3 * responsiveScale, "px") : "0",
|
|
10514
|
-
paddingRight: showVolumeSlider ? "".concat(8 * responsiveScale, "px") : "0"
|
|
10515
|
-
},
|
|
10516
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
10517
|
-
style: {
|
|
10518
|
-
position: "relative",
|
|
10519
|
-
width: "".concat(56 * responsiveScale, "px"),
|
|
10520
|
-
height: "3px",
|
|
10521
|
-
cursor: "pointer",
|
|
10522
|
-
borderRadius: "1.5px"
|
|
10523
|
-
},
|
|
10524
|
-
onMouseDown: function onMouseDown(e) {
|
|
10525
|
-
e.preventDefault();
|
|
10526
|
-
var el = e.currentTarget;
|
|
10527
|
-
var move = function move(ev) {
|
|
10528
|
-
var r2 = el.getBoundingClientRect();
|
|
10529
|
-
handleVolumeChange(Math.max(0, Math.min(1, (ev.clientX - r2.left) / r2.width)));
|
|
10530
|
-
};
|
|
10531
|
-
var up = function up1() {
|
|
10532
|
-
document.removeEventListener("mousemove", move);
|
|
10533
|
-
document.removeEventListener("mouseup", up);
|
|
10534
|
-
};
|
|
10535
|
-
document.addEventListener("mousemove", move);
|
|
10536
|
-
document.addEventListener("mouseup", up);
|
|
10537
|
-
var r = el.getBoundingClientRect();
|
|
10538
|
-
handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
|
|
10539
|
-
},
|
|
10540
|
-
onClick: function onClick(e) {
|
|
10541
|
-
e.stopPropagation();
|
|
10542
|
-
var r = e.currentTarget.getBoundingClientRect();
|
|
10543
|
-
handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
|
|
10544
|
-
},
|
|
10545
|
-
children: [
|
|
10546
|
-
/* @__PURE__ */ jsx("div", {
|
|
10547
|
-
style: {
|
|
10548
|
-
position: "absolute",
|
|
10549
|
-
inset: 0,
|
|
10550
|
-
background: "rgba(255, 255, 255, 0.2)",
|
|
10551
|
-
borderRadius: "1.5px"
|
|
10552
|
-
}
|
|
10553
|
-
}),
|
|
10554
|
-
/* @__PURE__ */ jsx("div", {
|
|
10555
|
-
style: {
|
|
10556
|
-
position: "absolute",
|
|
10557
|
-
top: 0,
|
|
10558
|
-
left: 0,
|
|
10559
|
-
bottom: 0,
|
|
10560
|
-
width: "".concat((isMuted2 ? 0 : volume) * 100, "%"),
|
|
10561
|
-
background: "#fff",
|
|
10562
|
-
borderRadius: "1.5px",
|
|
10563
|
-
transition: "width 0.1s ease-out"
|
|
10564
|
-
}
|
|
10565
|
-
}),
|
|
10566
|
-
/* @__PURE__ */ jsx("div", {
|
|
10567
|
-
style: {
|
|
10568
|
-
position: "absolute",
|
|
10569
|
-
top: "50%",
|
|
10570
|
-
left: "".concat((isMuted2 ? 0 : volume) * 100, "%"),
|
|
10571
|
-
transform: "translate(-50%, -50%)",
|
|
10572
|
-
width: "12px",
|
|
10573
|
-
height: "12px",
|
|
10574
|
-
background: "#fff",
|
|
10575
|
-
borderRadius: "50%",
|
|
10576
|
-
boxShadow: "0 0 3px rgba(0, 0, 0, 0.3)",
|
|
10577
|
-
transition: "left 0.1s ease-out"
|
|
10578
|
-
}
|
|
10579
|
-
})
|
|
10580
|
-
]
|
|
10581
|
-
})
|
|
10582
|
-
})
|
|
10583
|
-
]
|
|
10584
|
-
}),
|
|
10585
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10586
|
-
style: {
|
|
10587
|
-
fontSize: "".concat(13 * responsiveScale, "px"),
|
|
10588
|
-
fontFamily: "Roboto, 'Segoe UI', Arial, sans-serif",
|
|
10589
|
-
color: "rgba(255, 255, 255, 0.9)",
|
|
10590
|
-
display: viewportWidth < 480 ? "none" : "block",
|
|
10591
|
-
fontVariantNumeric: "tabular-nums",
|
|
10592
|
-
userSelect: "none",
|
|
10593
|
-
marginLeft: "".concat(4 * responsiveScale, "px")
|
|
10594
|
-
},
|
|
10595
|
-
children: [
|
|
10596
|
-
formatTime(currentTime),
|
|
10597
|
-
" ",
|
|
10598
|
-
/* @__PURE__ */ jsx("span", {
|
|
10599
|
-
style: {
|
|
10600
|
-
color: "rgba(255,255,255,0.5)"
|
|
10601
|
-
},
|
|
10602
|
-
children: "/"
|
|
10603
|
-
}),
|
|
10604
|
-
" ",
|
|
10605
|
-
formatTime(duration)
|
|
10606
|
-
]
|
|
10607
|
-
})
|
|
10608
|
-
]
|
|
10609
|
-
}),
|
|
10610
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10611
|
-
style: {
|
|
10612
|
-
display: "flex",
|
|
10613
|
-
alignItems: "center",
|
|
10614
|
-
gap: "".concat(8 * responsiveScale, "px")
|
|
10615
|
-
},
|
|
10616
|
-
children: [
|
|
10617
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10618
|
-
style: {
|
|
10619
|
-
position: "relative",
|
|
10620
|
-
display: viewportWidth < 600 ? "none" : "block"
|
|
10621
|
-
},
|
|
10622
|
-
children: [
|
|
10623
|
-
/* @__PURE__ */ jsxs("button", {
|
|
10624
|
-
className: "sc-ctrl-btn",
|
|
10625
|
-
onClick: function onClick() {
|
|
10626
|
-
setShowSpeedMenu(!showSpeedMenu);
|
|
10627
|
-
resetControlsTimer();
|
|
10628
|
-
},
|
|
10629
|
-
style: {
|
|
10630
|
-
padding: "".concat(6 * responsiveScale, "px ").concat(10 * responsiveScale, "px"),
|
|
10631
|
-
borderRadius: "".concat(6 * responsiveScale, "px"),
|
|
10632
|
-
fontSize: "".concat(13 * responsiveScale, "px"),
|
|
10633
|
-
fontFamily: "'SF Mono', 'Cascadia Code', monospace",
|
|
10634
|
-
fontWeight: "600",
|
|
10635
|
-
minHeight: "".concat(32 * responsiveScale, "px")
|
|
10636
|
-
},
|
|
10637
|
-
title: "Playback Speed",
|
|
10638
|
-
children: [
|
|
10639
|
-
playbackRate,
|
|
10640
|
-
"x"
|
|
10641
|
-
]
|
|
10642
|
-
}),
|
|
10643
|
-
showSpeedMenu && /* @__PURE__ */ jsx("div", {
|
|
10644
|
-
style: {
|
|
10645
|
-
position: "absolute",
|
|
10646
|
-
bottom: "100%",
|
|
10647
|
-
right: 0,
|
|
10648
|
-
marginBottom: "8px",
|
|
10649
|
-
background: "rgba(0, 0, 0, 0.8)",
|
|
10650
|
-
backdropFilter: "blur(24px)",
|
|
10651
|
-
WebkitBackdropFilter: "blur(24px)",
|
|
10652
|
-
borderRadius: "10px",
|
|
10653
|
-
border: "1px solid rgba(255, 255, 255, 0.1)",
|
|
10654
|
-
overflow: "hidden",
|
|
10655
|
-
minWidth: "80px",
|
|
10656
|
-
boxShadow: "0 12px 40px rgba(0, 0, 0, 0.5)",
|
|
10657
|
-
animation: "sc-fade-in 0.15s ease"
|
|
10658
|
-
},
|
|
10659
|
-
children: [
|
|
10660
|
-
0.25,
|
|
10661
|
-
0.5,
|
|
10662
|
-
0.75,
|
|
10663
|
-
1,
|
|
10664
|
-
1.25,
|
|
10665
|
-
1.5,
|
|
10666
|
-
1.75,
|
|
10667
|
-
2
|
|
10668
|
-
].map(function(speed) {
|
|
10669
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
10670
|
-
onClick: function onClick() {
|
|
10671
|
-
return handlePlaybackRateChange(speed);
|
|
10672
|
-
},
|
|
10673
|
-
style: {
|
|
10674
|
-
display: "block",
|
|
10675
|
-
width: "100%",
|
|
10676
|
-
padding: "".concat(8 * responsiveScale, "px ").concat(14 * responsiveScale, "px"),
|
|
10677
|
-
background: playbackRate === speed ? "rgba(255, 255, 255, 0.12)" : "transparent",
|
|
10678
|
-
border: "none",
|
|
10679
|
-
color: playbackRate === speed ? "#fff" : "rgba(255, 255, 255, 0.7)",
|
|
10680
|
-
cursor: "pointer",
|
|
10681
|
-
fontSize: "".concat(12 * responsiveScale, "px"),
|
|
10682
|
-
fontFamily: "'SF Mono', monospace",
|
|
10683
|
-
fontWeight: playbackRate === speed ? "700" : "500",
|
|
10684
|
-
textAlign: "center",
|
|
10685
|
-
transition: "background 0.15s ease, color 0.15s ease"
|
|
10686
|
-
},
|
|
10687
|
-
onMouseEnter: function onMouseEnter(e) {
|
|
10688
|
-
if (playbackRate !== speed) {
|
|
10689
|
-
e.target.style.background = "rgba(255, 255, 255, 0.08)";
|
|
10690
|
-
e.target.style.color = "#fff";
|
|
10691
|
-
}
|
|
10692
|
-
},
|
|
10693
|
-
onMouseLeave: function onMouseLeave(e) {
|
|
10694
|
-
if (playbackRate !== speed) {
|
|
10695
|
-
e.target.style.background = "transparent";
|
|
10696
|
-
e.target.style.color = "rgba(255, 255, 255, 0.7)";
|
|
10697
|
-
}
|
|
10698
|
-
},
|
|
10699
|
-
children: [
|
|
10700
|
-
speed,
|
|
10701
|
-
"x"
|
|
10702
|
-
]
|
|
10703
|
-
}, speed);
|
|
10704
|
-
})
|
|
10705
|
-
})
|
|
10706
|
-
]
|
|
10707
|
-
}),
|
|
10708
|
-
/* @__PURE__ */ jsx("button", {
|
|
10709
|
-
className: "sc-ctrl-btn",
|
|
10710
|
-
onClick: function onClick() {
|
|
10711
|
-
if (onFullscreenToggle) {
|
|
10712
|
-
onFullscreenToggle();
|
|
10713
|
-
} else if (wrapperRef.current) {
|
|
10714
|
-
if (!document.fullscreenElement) {
|
|
10715
|
-
wrapperRef.current.requestFullscreen().catch(function() {});
|
|
10716
|
-
} else {
|
|
10717
|
-
document.exitFullscreen().catch(function() {});
|
|
10718
|
-
}
|
|
10719
|
-
}
|
|
10720
|
-
resetControlsTimer();
|
|
10721
|
-
},
|
|
10722
|
-
style: {
|
|
10723
|
-
padding: "".concat(8 * responsiveScale, "px"),
|
|
10724
|
-
borderRadius: "50%",
|
|
10725
|
-
minWidth: "".concat(36 * responsiveScale, "px"),
|
|
10726
|
-
minHeight: "".concat(36 * responsiveScale, "px")
|
|
10727
|
-
},
|
|
10728
|
-
title: isFullscreen2 ? "Exit Fullscreen" : "Enter Fullscreen",
|
|
10729
|
-
children: isFullscreen2 ? /* @__PURE__ */ jsx(CompressIcon, {
|
|
10730
|
-
size: Math.max(14, 18 * responsiveScale)
|
|
10731
|
-
}) : /* @__PURE__ */ jsx(ExpandIcon, {
|
|
10732
|
-
size: Math.max(14, 18 * responsiveScale)
|
|
10733
|
-
})
|
|
10734
|
-
})
|
|
10735
|
-
]
|
|
10736
|
-
})
|
|
10737
|
-
]
|
|
10738
|
-
})
|
|
10739
|
-
]
|
|
10740
|
-
}) : showCustomControls && !showLicenseWarning && /* @__PURE__ */ jsxs(Fragment, {
|
|
10741
|
-
children: [
|
|
10742
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10743
|
-
style: {
|
|
10744
|
-
position: "absolute",
|
|
10745
|
-
top: "".concat(10 * responsiveScale, "px"),
|
|
10746
|
-
left: "".concat(10 * responsiveScale, "px"),
|
|
10747
|
-
display: "flex",
|
|
10748
|
-
alignItems: "center",
|
|
10749
|
-
gap: "6px",
|
|
10750
|
-
zIndex: 10,
|
|
10751
|
-
opacity: controlsVisible ? 1 : 0,
|
|
10752
|
-
transition: "opacity 0.35s ease"
|
|
10753
|
-
},
|
|
10754
|
-
children: [
|
|
10755
|
-
/* @__PURE__ */ jsx("div", {
|
|
10756
|
-
style: {
|
|
10757
|
-
width: "8px",
|
|
10758
|
-
height: "8px",
|
|
10759
|
-
borderRadius: "50%",
|
|
10760
|
-
background: "#ff3b30",
|
|
10761
|
-
animation: "sc-pulse 1.5s ease-in-out infinite",
|
|
10762
|
-
flexShrink: 0
|
|
10763
|
-
}
|
|
10764
|
-
}),
|
|
10765
|
-
/* @__PURE__ */ jsx("span", {
|
|
10766
|
-
style: {
|
|
10767
|
-
fontSize: "".concat(12 * responsiveScale, "px"),
|
|
10768
|
-
fontFamily: "'SF Pro Display', 'Segoe UI', Arial, sans-serif",
|
|
10769
|
-
fontWeight: 700,
|
|
10770
|
-
letterSpacing: "0.08em",
|
|
10771
|
-
color: "#fff",
|
|
10772
|
-
textShadow: "0 1px 3px rgba(0,0,0,0.6)",
|
|
10773
|
-
userSelect: "none"
|
|
10774
|
-
},
|
|
10775
|
-
children: "LIVE"
|
|
10776
|
-
})
|
|
10777
|
-
]
|
|
10778
|
-
}),
|
|
10779
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10780
|
-
className: "sc-controls-bar",
|
|
10781
|
-
style: {
|
|
10782
|
-
position: "absolute",
|
|
10783
|
-
bottom: "".concat(10 * responsiveScale, "px"),
|
|
10784
|
-
right: "".concat(10 * responsiveScale, "px"),
|
|
10785
|
-
display: "flex",
|
|
10786
|
-
flexDirection: isPortrait ? "column" : "row",
|
|
10787
|
-
alignItems: isPortrait ? "flex-end" : "center",
|
|
10788
|
-
gap: "".concat(8 * responsiveScale, "px"),
|
|
10789
|
-
zIndex: 10,
|
|
10790
|
-
opacity: controlsVisible ? 1 : 0,
|
|
10791
|
-
transform: controlsVisible ? "translateY(0)" : "translateY(4px)",
|
|
10792
|
-
pointerEvents: controlsVisible ? "auto" : "none"
|
|
10793
|
-
},
|
|
10794
|
-
children: [
|
|
10795
|
-
/* @__PURE__ */ jsxs("div", {
|
|
10796
|
-
style: {
|
|
10797
|
-
display: "flex",
|
|
10798
|
-
alignItems: "center",
|
|
10799
|
-
background: "rgba(0, 0, 0, 0.6)",
|
|
10800
|
-
borderRadius: "".concat(18 * responsiveScale, "px"),
|
|
10801
|
-
padding: "2px",
|
|
10802
|
-
paddingRight: "".concat(8 * responsiveScale, "px")
|
|
10803
|
-
},
|
|
10804
|
-
onMouseEnter: function onMouseEnter() {
|
|
10805
|
-
return setShowVolumeSlider(true);
|
|
10806
|
-
},
|
|
10807
|
-
onMouseLeave: function onMouseLeave() {
|
|
10808
|
-
return setShowVolumeSlider(false);
|
|
10809
|
-
},
|
|
10810
|
-
children: [
|
|
10811
|
-
/* @__PURE__ */ jsx("button", {
|
|
10812
|
-
className: "sc-ctrl-btn",
|
|
10813
|
-
onClick: function onClick() {
|
|
10814
|
-
if (playerRef.current) playerRef.current.toggleMute();
|
|
10815
|
-
onVolumeToggle === null || onVolumeToggle === void 0 ? void 0 : onVolumeToggle();
|
|
10816
|
-
resetControlsTimer();
|
|
10817
|
-
},
|
|
10818
|
-
style: {
|
|
10819
|
-
padding: "".concat(8 * responsiveScale, "px"),
|
|
10820
|
-
borderRadius: "50%",
|
|
10821
|
-
minWidth: "".concat(36 * responsiveScale, "px"),
|
|
10822
|
-
minHeight: "".concat(36 * responsiveScale, "px")
|
|
10823
|
-
},
|
|
10824
|
-
title: isMuted2 ? "Unmute" : "Mute",
|
|
10825
|
-
children: /* @__PURE__ */ jsx(VolumeIcon, {
|
|
10826
|
-
size: Math.max(14, 18 * responsiveScale)
|
|
10827
|
-
})
|
|
10828
|
-
}),
|
|
10829
|
-
/* @__PURE__ */ jsx("div", {
|
|
10830
|
-
style: {
|
|
10831
|
-
width: showVolumeSlider ? "".concat(68 * responsiveScale, "px") : "0px",
|
|
10832
|
-
overflow: "hidden",
|
|
10833
|
-
transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
10834
|
-
display: "flex",
|
|
10835
|
-
alignItems: "center",
|
|
10836
|
-
paddingLeft: showVolumeSlider ? "".concat(3 * responsiveScale, "px") : "0",
|
|
10837
|
-
paddingRight: showVolumeSlider ? "".concat(10 * responsiveScale, "px") : "0"
|
|
10838
|
-
},
|
|
10839
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
10840
|
-
style: {
|
|
10841
|
-
position: "relative",
|
|
10842
|
-
width: "".concat(56 * responsiveScale, "px"),
|
|
10843
|
-
height: "3px",
|
|
10844
|
-
cursor: "pointer",
|
|
10845
|
-
borderRadius: "1.5px"
|
|
10846
|
-
},
|
|
10847
|
-
onMouseDown: function onMouseDown(e) {
|
|
10848
|
-
e.preventDefault();
|
|
10849
|
-
var el = e.currentTarget;
|
|
10850
|
-
var move = function move(ev) {
|
|
10851
|
-
var r2 = el.getBoundingClientRect();
|
|
10852
|
-
handleVolumeChange(Math.max(0, Math.min(1, (ev.clientX - r2.left) / r2.width)));
|
|
10853
|
-
};
|
|
10854
|
-
var up = function up1() {
|
|
10855
|
-
document.removeEventListener("mousemove", move);
|
|
10856
|
-
document.removeEventListener("mouseup", up);
|
|
10857
|
-
};
|
|
10858
|
-
document.addEventListener("mousemove", move);
|
|
10859
|
-
document.addEventListener("mouseup", up);
|
|
10860
|
-
var r = el.getBoundingClientRect();
|
|
10861
|
-
handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
|
|
10862
|
-
},
|
|
10863
|
-
onClick: function onClick(e) {
|
|
10864
|
-
e.stopPropagation();
|
|
10865
|
-
var r = e.currentTarget.getBoundingClientRect();
|
|
10866
|
-
handleVolumeChange(Math.max(0, Math.min(1, (e.clientX - r.left) / r.width)));
|
|
10867
|
-
},
|
|
10868
|
-
children: [
|
|
10869
|
-
/* @__PURE__ */ jsx("div", {
|
|
10870
|
-
style: {
|
|
10871
|
-
position: "absolute",
|
|
10872
|
-
inset: 0,
|
|
10873
|
-
background: "rgba(255, 255, 255, 0.2)",
|
|
10874
|
-
borderRadius: "1.5px"
|
|
10875
|
-
}
|
|
10876
|
-
}),
|
|
10877
|
-
/* @__PURE__ */ jsx("div", {
|
|
10878
|
-
style: {
|
|
10879
|
-
position: "absolute",
|
|
10880
|
-
top: 0,
|
|
10881
|
-
left: 0,
|
|
10882
|
-
bottom: 0,
|
|
10883
|
-
width: "".concat((isMuted2 ? 0 : volume) * 100, "%"),
|
|
10884
|
-
background: "#fff",
|
|
10885
|
-
borderRadius: "1.5px",
|
|
10886
|
-
transition: "width 0.1s ease-out"
|
|
10887
|
-
}
|
|
10888
|
-
}),
|
|
10889
|
-
/* @__PURE__ */ jsx("div", {
|
|
10890
|
-
style: {
|
|
10891
|
-
position: "absolute",
|
|
10892
|
-
top: "50%",
|
|
10893
|
-
left: "".concat((isMuted2 ? 0 : volume) * 100, "%"),
|
|
10894
|
-
transform: "translate(-50%, -50%)",
|
|
10895
|
-
width: "12px",
|
|
10896
|
-
height: "12px",
|
|
10897
|
-
background: "#fff",
|
|
10898
|
-
borderRadius: "50%",
|
|
10899
|
-
boxShadow: "0 0 3px rgba(0, 0, 0, 0.3)",
|
|
10900
|
-
transition: "left 0.1s ease-out"
|
|
10901
|
-
}
|
|
10902
|
-
})
|
|
10903
|
-
]
|
|
10904
|
-
})
|
|
10905
|
-
})
|
|
10906
|
-
]
|
|
10907
|
-
}),
|
|
10908
|
-
/* @__PURE__ */ jsx("button", {
|
|
10909
|
-
className: "sc-ctrl-btn",
|
|
10910
|
-
onClick: function onClick() {
|
|
10911
|
-
if (onFullscreenToggle) {
|
|
10912
|
-
onFullscreenToggle();
|
|
10913
|
-
} else if (wrapperRef.current) {
|
|
10914
|
-
if (!document.fullscreenElement) {
|
|
10915
|
-
wrapperRef.current.requestFullscreen().catch(function() {});
|
|
10916
|
-
} else {
|
|
10917
|
-
document.exitFullscreen().catch(function() {});
|
|
10918
|
-
}
|
|
10919
|
-
}
|
|
10920
|
-
resetControlsTimer();
|
|
10921
|
-
},
|
|
10922
|
-
style: {
|
|
10923
|
-
padding: "".concat(8 * responsiveScale, "px"),
|
|
10924
|
-
borderRadius: "50%",
|
|
10925
|
-
minWidth: "".concat(36 * responsiveScale, "px"),
|
|
10926
|
-
minHeight: "".concat(36 * responsiveScale, "px"),
|
|
10927
|
-
background: "rgba(0, 0, 0, 0.6)"
|
|
10928
|
-
},
|
|
10929
|
-
title: isFullscreen2 ? "Exit Fullscreen" : "Enter Fullscreen",
|
|
10930
|
-
children: isFullscreen2 ? /* @__PURE__ */ jsx(CompressIcon, {
|
|
10931
|
-
size: Math.max(14, 18 * responsiveScale)
|
|
10932
|
-
}) : /* @__PURE__ */ jsx(ExpandIcon, {
|
|
10933
|
-
size: Math.max(14, 18 * responsiveScale)
|
|
10934
|
-
})
|
|
10935
|
-
})
|
|
10936
|
-
]
|
|
10937
|
-
})
|
|
10938
|
-
]
|
|
10939
|
-
}),
|
|
10940
|
-
onControlClick && /* @__PURE__ */ jsx("div", {
|
|
10941
|
-
onClick: onControlClick,
|
|
10942
|
-
style: {
|
|
10943
|
-
position: "absolute",
|
|
10944
|
-
top: 0,
|
|
10945
|
-
left: 0,
|
|
10946
|
-
right: 0,
|
|
10947
|
-
bottom: 0,
|
|
10948
|
-
zIndex: 1,
|
|
10949
|
-
cursor: "pointer"
|
|
10950
|
-
}
|
|
10951
|
-
})
|
|
10952
|
-
]
|
|
10953
|
-
})
|
|
10954
|
-
]
|
|
10955
|
-
});
|
|
10956
|
-
}, function(prevProps, nextProps) {
|
|
10957
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
10958
|
-
try {
|
|
10959
|
-
for(var _iterator = CRITICAL_PROPS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
10960
|
-
var prop = _step.value;
|
|
10961
|
-
if (prevProps[prop] !== nextProps[prop]) {
|
|
10962
|
-
return false;
|
|
10963
|
-
}
|
|
10964
|
-
}
|
|
10965
|
-
} catch (err) {
|
|
10966
|
-
_didIteratorError = true;
|
|
10967
|
-
_iteratorError = err;
|
|
10968
|
-
} finally{
|
|
10969
|
-
try {
|
|
10970
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
10971
|
-
_iterator.return();
|
|
10972
|
-
}
|
|
10973
|
-
} finally{
|
|
10974
|
-
if (_didIteratorError) {
|
|
10975
|
-
throw _iteratorError;
|
|
10976
|
-
}
|
|
10977
|
-
}
|
|
10978
|
-
}
|
|
10979
|
-
var uiProps = [
|
|
10980
|
-
"autoplay",
|
|
10981
|
-
"muted",
|
|
10982
|
-
"controls",
|
|
10983
|
-
"showCustomControls",
|
|
10984
|
-
"className",
|
|
10985
|
-
"style",
|
|
10986
|
-
"wrapperClassName",
|
|
10987
|
-
"wrapperStyle",
|
|
10988
|
-
"playsInline",
|
|
10989
|
-
"preload",
|
|
10990
|
-
"poster",
|
|
10991
|
-
"children"
|
|
10992
|
-
];
|
|
10993
|
-
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
10994
|
-
try {
|
|
10995
|
-
for(var _iterator1 = uiProps[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
10996
|
-
var prop1 = _step1.value;
|
|
10997
|
-
if (prevProps[prop1] !== nextProps[prop1]) {
|
|
10998
|
-
return false;
|
|
10999
|
-
}
|
|
11000
|
-
}
|
|
11001
|
-
} catch (err) {
|
|
11002
|
-
_didIteratorError1 = true;
|
|
11003
|
-
_iteratorError1 = err;
|
|
11004
|
-
} finally{
|
|
11005
|
-
try {
|
|
11006
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
11007
|
-
_iterator1.return();
|
|
11008
|
-
}
|
|
11009
|
-
} finally{
|
|
11010
|
-
if (_didIteratorError1) {
|
|
11011
|
-
throw _iteratorError1;
|
|
11012
|
-
}
|
|
11013
|
-
}
|
|
11014
|
-
}
|
|
11015
|
-
var callbackProps = [
|
|
11016
|
-
"onReady",
|
|
11017
|
-
"onVolumeToggle",
|
|
11018
|
-
"onFullscreenToggle",
|
|
11019
|
-
"onControlClick"
|
|
11020
|
-
];
|
|
11021
|
-
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
11022
|
-
try {
|
|
11023
|
-
for(var _iterator2 = callbackProps[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
11024
|
-
var prop2 = _step2.value;
|
|
11025
|
-
if (prevProps[prop2] !== nextProps[prop2]) {
|
|
11026
|
-
return false;
|
|
11027
|
-
}
|
|
11028
|
-
}
|
|
11029
|
-
} catch (err) {
|
|
11030
|
-
_didIteratorError2 = true;
|
|
11031
|
-
_iteratorError2 = err;
|
|
11032
|
-
} finally{
|
|
11033
|
-
try {
|
|
11034
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
11035
|
-
_iterator2.return();
|
|
11036
|
-
}
|
|
11037
|
-
} finally{
|
|
11038
|
-
if (_didIteratorError2) {
|
|
11039
|
-
throw _iteratorError2;
|
|
11040
|
-
}
|
|
11041
|
-
}
|
|
11042
|
-
}
|
|
11043
|
-
return true;
|
|
11044
|
-
});
|
|
11045
|
-
// src/StormcloudPlayer.tsx
|
|
11046
|
-
import React3, { Component as Component4, Suspense } from "react";
|
|
11047
10405
|
// src/props.ts
|
|
11048
10406
|
var noop = function noop() {};
|
|
11049
10407
|
var defaultProps = {
|
|
@@ -11091,8 +10449,8 @@ var defaultProps = {
|
|
|
11091
10449
|
onControlClick: noop
|
|
11092
10450
|
};
|
|
11093
10451
|
// src/utils.ts
|
|
11094
|
-
|
|
11095
|
-
var lazy =
|
|
10452
|
+
var import_react = require("react");
|
|
10453
|
+
var lazy = import_react.lazy;
|
|
11096
10454
|
var omit = function omit(object, keys) {
|
|
11097
10455
|
var result = _object_spread({}, object);
|
|
11098
10456
|
keys.forEach(function(key) {
|
|
@@ -11103,82 +10461,10 @@ var omit = function omit(object, keys) {
|
|
|
11103
10461
|
var isMediaStream = function isMediaStream(url) {
|
|
11104
10462
|
return typeof window !== "undefined" && window.MediaStream && _instanceof(url, window.MediaStream);
|
|
11105
10463
|
};
|
|
11106
|
-
var supportsWebKitPresentationMode = function supportsWebKitPresentationMode() {
|
|
11107
|
-
if (typeof window === "undefined") return false;
|
|
11108
|
-
var video = document.createElement("video");
|
|
11109
|
-
return "webkitSupportsPresentationMode" in video;
|
|
11110
|
-
};
|
|
11111
|
-
var randomString = function randomString() {
|
|
11112
|
-
return Math.random().toString(36).substr(2, 9);
|
|
11113
|
-
};
|
|
11114
|
-
var parseQuery = function parseQuery(url) {
|
|
11115
|
-
var query = {};
|
|
11116
|
-
var queryString = url.split("?")[1] || "";
|
|
11117
|
-
if (!queryString) return query;
|
|
11118
|
-
var manualParse = function manualParse(qs) {
|
|
11119
|
-
qs.split("&").forEach(function(param) {
|
|
11120
|
-
var _param_split = _sliced_to_array(param.split("="), 2), key = _param_split[0], value = _param_split[1];
|
|
11121
|
-
if (key) {
|
|
11122
|
-
try {
|
|
11123
|
-
query[decodeURIComponent(key)] = value ? decodeURIComponent(value.replace(/\+/g, " ")) : "";
|
|
11124
|
-
} catch (e) {
|
|
11125
|
-
query[key] = value || "";
|
|
11126
|
-
}
|
|
11127
|
-
}
|
|
11128
|
-
});
|
|
11129
|
-
};
|
|
11130
|
-
if (typeof URLSearchParams !== "undefined") {
|
|
11131
|
-
try {
|
|
11132
|
-
var params = new URLSearchParams(queryString);
|
|
11133
|
-
params.forEach(function(value, key) {
|
|
11134
|
-
query[key] = value;
|
|
11135
|
-
});
|
|
11136
|
-
return query;
|
|
11137
|
-
} catch (e) {
|
|
11138
|
-
manualParse(queryString);
|
|
11139
|
-
}
|
|
11140
|
-
} else {
|
|
11141
|
-
manualParse(queryString);
|
|
11142
|
-
}
|
|
11143
|
-
return query;
|
|
11144
|
-
};
|
|
11145
|
-
var merge = function merge1(target) {
|
|
11146
|
-
for(var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
11147
|
-
sources[_key - 1] = arguments[_key];
|
|
11148
|
-
}
|
|
11149
|
-
if (!sources.length) return target;
|
|
11150
|
-
var source = sources.shift();
|
|
11151
|
-
if (isObject(target) && isObject(source)) {
|
|
11152
|
-
for(var key in source){
|
|
11153
|
-
if (isObject(source[key])) {
|
|
11154
|
-
if (!target[key]) Object.assign(target, _define_property({}, key, {}));
|
|
11155
|
-
merge(target[key], source[key]);
|
|
11156
|
-
} else {
|
|
11157
|
-
Object.assign(target, _define_property({}, key, source[key]));
|
|
11158
|
-
}
|
|
11159
|
-
}
|
|
11160
|
-
}
|
|
11161
|
-
return merge.apply(void 0, [
|
|
11162
|
-
target
|
|
11163
|
-
].concat(_to_consumable_array(sources)));
|
|
11164
|
-
};
|
|
11165
|
-
var isObject = function isObject(item) {
|
|
11166
|
-
return item && (typeof item === "undefined" ? "undefined" : _type_of(item)) === "object" && !Array.isArray(item);
|
|
11167
|
-
};
|
|
11168
10464
|
var IS_BROWSER = typeof window !== "undefined" && window.document;
|
|
11169
10465
|
var IS_GLOBAL = typeof globalThis !== "undefined" && globalThis.window && globalThis.window.document;
|
|
11170
10466
|
var IS_IOS = IS_BROWSER && /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
11171
10467
|
var IS_SAFARI = IS_BROWSER && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
11172
|
-
var SUPPORTS_HLS = function SUPPORTS_HLS() {
|
|
11173
|
-
if (!IS_BROWSER) return false;
|
|
11174
|
-
var video = document.createElement("video");
|
|
11175
|
-
return Boolean(video.canPlayType("application/vnd.apple.mpegurl"));
|
|
11176
|
-
};
|
|
11177
|
-
var SUPPORTS_DASH = function SUPPORTS_DASH() {
|
|
11178
|
-
if (!IS_BROWSER) return false;
|
|
11179
|
-
var video = document.createElement("video");
|
|
11180
|
-
return Boolean(video.canPlayType("application/dash+xml"));
|
|
11181
|
-
};
|
|
11182
10468
|
// src/patterns.ts
|
|
11183
10469
|
var HLS_EXTENSIONS = /\.(m3u8)($|\?)/i;
|
|
11184
10470
|
var HLS_PATHS = /\/hls\//i;
|
|
@@ -11208,10 +10494,9 @@ var canPlay = {
|
|
|
11208
10494
|
}
|
|
11209
10495
|
};
|
|
11210
10496
|
// src/players/HlsPlayer.tsx
|
|
11211
|
-
|
|
11212
|
-
var HlsPlayer = /*#__PURE__*/ function(
|
|
11213
|
-
|
|
11214
|
-
_inherits(HlsPlayer, Component);
|
|
10497
|
+
var import_react2 = require("react");
|
|
10498
|
+
var HlsPlayer = /*#__PURE__*/ function(_import_react2_Component) {
|
|
10499
|
+
_inherits(HlsPlayer, _import_react2_Component);
|
|
11215
10500
|
function HlsPlayer() {
|
|
11216
10501
|
_class_call_check(this, HlsPlayer);
|
|
11217
10502
|
var _this;
|
|
@@ -11413,14 +10698,13 @@ var HlsPlayer = /*#__PURE__*/ function(Component) {
|
|
|
11413
10698
|
}
|
|
11414
10699
|
]);
|
|
11415
10700
|
return HlsPlayer;
|
|
11416
|
-
}(Component);
|
|
10701
|
+
}(import_react2.Component);
|
|
11417
10702
|
HlsPlayer.displayName = "HlsPlayer";
|
|
11418
10703
|
HlsPlayer.canPlay = canPlay.hls;
|
|
11419
10704
|
// src/players/FilePlayer.tsx
|
|
11420
|
-
|
|
11421
|
-
var FilePlayer = /*#__PURE__*/ function(
|
|
11422
|
-
|
|
11423
|
-
_inherits(FilePlayer, Component2);
|
|
10705
|
+
var import_react3 = require("react");
|
|
10706
|
+
var FilePlayer = /*#__PURE__*/ function(_import_react3_Component) {
|
|
10707
|
+
_inherits(FilePlayer, _import_react3_Component);
|
|
11424
10708
|
function FilePlayer() {
|
|
11425
10709
|
_class_call_check(this, FilePlayer);
|
|
11426
10710
|
var _this;
|
|
@@ -11694,7 +10978,7 @@ var FilePlayer = /*#__PURE__*/ function(Component2) {
|
|
|
11694
10978
|
}
|
|
11695
10979
|
]);
|
|
11696
10980
|
return FilePlayer;
|
|
11697
|
-
}(
|
|
10981
|
+
}(import_react3.Component);
|
|
11698
10982
|
FilePlayer.displayName = "FilePlayer";
|
|
11699
10983
|
FilePlayer.canPlay = canPlay.file;
|
|
11700
10984
|
// src/players/index.ts
|
|
@@ -11725,11 +11009,10 @@ var players = [
|
|
|
11725
11009
|
];
|
|
11726
11010
|
var players_default = players;
|
|
11727
11011
|
// src/Player.tsx
|
|
11728
|
-
|
|
11012
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
11729
11013
|
var SEEK_ON_PLAY_EXPIRY = 5e3;
|
|
11730
|
-
var Player = /*#__PURE__*/ function(
|
|
11731
|
-
|
|
11732
|
-
_inherits(Player, Component3);
|
|
11014
|
+
var Player = /*#__PURE__*/ function(_import_react4_Component) {
|
|
11015
|
+
_inherits(Player, _import_react4_Component);
|
|
11733
11016
|
function Player() {
|
|
11734
11017
|
_class_call_check(this, Player);
|
|
11735
11018
|
var _this;
|
|
@@ -11974,7 +11257,7 @@ var Player = /*#__PURE__*/ function(Component3) {
|
|
|
11974
11257
|
if (!Player2) {
|
|
11975
11258
|
return null;
|
|
11976
11259
|
}
|
|
11977
|
-
return
|
|
11260
|
+
return import_react4.default.createElement(Player2, _object_spread_props(_object_spread({}, this.props), {
|
|
11978
11261
|
onMount: this.handlePlayerMount,
|
|
11979
11262
|
onReady: this.handleReady,
|
|
11980
11263
|
onPlay: this.handlePlay,
|
|
@@ -11987,13 +11270,13 @@ var Player = /*#__PURE__*/ function(Component3) {
|
|
|
11987
11270
|
}
|
|
11988
11271
|
]);
|
|
11989
11272
|
return Player;
|
|
11990
|
-
}(
|
|
11273
|
+
}(import_react4.Component);
|
|
11991
11274
|
Player.displayName = "Player";
|
|
11992
11275
|
Player.defaultProps = defaultProps;
|
|
11993
11276
|
// src/StormcloudPlayer.tsx
|
|
11994
11277
|
var IS_BROWSER2 = typeof window !== "undefined" && window.document;
|
|
11995
11278
|
var IS_GLOBAL2 = typeof globalThis !== "undefined" && globalThis.window && globalThis.window.document;
|
|
11996
|
-
var UniversalSuspense = IS_BROWSER2 || IS_GLOBAL2 ? Suspense : function() {
|
|
11279
|
+
var UniversalSuspense = IS_BROWSER2 || IS_GLOBAL2 ? import_react5.Suspense : function() {
|
|
11997
11280
|
return null;
|
|
11998
11281
|
};
|
|
11999
11282
|
var SUPPORTED_PROPS = [
|
|
@@ -12046,9 +11329,8 @@ var SUPPORTED_PROPS = [
|
|
|
12046
11329
|
var customPlayers = [];
|
|
12047
11330
|
var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallback) {
|
|
12048
11331
|
var _a;
|
|
12049
|
-
return _a = /*#__PURE__*/ function(
|
|
12050
|
-
|
|
12051
|
-
_inherits(_a, Component4);
|
|
11332
|
+
return _a = /*#__PURE__*/ function(_import_react5_Component) {
|
|
11333
|
+
_inherits(_a, _import_react5_Component);
|
|
12052
11334
|
function _a() {
|
|
12053
11335
|
_class_call_check(this, _a);
|
|
12054
11336
|
var _this;
|
|
@@ -12125,7 +11407,7 @@ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallbac
|
|
|
12125
11407
|
if (!src) return null;
|
|
12126
11408
|
var activePlayer = _this.getActivePlayer(src);
|
|
12127
11409
|
if (!activePlayer) return null;
|
|
12128
|
-
return
|
|
11410
|
+
return import_react5.default.createElement(Player, _object_spread_props(_object_spread({}, _this.props), {
|
|
12129
11411
|
key: activePlayer.key,
|
|
12130
11412
|
ref: _this.references.player,
|
|
12131
11413
|
activePlayer: activePlayer.lazyPlayer || activePlayer,
|
|
@@ -12141,20 +11423,20 @@ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallbac
|
|
|
12141
11423
|
var _this_props = this.props, src = _this_props.src, style = _this_props.style, width = _this_props.width, height = _this_props.height, fallbackElement = _this_props.fallback, Wrapper = _this_props.wrapper;
|
|
12142
11424
|
var attributes = this.getAttributes(src);
|
|
12143
11425
|
var wrapperRef = typeof Wrapper === "string" ? this.references.wrapper : void 0;
|
|
12144
|
-
return
|
|
11426
|
+
return import_react5.default.createElement(Wrapper, _object_spread({
|
|
12145
11427
|
ref: wrapperRef,
|
|
12146
11428
|
style: _object_spread_props(_object_spread({}, style), {
|
|
12147
11429
|
width: width,
|
|
12148
11430
|
height: height
|
|
12149
11431
|
})
|
|
12150
|
-
}, attributes),
|
|
11432
|
+
}, attributes), import_react5.default.createElement(UniversalSuspense, {
|
|
12151
11433
|
fallback: fallbackElement
|
|
12152
11434
|
}, this.renderActivePlayer(src)));
|
|
12153
11435
|
}
|
|
12154
11436
|
}
|
|
12155
11437
|
]);
|
|
12156
11438
|
return _a;
|
|
12157
|
-
}(
|
|
11439
|
+
}(import_react5.Component), _a.displayName = "StormcloudPlayer", _a.defaultProps = _object_spread_props(_object_spread({}, defaultProps), {
|
|
12158
11440
|
fallback: null,
|
|
12159
11441
|
wrapper: "div"
|
|
12160
11442
|
}), _a.addCustomPlayer = function(player) {
|
|
@@ -12213,5 +11495,8 @@ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallbac
|
|
|
12213
11495
|
};
|
|
12214
11496
|
var StormcloudPlayer = createStormcloudPlayer(players_default, players_default[players_default.length - 1]);
|
|
12215
11497
|
var StormcloudPlayer_default = StormcloudPlayer;
|
|
12216
|
-
|
|
12217
|
-
|
|
11498
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
11499
|
+
0 && (module.exports = {
|
|
11500
|
+
createStormcloudPlayer: createStormcloudPlayer
|
|
11501
|
+
});
|
|
11502
|
+
//# sourceMappingURL=StormcloudPlayer.cjs.map
|