stormcloud-video-player 0.8.17 → 0.8.19
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/README.md +67 -83
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +859 -585
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +859 -585
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +11 -11
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +3 -3
- package/lib/player/{VmapManager.cjs → AdConfigManager.cjs} +503 -214
- package/lib/player/AdConfigManager.cjs.map +1 -0
- package/lib/player/{VmapManager.d.cts → AdConfigManager.d.cts} +2 -2
- package/lib/player/StormcloudVideoPlayer.cjs +635 -346
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +635 -346
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +635 -346
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +859 -585
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/ctvVastSignals.cjs +92 -33
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/ctvVastSignals.d.cts +1 -13
- package/lib/utils/vastEnvironmentSignals.cjs +439 -0
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -0
- package/lib/utils/vastEnvironmentSignals.d.cts +16 -0
- package/lib/utils/vastMacros.cjs +299 -25
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +3 -1
- package/package.json +1 -1
- package/lib/player/VmapManager.cjs.map +0 -1
package/lib/index.cjs
CHANGED
|
@@ -2530,7 +2530,451 @@ function initializePolyfills() {
|
|
|
2530
2530
|
polyfillTextEncoder();
|
|
2531
2531
|
polyfillPromiseFinally();
|
|
2532
2532
|
}
|
|
2533
|
+
// src/utils/vastEnvironmentSignals.ts
|
|
2534
|
+
var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
|
|
2535
|
+
var AIRY_APP_NAME = "AiryTV Movies & TV";
|
|
2536
|
+
var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
|
|
2537
|
+
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
2538
|
+
var DEVICE_ID_STORAGE_KEYS = [
|
|
2539
|
+
"rdid",
|
|
2540
|
+
"ifa",
|
|
2541
|
+
"advertisingId",
|
|
2542
|
+
"advertising_id",
|
|
2543
|
+
"deviceAdvertisingId",
|
|
2544
|
+
"aaid",
|
|
2545
|
+
"adid",
|
|
2546
|
+
"rida",
|
|
2547
|
+
"tifa",
|
|
2548
|
+
"lgudid"
|
|
2549
|
+
];
|
|
2550
|
+
var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
|
|
2551
|
+
"aaid",
|
|
2552
|
+
"adid"
|
|
2553
|
+
]);
|
|
2554
|
+
function resolveVastEnvironmentSignals(isCtv) {
|
|
2555
|
+
var _ref, _bridgeSignals_limitAdTracking;
|
|
2556
|
+
var bridgeSignals = readNativeBridgeSignals();
|
|
2557
|
+
var deviceId = bridgeSignals.deviceId || readStoredDeviceId();
|
|
2558
|
+
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || inferDeviceIdType();
|
|
2559
|
+
var limitAdTracking = deviceId != null ? (_ref = (_bridgeSignals_limitAdTracking = bridgeSignals.limitAdTracking) !== null && _bridgeSignals_limitAdTracking !== void 0 ? _bridgeSignals_limitAdTracking : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
|
|
2560
|
+
if (isCtv) {
|
|
2561
|
+
return _object_spread_props(_object_spread({
|
|
2562
|
+
isCtv: true,
|
|
2563
|
+
contentUrl: bridgeSignals.contentUrl || readStoredString("contentUrl") || AIRY_DEFAULT_CONTENT_URL,
|
|
2564
|
+
appId: bridgeSignals.appId || readStoredString("appId") || readStoredString("msid") || AIRY_ANDROID_APP_ID,
|
|
2565
|
+
appName: bridgeSignals.appName || readStoredString("appName") || readStoredString("an") || AIRY_APP_NAME,
|
|
2566
|
+
sessionId: getOrCreateCtvSessionId()
|
|
2567
|
+
}, deviceId ? {
|
|
2568
|
+
deviceId: deviceId
|
|
2569
|
+
} : {}, deviceIdType ? {
|
|
2570
|
+
deviceIdType: deviceIdType
|
|
2571
|
+
} : {}, limitAdTracking != null ? {
|
|
2572
|
+
limitAdTracking: limitAdTracking
|
|
2573
|
+
} : {}), {
|
|
2574
|
+
deviceTypeHint: 5
|
|
2575
|
+
});
|
|
2576
|
+
}
|
|
2577
|
+
return _object_spread({
|
|
2578
|
+
isCtv: false
|
|
2579
|
+
}, deviceId ? {
|
|
2580
|
+
deviceId: deviceId
|
|
2581
|
+
} : {}, deviceIdType ? {
|
|
2582
|
+
deviceIdType: deviceIdType
|
|
2583
|
+
} : {}, limitAdTracking != null ? {
|
|
2584
|
+
limitAdTracking: limitAdTracking
|
|
2585
|
+
} : {});
|
|
2586
|
+
}
|
|
2587
|
+
function inferDeviceIdType() {
|
|
2588
|
+
if (typeof navigator === "undefined") {
|
|
2589
|
+
return void 0;
|
|
2590
|
+
}
|
|
2591
|
+
var ua = navigator.userAgent;
|
|
2592
|
+
if (/Roku/i.test(ua)) return "rida";
|
|
2593
|
+
if (/Tizen|Samsung/i.test(ua)) return "tifa";
|
|
2594
|
+
if (/AppleTV|Apple TV/i.test(ua)) return "tvOS";
|
|
2595
|
+
if (/AFT|Fire TV|Amazon/i.test(ua)) return "afai";
|
|
2596
|
+
if (/Web0S|webOS|LG Browser|LGSTB|LGE/i.test(ua)) return "lgudid";
|
|
2597
|
+
if (/Android|Google TV/i.test(ua)) return "aaid";
|
|
2598
|
+
if (/iPhone|iPad|iPod/i.test(ua)) return "idfa";
|
|
2599
|
+
return void 0;
|
|
2600
|
+
}
|
|
2601
|
+
function isEquivalentDeviceIdType(tagType, runtimeType) {
|
|
2602
|
+
if (!tagType || !runtimeType) return false;
|
|
2603
|
+
var tag = tagType.toLowerCase();
|
|
2604
|
+
var runtime = runtimeType.toLowerCase();
|
|
2605
|
+
if (tag === runtime) return true;
|
|
2606
|
+
return ANDROID_ID_TYPES.has(tag) && ANDROID_ID_TYPES.has(runtime);
|
|
2607
|
+
}
|
|
2608
|
+
function getOrCreateCtvSessionId() {
|
|
2609
|
+
var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
|
|
2610
|
+
if (existing) {
|
|
2611
|
+
return existing;
|
|
2612
|
+
}
|
|
2613
|
+
var sessionId = createUuid();
|
|
2614
|
+
try {
|
|
2615
|
+
var _window_localStorage;
|
|
2616
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
2617
|
+
} catch (unused) {}
|
|
2618
|
+
return sessionId;
|
|
2619
|
+
}
|
|
2620
|
+
function createUuid() {
|
|
2621
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
2622
|
+
return crypto.randomUUID();
|
|
2623
|
+
}
|
|
2624
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
|
|
2625
|
+
var value = Math.floor(Math.random() * 16);
|
|
2626
|
+
var nibble = char === "x" ? value : value & 3 | 8;
|
|
2627
|
+
return nibble.toString(16);
|
|
2628
|
+
});
|
|
2629
|
+
}
|
|
2630
|
+
function readNativeBridgeSignals() {
|
|
2631
|
+
if (typeof window === "undefined") {
|
|
2632
|
+
return {};
|
|
2633
|
+
}
|
|
2634
|
+
var candidates = [
|
|
2635
|
+
window.__STORMCLOUD_CTV_AD_INFO__,
|
|
2636
|
+
window.__STORMCLOUD_CTV__,
|
|
2637
|
+
window.stormcloudCtv,
|
|
2638
|
+
window.AiryTV,
|
|
2639
|
+
window.Android,
|
|
2640
|
+
window.webOS,
|
|
2641
|
+
window.tizen,
|
|
2642
|
+
window.amazon
|
|
2643
|
+
].filter(Boolean);
|
|
2644
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2645
|
+
try {
|
|
2646
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2647
|
+
var source = _step.value;
|
|
2648
|
+
var contentUrl = readBridgeValue(source, [
|
|
2649
|
+
"contentUrl",
|
|
2650
|
+
"url",
|
|
2651
|
+
"videoUrl",
|
|
2652
|
+
"canonicalUrl"
|
|
2653
|
+
]) || void 0;
|
|
2654
|
+
var appId = readBridgeValue(source, [
|
|
2655
|
+
"appId",
|
|
2656
|
+
"msid",
|
|
2657
|
+
"applicationId",
|
|
2658
|
+
"packageName"
|
|
2659
|
+
]) || void 0;
|
|
2660
|
+
var appName = readBridgeValue(source, [
|
|
2661
|
+
"appName",
|
|
2662
|
+
"an",
|
|
2663
|
+
"applicationName"
|
|
2664
|
+
]) || void 0;
|
|
2665
|
+
var deviceId = readBridgeValue(source, [
|
|
2666
|
+
"rdid",
|
|
2667
|
+
"ifa",
|
|
2668
|
+
"advertisingId",
|
|
2669
|
+
"adId",
|
|
2670
|
+
"deviceId",
|
|
2671
|
+
"lgudid",
|
|
2672
|
+
"LGUDID",
|
|
2673
|
+
"tifa",
|
|
2674
|
+
"rida",
|
|
2675
|
+
"afai",
|
|
2676
|
+
"aaid"
|
|
2677
|
+
]) || void 0;
|
|
2678
|
+
if (!contentUrl && !deviceId && !appId && !appName) continue;
|
|
2679
|
+
var deviceIdType = readBridgeValue(source, [
|
|
2680
|
+
"idtype",
|
|
2681
|
+
"deviceIdType",
|
|
2682
|
+
"advertisingIdType",
|
|
2683
|
+
"idType"
|
|
2684
|
+
]) || inferDeviceIdType();
|
|
2685
|
+
var limitAdTracking = readBridgeBoolean(source, [
|
|
2686
|
+
"is_lat",
|
|
2687
|
+
"limitAdTracking",
|
|
2688
|
+
"limitedAdTracking",
|
|
2689
|
+
"lat"
|
|
2690
|
+
]);
|
|
2691
|
+
return _object_spread({}, contentUrl ? {
|
|
2692
|
+
contentUrl: contentUrl
|
|
2693
|
+
} : {}, appId ? {
|
|
2694
|
+
appId: appId
|
|
2695
|
+
} : {}, appName ? {
|
|
2696
|
+
appName: appName
|
|
2697
|
+
} : {}, deviceId ? {
|
|
2698
|
+
deviceId: deviceId
|
|
2699
|
+
} : {}, deviceId && deviceIdType ? {
|
|
2700
|
+
deviceIdType: deviceIdType
|
|
2701
|
+
} : {}, deviceId && limitAdTracking != null ? {
|
|
2702
|
+
limitAdTracking: limitAdTracking
|
|
2703
|
+
} : {});
|
|
2704
|
+
}
|
|
2705
|
+
} catch (err) {
|
|
2706
|
+
_didIteratorError = true;
|
|
2707
|
+
_iteratorError = err;
|
|
2708
|
+
} finally{
|
|
2709
|
+
try {
|
|
2710
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2711
|
+
_iterator.return();
|
|
2712
|
+
}
|
|
2713
|
+
} finally{
|
|
2714
|
+
if (_didIteratorError) {
|
|
2715
|
+
throw _iteratorError;
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
return {};
|
|
2720
|
+
}
|
|
2721
|
+
function readBridgeValue(source, keys) {
|
|
2722
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2723
|
+
try {
|
|
2724
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2725
|
+
var key = _step.value;
|
|
2726
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
2727
|
+
if (typeof value === "string" && value) {
|
|
2728
|
+
return value;
|
|
2729
|
+
}
|
|
2730
|
+
if (typeof value === "function") {
|
|
2731
|
+
try {
|
|
2732
|
+
var result = value.call(source);
|
|
2733
|
+
if (typeof result === "string" && result) {
|
|
2734
|
+
return result;
|
|
2735
|
+
}
|
|
2736
|
+
} catch (unused) {}
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
} catch (err) {
|
|
2740
|
+
_didIteratorError = true;
|
|
2741
|
+
_iteratorError = err;
|
|
2742
|
+
} finally{
|
|
2743
|
+
try {
|
|
2744
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2745
|
+
_iterator.return();
|
|
2746
|
+
}
|
|
2747
|
+
} finally{
|
|
2748
|
+
if (_didIteratorError) {
|
|
2749
|
+
throw _iteratorError;
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
}
|
|
2753
|
+
return void 0;
|
|
2754
|
+
}
|
|
2755
|
+
function readBridgeBoolean(source, keys) {
|
|
2756
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2757
|
+
try {
|
|
2758
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2759
|
+
var key = _step.value;
|
|
2760
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
2761
|
+
var normalized = normalizeBoolean(value);
|
|
2762
|
+
if (normalized != null) {
|
|
2763
|
+
return normalized;
|
|
2764
|
+
}
|
|
2765
|
+
if (typeof value === "function") {
|
|
2766
|
+
try {
|
|
2767
|
+
var result = normalizeBoolean(value.call(source));
|
|
2768
|
+
if (result != null) {
|
|
2769
|
+
return result;
|
|
2770
|
+
}
|
|
2771
|
+
} catch (unused) {}
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
} catch (err) {
|
|
2775
|
+
_didIteratorError = true;
|
|
2776
|
+
_iteratorError = err;
|
|
2777
|
+
} finally{
|
|
2778
|
+
try {
|
|
2779
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2780
|
+
_iterator.return();
|
|
2781
|
+
}
|
|
2782
|
+
} finally{
|
|
2783
|
+
if (_didIteratorError) {
|
|
2784
|
+
throw _iteratorError;
|
|
2785
|
+
}
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
return void 0;
|
|
2789
|
+
}
|
|
2790
|
+
function readStoredDeviceId() {
|
|
2791
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2792
|
+
try {
|
|
2793
|
+
for(var _iterator = DEVICE_ID_STORAGE_KEYS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2794
|
+
var key = _step.value;
|
|
2795
|
+
var value = readStoredString(key);
|
|
2796
|
+
if (value) {
|
|
2797
|
+
return value;
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
} catch (err) {
|
|
2801
|
+
_didIteratorError = true;
|
|
2802
|
+
_iteratorError = err;
|
|
2803
|
+
} finally{
|
|
2804
|
+
try {
|
|
2805
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2806
|
+
_iterator.return();
|
|
2807
|
+
}
|
|
2808
|
+
} finally{
|
|
2809
|
+
if (_didIteratorError) {
|
|
2810
|
+
throw _iteratorError;
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
return void 0;
|
|
2815
|
+
}
|
|
2816
|
+
function readStoredString(key) {
|
|
2817
|
+
if (typeof window === "undefined") {
|
|
2818
|
+
return void 0;
|
|
2819
|
+
}
|
|
2820
|
+
try {
|
|
2821
|
+
var _window_localStorage;
|
|
2822
|
+
var value = (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key);
|
|
2823
|
+
return value || void 0;
|
|
2824
|
+
} catch (unused) {
|
|
2825
|
+
return void 0;
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
function readStoredLimitAdTracking() {
|
|
2829
|
+
return normalizeBoolean(readStoredString("limitAdTracking") || readStoredString("limitedAdTracking") || readStoredString("is_lat"));
|
|
2830
|
+
}
|
|
2831
|
+
function normalizeBoolean(value) {
|
|
2832
|
+
if (typeof value === "boolean") {
|
|
2833
|
+
return value;
|
|
2834
|
+
}
|
|
2835
|
+
if (typeof value === "number") {
|
|
2836
|
+
return value === 1;
|
|
2837
|
+
}
|
|
2838
|
+
if (typeof value === "string") {
|
|
2839
|
+
var normalized = value.toLowerCase();
|
|
2840
|
+
if (normalized === "1" || normalized === "true" || normalized === "yes") {
|
|
2841
|
+
return true;
|
|
2842
|
+
}
|
|
2843
|
+
if (normalized === "0" || normalized === "false" || normalized === "no") {
|
|
2844
|
+
return false;
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
return void 0;
|
|
2848
|
+
}
|
|
2533
2849
|
// src/utils/vastMacros.ts
|
|
2850
|
+
var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
|
|
2851
|
+
var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
|
|
2852
|
+
var EXAMPLE_COM_URL = /example\.com/i;
|
|
2853
|
+
var CTV_UNSUPPORTED_PARAMS = [
|
|
2854
|
+
"description_url",
|
|
2855
|
+
"tfcd",
|
|
2856
|
+
"npa",
|
|
2857
|
+
"min_ad_duration",
|
|
2858
|
+
"max_ad_duration",
|
|
2859
|
+
"unviewed_position_start",
|
|
2860
|
+
"impl",
|
|
2861
|
+
"scor",
|
|
2862
|
+
"vad_type",
|
|
2863
|
+
"gdpr",
|
|
2864
|
+
"gdpr_consent",
|
|
2865
|
+
"us_privacy"
|
|
2866
|
+
];
|
|
2867
|
+
var INLINE_DEVICE_MACRO_REPLACEMENTS = [
|
|
2868
|
+
{
|
|
2869
|
+
pattern: /\[RDID\]/gi,
|
|
2870
|
+
getValue: function getValue(ctx) {
|
|
2871
|
+
return ctx.deviceId;
|
|
2872
|
+
}
|
|
2873
|
+
},
|
|
2874
|
+
{
|
|
2875
|
+
pattern: /\[IFA\]/gi,
|
|
2876
|
+
getValue: function getValue(ctx) {
|
|
2877
|
+
return ctx.deviceId;
|
|
2878
|
+
}
|
|
2879
|
+
},
|
|
2880
|
+
{
|
|
2881
|
+
pattern: /\[ADVERTISING[_-]?ID(?:ENTIFIER)?\]/gi,
|
|
2882
|
+
getValue: function getValue(ctx) {
|
|
2883
|
+
return ctx.deviceId;
|
|
2884
|
+
}
|
|
2885
|
+
},
|
|
2886
|
+
{
|
|
2887
|
+
pattern: /\[DEVICE[_-]?ID\]/gi,
|
|
2888
|
+
getValue: function getValue(ctx) {
|
|
2889
|
+
return ctx.deviceId;
|
|
2890
|
+
}
|
|
2891
|
+
},
|
|
2892
|
+
{
|
|
2893
|
+
pattern: /\[IDTYPE\]/gi,
|
|
2894
|
+
getValue: function getValue(ctx) {
|
|
2895
|
+
return ctx.deviceIdType;
|
|
2896
|
+
}
|
|
2897
|
+
},
|
|
2898
|
+
{
|
|
2899
|
+
pattern: /\{rdid\}/gi,
|
|
2900
|
+
getValue: function getValue(ctx) {
|
|
2901
|
+
return ctx.deviceId;
|
|
2902
|
+
}
|
|
2903
|
+
},
|
|
2904
|
+
{
|
|
2905
|
+
pattern: /\{device[_-]?id\}/gi,
|
|
2906
|
+
getValue: function getValue(ctx) {
|
|
2907
|
+
return ctx.deviceId;
|
|
2908
|
+
}
|
|
2909
|
+
},
|
|
2910
|
+
{
|
|
2911
|
+
pattern: /\{idtype\}/gi,
|
|
2912
|
+
getValue: function getValue(ctx) {
|
|
2913
|
+
return ctx.deviceIdType;
|
|
2914
|
+
}
|
|
2915
|
+
},
|
|
2916
|
+
{
|
|
2917
|
+
pattern: /%%ADVERTISING_IDENTIFIER_PLAIN%%/gi,
|
|
2918
|
+
getValue: function getValue(ctx) {
|
|
2919
|
+
return ctx.deviceId;
|
|
2920
|
+
}
|
|
2921
|
+
},
|
|
2922
|
+
{
|
|
2923
|
+
pattern: /%%ADVERTISING_ID_OPT_OUT%%/gi,
|
|
2924
|
+
getValue: function getValue(ctx) {
|
|
2925
|
+
return ctx.limitAdTracking != null ? ctx.limitAdTracking ? "1" : "0" : void 0;
|
|
2926
|
+
}
|
|
2927
|
+
},
|
|
2928
|
+
{
|
|
2929
|
+
pattern: /%%ADVERTISING_ID_TYPE%%/gi,
|
|
2930
|
+
getValue: function getValue(ctx) {
|
|
2931
|
+
return ctx.deviceIdType;
|
|
2932
|
+
}
|
|
2933
|
+
},
|
|
2934
|
+
{
|
|
2935
|
+
pattern: /%%ADVERTISING_ID%%/gi,
|
|
2936
|
+
getValue: function getValue(ctx) {
|
|
2937
|
+
return ctx.deviceId;
|
|
2938
|
+
}
|
|
2939
|
+
},
|
|
2940
|
+
{
|
|
2941
|
+
pattern: /%%LIMIT_AD_TRACKING%%/gi,
|
|
2942
|
+
getValue: function getValue(ctx) {
|
|
2943
|
+
return ctx.limitAdTracking != null ? ctx.limitAdTracking ? "1" : "0" : void 0;
|
|
2944
|
+
}
|
|
2945
|
+
},
|
|
2946
|
+
{
|
|
2947
|
+
pattern: /%%MSID%%/gi,
|
|
2948
|
+
getValue: function getValue(ctx) {
|
|
2949
|
+
return ctx.appId;
|
|
2950
|
+
}
|
|
2951
|
+
},
|
|
2952
|
+
{
|
|
2953
|
+
pattern: /%%APP_NAME%%/gi,
|
|
2954
|
+
getValue: function getValue(ctx) {
|
|
2955
|
+
return ctx.appName;
|
|
2956
|
+
}
|
|
2957
|
+
},
|
|
2958
|
+
{
|
|
2959
|
+
pattern: /%%SESSION_ID%%/gi,
|
|
2960
|
+
getValue: function getValue(ctx) {
|
|
2961
|
+
return ctx.sessionId;
|
|
2962
|
+
}
|
|
2963
|
+
},
|
|
2964
|
+
{
|
|
2965
|
+
pattern: /%%CORRELATOR%%/gi,
|
|
2966
|
+
getValue: function getValue(ctx) {
|
|
2967
|
+
return ctx.correlator;
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
];
|
|
2971
|
+
function isMacroPlaceholder(value) {
|
|
2972
|
+
if (value == null) return true;
|
|
2973
|
+
var trimmed = value.trim();
|
|
2974
|
+
if (!trimmed) return true;
|
|
2975
|
+
if (UNEXPANDED_MACRO_PATTERN.test(trimmed)) return true;
|
|
2976
|
+
return /^(unknown|null|undefined|none|n\/a|\$\{[^}]+\})$/i.test(trimmed);
|
|
2977
|
+
}
|
|
2534
2978
|
function generateCorrelator() {
|
|
2535
2979
|
if (typeof crypto !== "undefined" && crypto.getRandomValues) {
|
|
2536
2980
|
try {
|
|
@@ -2545,29 +2989,140 @@ function generateCorrelator() {
|
|
|
2545
2989
|
}
|
|
2546
2990
|
return String(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER) + 1);
|
|
2547
2991
|
}
|
|
2548
|
-
|
|
2549
|
-
var
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2992
|
+
function expandInlineMacroPlaceholders(baseUrl, ctx) {
|
|
2993
|
+
var url = baseUrl;
|
|
2994
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2995
|
+
try {
|
|
2996
|
+
for(var _iterator = INLINE_DEVICE_MACRO_REPLACEMENTS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2997
|
+
var _step_value = _step.value, pattern = _step_value.pattern, getValue = _step_value.getValue;
|
|
2998
|
+
var value = getValue(ctx);
|
|
2999
|
+
if (value != null && value !== "") {
|
|
3000
|
+
url = url.replace(pattern, encodeURIComponent(value));
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
} catch (err) {
|
|
3004
|
+
_didIteratorError = true;
|
|
3005
|
+
_iteratorError = err;
|
|
3006
|
+
} finally{
|
|
3007
|
+
try {
|
|
3008
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3009
|
+
_iterator.return();
|
|
3010
|
+
}
|
|
3011
|
+
} finally{
|
|
3012
|
+
if (_didIteratorError) {
|
|
3013
|
+
throw _iteratorError;
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
return url;
|
|
3018
|
+
}
|
|
3019
|
+
function applyDeviceIdentityParams(params, ctx) {
|
|
3020
|
+
var _ctx_deviceId, _ctx_deviceIdType;
|
|
3021
|
+
var runtimeId = (_ctx_deviceId = ctx.deviceId) === null || _ctx_deviceId === void 0 ? void 0 : _ctx_deviceId.trim();
|
|
3022
|
+
var runtimeType = ((_ctx_deviceIdType = ctx.deviceIdType) === null || _ctx_deviceIdType === void 0 ? void 0 : _ctx_deviceIdType.trim()) || inferDeviceIdType();
|
|
3023
|
+
var tagRdid = params.get("rdid");
|
|
3024
|
+
var tagType = params.get("idtype");
|
|
3025
|
+
var tagLat = params.get("is_lat");
|
|
3026
|
+
var latValue = ctx.limitAdTracking != null ? ctx.limitAdTracking ? "1" : "0" : void 0;
|
|
3027
|
+
if (runtimeId) {
|
|
3028
|
+
params.set("rdid", runtimeId);
|
|
3029
|
+
params.set("idtype", runtimeType || tagType || "aaid");
|
|
3030
|
+
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : isMacroPlaceholder(tagLat) ? "0" : tagLat);
|
|
3031
|
+
return;
|
|
3032
|
+
}
|
|
3033
|
+
var tagRdidValid = Boolean(tagRdid && !isMacroPlaceholder(tagRdid));
|
|
3034
|
+
var tagTypeValid = Boolean(tagType && !isMacroPlaceholder(tagType));
|
|
3035
|
+
if (tagRdidValid && tagTypeValid && runtimeType && !isEquivalentDeviceIdType(tagType, runtimeType)) {
|
|
3036
|
+
params.delete("rdid");
|
|
3037
|
+
params.delete("idtype");
|
|
3038
|
+
params.delete("is_lat");
|
|
3039
|
+
return;
|
|
3040
|
+
}
|
|
3041
|
+
if (tagRdidValid) {
|
|
3042
|
+
if (isMacroPlaceholder(tagType) && runtimeType) {
|
|
3043
|
+
params.set("idtype", runtimeType);
|
|
3044
|
+
}
|
|
3045
|
+
if (isMacroPlaceholder(tagLat)) {
|
|
3046
|
+
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : "0");
|
|
3047
|
+
}
|
|
3048
|
+
return;
|
|
3049
|
+
}
|
|
3050
|
+
params.delete("rdid");
|
|
3051
|
+
params.delete("idtype");
|
|
3052
|
+
params.delete("is_lat");
|
|
3053
|
+
}
|
|
3054
|
+
function removeBrokenAppNameOrphans(params, appName) {
|
|
3055
|
+
var toDelete = [];
|
|
3056
|
+
params.forEach(function(_value, key) {
|
|
3057
|
+
if (!key || INVALID_VAST_PARAM_KEY.test(key)) {
|
|
3058
|
+
toDelete.push(key);
|
|
3059
|
+
}
|
|
3060
|
+
});
|
|
3061
|
+
if (appName && appName.includes("&")) {
|
|
3062
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3063
|
+
try {
|
|
3064
|
+
for(var _iterator = appName.split("&").slice(1)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3065
|
+
var suffix = _step.value;
|
|
3066
|
+
var trimmed = suffix.trimStart();
|
|
3067
|
+
if (!trimmed) continue;
|
|
3068
|
+
toDelete.push(suffix, " ".concat(trimmed), trimmed);
|
|
3069
|
+
}
|
|
3070
|
+
} catch (err) {
|
|
3071
|
+
_didIteratorError = true;
|
|
3072
|
+
_iteratorError = err;
|
|
3073
|
+
} finally{
|
|
3074
|
+
try {
|
|
3075
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3076
|
+
_iterator.return();
|
|
3077
|
+
}
|
|
3078
|
+
} finally{
|
|
3079
|
+
if (_didIteratorError) {
|
|
3080
|
+
throw _iteratorError;
|
|
3081
|
+
}
|
|
3082
|
+
}
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
3086
|
+
try {
|
|
3087
|
+
for(var _iterator1 = new Set(toDelete)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
3088
|
+
var key = _step1.value;
|
|
3089
|
+
if (key) params.delete(key);
|
|
3090
|
+
}
|
|
3091
|
+
} catch (err) {
|
|
3092
|
+
_didIteratorError1 = true;
|
|
3093
|
+
_iteratorError1 = err;
|
|
3094
|
+
} finally{
|
|
3095
|
+
try {
|
|
3096
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
3097
|
+
_iterator1.return();
|
|
3098
|
+
}
|
|
3099
|
+
} finally{
|
|
3100
|
+
if (_didIteratorError1) {
|
|
3101
|
+
throw _iteratorError1;
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
function normalizeVastTagUrl(raw) {
|
|
3107
|
+
if (!raw) return raw;
|
|
3108
|
+
try {
|
|
3109
|
+
var url = new URL(raw);
|
|
3110
|
+
removeBrokenAppNameOrphans(url.searchParams);
|
|
3111
|
+
return url.toString();
|
|
3112
|
+
} catch (unused) {
|
|
3113
|
+
return raw;
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
2563
3116
|
function applyVastMacros(baseUrl, ctx) {
|
|
3117
|
+
var expandedUrl = expandInlineMacroPlaceholders(baseUrl, ctx);
|
|
2564
3118
|
var url;
|
|
2565
3119
|
try {
|
|
2566
|
-
url = new URL(
|
|
3120
|
+
url = new URL(normalizeVastTagUrl(expandedUrl));
|
|
2567
3121
|
} catch (unused) {
|
|
2568
|
-
return replaceCorrelatorFallback(
|
|
3122
|
+
return replaceCorrelatorFallback(expandedUrl, ctx.correlator);
|
|
2569
3123
|
}
|
|
2570
3124
|
var params = url.searchParams;
|
|
3125
|
+
removeBrokenAppNameOrphans(params, ctx.appName);
|
|
2571
3126
|
params.set("correlator", ctx.correlator);
|
|
2572
3127
|
if (ctx.isCtv) {
|
|
2573
3128
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -2605,6 +3160,12 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2605
3160
|
if (!ctx.isCtv) {
|
|
2606
3161
|
params.set("description_url", requestUrl);
|
|
2607
3162
|
}
|
|
3163
|
+
} else {
|
|
3164
|
+
var existingUrl = params.get("url") || "";
|
|
3165
|
+
if (EXAMPLE_COM_URL.test(existingUrl)) {
|
|
3166
|
+
params.delete("url");
|
|
3167
|
+
params.delete("description_url");
|
|
3168
|
+
}
|
|
2608
3169
|
}
|
|
2609
3170
|
if (ctx.adWillPlayMuted != null) {
|
|
2610
3171
|
params.set("vpmute", ctx.adWillPlayMuted ? "1" : "0");
|
|
@@ -2616,6 +3177,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2616
3177
|
params.set("msid", ctx.appId);
|
|
2617
3178
|
}
|
|
2618
3179
|
if (ctx.appName) {
|
|
3180
|
+
removeBrokenAppNameOrphans(params, ctx.appName);
|
|
2619
3181
|
params.set("an", ctx.appName);
|
|
2620
3182
|
}
|
|
2621
3183
|
if (ctx.sessionId) {
|
|
@@ -2626,15 +3188,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2626
3188
|
} else if (ctx.isCtv) {
|
|
2627
3189
|
params.set("dth", "5");
|
|
2628
3190
|
}
|
|
2629
|
-
|
|
2630
|
-
params.set("rdid", ctx.deviceId);
|
|
2631
|
-
params.set("idtype", ctx.deviceIdType);
|
|
2632
|
-
params.set("is_lat", ctx.limitAdTracking ? "1" : "0");
|
|
2633
|
-
} else {
|
|
2634
|
-
params.delete("rdid");
|
|
2635
|
-
params.delete("idtype");
|
|
2636
|
-
params.delete("is_lat");
|
|
2637
|
-
}
|
|
3191
|
+
applyDeviceIdentityParams(params, ctx);
|
|
2638
3192
|
if (!ctx.isCtv) {
|
|
2639
3193
|
var consent = ctx.consent;
|
|
2640
3194
|
if ((consent === null || consent === void 0 ? void 0 : consent.gdpr) != null) {
|
|
@@ -2652,7 +3206,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2652
3206
|
}
|
|
2653
3207
|
var staleKeys = [];
|
|
2654
3208
|
params.forEach(function(value, key) {
|
|
2655
|
-
if (
|
|
3209
|
+
if (isMacroPlaceholder(value)) {
|
|
2656
3210
|
staleKeys.push(key);
|
|
2657
3211
|
}
|
|
2658
3212
|
});
|
|
@@ -2676,6 +3230,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2676
3230
|
}
|
|
2677
3231
|
}
|
|
2678
3232
|
}
|
|
3233
|
+
removeBrokenAppNameOrphans(params, ctx.appName);
|
|
2679
3234
|
return url.toString();
|
|
2680
3235
|
}
|
|
2681
3236
|
function replaceCorrelatorFallback(baseUrl, correlator) {
|
|
@@ -3709,516 +4264,250 @@ var Scte35CueManager = /*#__PURE__*/ function() {
|
|
|
3709
4264
|
this.callbacks = callbacks;
|
|
3710
4265
|
}
|
|
3711
4266
|
_create_class(Scte35CueManager, [
|
|
3712
|
-
{
|
|
3713
|
-
key: "pendingScte35CueKey",
|
|
3714
|
-
get: function get() {
|
|
3715
|
-
return this.pendingScte35CueKeyValue;
|
|
3716
|
-
},
|
|
3717
|
-
set: function set(value) {
|
|
3718
|
-
this.pendingScte35CueKeyValue = value;
|
|
3719
|
-
}
|
|
3720
|
-
},
|
|
3721
|
-
{
|
|
3722
|
-
key: "activeScte35BreakKey",
|
|
3723
|
-
get: function get() {
|
|
3724
|
-
return this.activeScte35BreakKeyValue;
|
|
3725
|
-
},
|
|
3726
|
-
set: function set(value) {
|
|
3727
|
-
this.activeScte35BreakKeyValue = value;
|
|
3728
|
-
}
|
|
3729
|
-
},
|
|
3730
|
-
{
|
|
3731
|
-
key: "scheduledScte35BreakKey",
|
|
3732
|
-
get: function get() {
|
|
3733
|
-
return this.scheduledScte35BreakKeyValue;
|
|
3734
|
-
},
|
|
3735
|
-
set: function set(value) {
|
|
3736
|
-
this.scheduledScte35BreakKeyValue = value;
|
|
3737
|
-
}
|
|
3738
|
-
},
|
|
3739
|
-
{
|
|
3740
|
-
key: "createScte35CueContext",
|
|
3741
|
-
value: function createScte35CueContext(source, readiness, frag) {
|
|
3742
|
-
var context = {
|
|
3743
|
-
source: source,
|
|
3744
|
-
readiness: readiness
|
|
3745
|
-
};
|
|
3746
|
-
if (typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number") {
|
|
3747
|
-
context.fragmentSn = frag.sn;
|
|
3748
|
-
}
|
|
3749
|
-
var fragmentStartSec = getFragmentStartSeconds(frag);
|
|
3750
|
-
if (fragmentStartSec !== void 0) {
|
|
3751
|
-
context.fragmentStartSeconds = fragmentStartSec;
|
|
3752
|
-
}
|
|
3753
|
-
return context;
|
|
3754
|
-
}
|
|
3755
|
-
},
|
|
3756
|
-
{
|
|
3757
|
-
key: "onScte35Cue",
|
|
3758
|
-
value: function onScte35Cue(marker, context) {
|
|
3759
|
-
var cue = this.createScte35Cue(marker, context);
|
|
3760
|
-
var pendingKey = this.getPendingScte35CueKey(cue);
|
|
3761
|
-
if (context.readiness === "early") {
|
|
3762
|
-
this.pendingScte35Cues.set(pendingKey, cue);
|
|
3763
|
-
this.trimRecentScte35CueMaps();
|
|
3764
|
-
if (marker.type === "start") {
|
|
3765
|
-
this.callbacks.onEarlyStartCue(marker, context.fragmentSn, cue.key);
|
|
3766
|
-
}
|
|
3767
|
-
return;
|
|
3768
|
-
}
|
|
3769
|
-
if (marker.type === "end" && !this.shouldAcceptScte35EndCue(cue)) {
|
|
3770
|
-
if (this.debug) {
|
|
3771
|
-
console.log("[StormcloudVideoPlayer] Ignoring SCTE-35 end cue", {
|
|
3772
|
-
key: cue.key,
|
|
3773
|
-
activeScte35BreakKey: this.activeScte35BreakKeyValue,
|
|
3774
|
-
inAdBreak: this.callbacks.isInAdBreak(),
|
|
3775
|
-
source: cue.source
|
|
3776
|
-
});
|
|
3777
|
-
}
|
|
3778
|
-
return;
|
|
3779
|
-
}
|
|
3780
|
-
if (marker.type === "start" && this.hasRecentlyHandledScte35Cue(cue)) {
|
|
3781
|
-
if (this.debug) {
|
|
3782
|
-
console.log("[StormcloudVideoPlayer] Ignoring duplicate SCTE-35 start cue", {
|
|
3783
|
-
key: cue.key,
|
|
3784
|
-
source: cue.source
|
|
3785
|
-
});
|
|
3786
|
-
}
|
|
3787
|
-
return;
|
|
3788
|
-
}
|
|
3789
|
-
this.pendingScte35Cues.delete(pendingKey);
|
|
3790
|
-
this.markScte35CueHandled(cue);
|
|
3791
|
-
this.callbacks.onPlaybackCue(marker, cue.key);
|
|
3792
|
-
}
|
|
3793
|
-
},
|
|
3794
|
-
{
|
|
3795
|
-
key: "activatePendingScte35CuesForFragment",
|
|
3796
|
-
value: function activatePendingScte35CuesForFragment(frag) {
|
|
3797
|
-
var _this = this;
|
|
3798
|
-
var fragmentSn = typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number" ? frag.sn : void 0;
|
|
3799
|
-
if (fragmentSn === void 0) {
|
|
3800
|
-
return;
|
|
3801
|
-
}
|
|
3802
|
-
var matchingCues = Array.from(this.pendingScte35Cues.entries()).filter(function(param) {
|
|
3803
|
-
var _param = _sliced_to_array(param, 2), cue = _param[1];
|
|
3804
|
-
return cue.fragmentSn === fragmentSn;
|
|
3805
|
-
});
|
|
3806
|
-
matchingCues.forEach(function(param) {
|
|
3807
|
-
var _param = _sliced_to_array(param, 2), pendingKey = _param[0], cue = _param[1];
|
|
3808
|
-
var _cue_fragmentStartSeconds;
|
|
3809
|
-
_this.pendingScte35Cues.delete(pendingKey);
|
|
3810
|
-
var context = {
|
|
3811
|
-
source: cue.source,
|
|
3812
|
-
readiness: "playback"
|
|
3813
|
-
};
|
|
3814
|
-
context.fragmentSn = fragmentSn;
|
|
3815
|
-
var fragmentStartSec = (_cue_fragmentStartSeconds = cue.fragmentStartSeconds) !== null && _cue_fragmentStartSeconds !== void 0 ? _cue_fragmentStartSeconds : getFragmentStartSeconds(frag);
|
|
3816
|
-
if (fragmentStartSec !== void 0) {
|
|
3817
|
-
context.fragmentStartSeconds = fragmentStartSec;
|
|
3818
|
-
}
|
|
3819
|
-
_this.onScte35Cue(cue.marker, context);
|
|
3820
|
-
});
|
|
3821
|
-
}
|
|
3822
|
-
},
|
|
3823
|
-
{
|
|
3824
|
-
key: "createScte35Cue",
|
|
3825
|
-
value: function createScte35Cue(marker, context) {
|
|
3826
|
-
var cue = {
|
|
3827
|
-
marker: marker,
|
|
3828
|
-
source: context.source,
|
|
3829
|
-
readiness: context.readiness,
|
|
3830
|
-
key: this.getScte35CueKey(marker, context)
|
|
3831
|
-
};
|
|
3832
|
-
if (context.fragmentSn !== void 0) {
|
|
3833
|
-
cue.fragmentSn = context.fragmentSn;
|
|
3834
|
-
}
|
|
3835
|
-
if (context.fragmentStartSeconds !== void 0) {
|
|
3836
|
-
cue.fragmentStartSeconds = context.fragmentStartSeconds;
|
|
3837
|
-
}
|
|
3838
|
-
return cue;
|
|
3839
|
-
}
|
|
3840
|
-
},
|
|
3841
|
-
{
|
|
3842
|
-
key: "getScte35CueKey",
|
|
3843
|
-
value: function getScte35CueKey(marker, context) {
|
|
3844
|
-
var _raw_attrs, _raw_attrs1, _raw_attrs2;
|
|
3845
|
-
var raw = this.getScte35MarkerRaw(marker);
|
|
3846
|
-
var spliceEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.splice_event_id);
|
|
3847
|
-
if (spliceEventId) {
|
|
3848
|
-
return "splice:".concat(spliceEventId);
|
|
3849
|
-
}
|
|
3850
|
-
var segmentationEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.segmentation_event_id);
|
|
3851
|
-
if (segmentationEventId) {
|
|
3852
|
-
return "segmentation:".concat(segmentationEventId);
|
|
3853
|
-
}
|
|
3854
|
-
var daterangeId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs = raw.attrs) === null || _raw_attrs === void 0 ? void 0 : _raw_attrs.ID);
|
|
3855
|
-
if (daterangeId) {
|
|
3856
|
-
return "daterange:".concat(daterangeId);
|
|
3857
|
-
}
|
|
3858
|
-
var scteValue = this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs1 = raw.attrs) === null || _raw_attrs1 === void 0 ? void 0 : _raw_attrs1["SCTE35-OUT"]) || this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs2 = raw.attrs) === null || _raw_attrs2 === void 0 ? void 0 : _raw_attrs2["SCTE35-IN"]);
|
|
3859
|
-
if (scteValue) {
|
|
3860
|
-
return "daterange-scte:".concat(scteValue);
|
|
3861
|
-
}
|
|
3862
|
-
if (typeof marker.ptsSeconds === "number" && Number.isFinite(marker.ptsSeconds)) {
|
|
3863
|
-
return "pts:".concat(Math.round(marker.ptsSeconds * 2) / 2);
|
|
3864
|
-
}
|
|
3865
|
-
if (context.fragmentSn !== void 0) {
|
|
3866
|
-
return "fragment:".concat(context.fragmentSn);
|
|
3867
|
-
}
|
|
3868
|
-
return "".concat(context.source, ":wallclock:").concat(Math.floor(Date.now() / 1e3));
|
|
4267
|
+
{
|
|
4268
|
+
key: "pendingScte35CueKey",
|
|
4269
|
+
get: function get() {
|
|
4270
|
+
return this.pendingScte35CueKeyValue;
|
|
4271
|
+
},
|
|
4272
|
+
set: function set(value) {
|
|
4273
|
+
this.pendingScte35CueKeyValue = value;
|
|
3869
4274
|
}
|
|
3870
4275
|
},
|
|
3871
4276
|
{
|
|
3872
|
-
key: "
|
|
3873
|
-
|
|
3874
|
-
return
|
|
4277
|
+
key: "activeScte35BreakKey",
|
|
4278
|
+
get: function get() {
|
|
4279
|
+
return this.activeScte35BreakKeyValue;
|
|
4280
|
+
},
|
|
4281
|
+
set: function set(value) {
|
|
4282
|
+
this.activeScte35BreakKeyValue = value;
|
|
3875
4283
|
}
|
|
3876
4284
|
},
|
|
3877
4285
|
{
|
|
3878
|
-
key: "
|
|
3879
|
-
|
|
3880
|
-
return
|
|
4286
|
+
key: "scheduledScte35BreakKey",
|
|
4287
|
+
get: function get() {
|
|
4288
|
+
return this.scheduledScte35BreakKeyValue;
|
|
4289
|
+
},
|
|
4290
|
+
set: function set(value) {
|
|
4291
|
+
this.scheduledScte35BreakKeyValue = value;
|
|
3881
4292
|
}
|
|
3882
4293
|
},
|
|
3883
4294
|
{
|
|
3884
|
-
key: "
|
|
3885
|
-
value: function
|
|
3886
|
-
|
|
3887
|
-
|
|
4295
|
+
key: "createScte35CueContext",
|
|
4296
|
+
value: function createScte35CueContext(source, readiness, frag) {
|
|
4297
|
+
var context = {
|
|
4298
|
+
source: source,
|
|
4299
|
+
readiness: readiness
|
|
4300
|
+
};
|
|
4301
|
+
if (typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number") {
|
|
4302
|
+
context.fragmentSn = frag.sn;
|
|
3888
4303
|
}
|
|
3889
|
-
|
|
3890
|
-
|
|
4304
|
+
var fragmentStartSec = getFragmentStartSeconds(frag);
|
|
4305
|
+
if (fragmentStartSec !== void 0) {
|
|
4306
|
+
context.fragmentStartSeconds = fragmentStartSec;
|
|
3891
4307
|
}
|
|
3892
|
-
return
|
|
3893
|
-
}
|
|
3894
|
-
},
|
|
3895
|
-
{
|
|
3896
|
-
key: "isStrongScte35CueKey",
|
|
3897
|
-
value: function isStrongScte35CueKey(key) {
|
|
3898
|
-
return !!(key && (key.startsWith("splice:") || key.startsWith("segmentation:") || key.startsWith("daterange:") || key.startsWith("daterange-scte:")));
|
|
4308
|
+
return context;
|
|
3899
4309
|
}
|
|
3900
4310
|
},
|
|
3901
4311
|
{
|
|
3902
|
-
key: "
|
|
3903
|
-
value: function
|
|
3904
|
-
|
|
3905
|
-
|
|
4312
|
+
key: "onScte35Cue",
|
|
4313
|
+
value: function onScte35Cue(marker, context) {
|
|
4314
|
+
var cue = this.createScte35Cue(marker, context);
|
|
4315
|
+
var pendingKey = this.getPendingScte35CueKey(cue);
|
|
4316
|
+
if (context.readiness === "early") {
|
|
4317
|
+
this.pendingScte35Cues.set(pendingKey, cue);
|
|
4318
|
+
this.trimRecentScte35CueMaps();
|
|
4319
|
+
if (marker.type === "start") {
|
|
4320
|
+
this.callbacks.onEarlyStartCue(marker, context.fragmentSn, cue.key);
|
|
4321
|
+
}
|
|
4322
|
+
return;
|
|
3906
4323
|
}
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
this.trimRecentScte35CueMaps();
|
|
3916
|
-
}
|
|
3917
|
-
},
|
|
3918
|
-
{
|
|
3919
|
-
key: "trimRecentScte35CueMaps",
|
|
3920
|
-
value: function trimRecentScte35CueMaps() {
|
|
3921
|
-
while(this.recentScte35CueKeys.size > this.recentScte35CueLimit){
|
|
3922
|
-
var firstKey = this.recentScte35CueKeys.keys().next().value;
|
|
3923
|
-
if (!firstKey) {
|
|
3924
|
-
break;
|
|
4324
|
+
if (marker.type === "end" && !this.shouldAcceptScte35EndCue(cue)) {
|
|
4325
|
+
if (this.debug) {
|
|
4326
|
+
console.log("[StormcloudVideoPlayer] Ignoring SCTE-35 end cue", {
|
|
4327
|
+
key: cue.key,
|
|
4328
|
+
activeScte35BreakKey: this.activeScte35BreakKeyValue,
|
|
4329
|
+
inAdBreak: this.callbacks.isInAdBreak(),
|
|
4330
|
+
source: cue.source
|
|
4331
|
+
});
|
|
3925
4332
|
}
|
|
3926
|
-
|
|
4333
|
+
return;
|
|
3927
4334
|
}
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
4335
|
+
if (marker.type === "start" && this.hasRecentlyHandledScte35Cue(cue)) {
|
|
4336
|
+
if (this.debug) {
|
|
4337
|
+
console.log("[StormcloudVideoPlayer] Ignoring duplicate SCTE-35 start cue", {
|
|
4338
|
+
key: cue.key,
|
|
4339
|
+
source: cue.source
|
|
4340
|
+
});
|
|
3932
4341
|
}
|
|
3933
|
-
|
|
4342
|
+
return;
|
|
3934
4343
|
}
|
|
4344
|
+
this.pendingScte35Cues.delete(pendingKey);
|
|
4345
|
+
this.markScte35CueHandled(cue);
|
|
4346
|
+
this.callbacks.onPlaybackCue(marker, cue.key);
|
|
3935
4347
|
}
|
|
3936
4348
|
},
|
|
3937
4349
|
{
|
|
3938
|
-
key: "
|
|
3939
|
-
value: function
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
return false;
|
|
4350
|
+
key: "activatePendingScte35CuesForFragment",
|
|
4351
|
+
value: function activatePendingScte35CuesForFragment(frag) {
|
|
4352
|
+
var _this = this;
|
|
4353
|
+
var fragmentSn = typeof (frag === null || frag === void 0 ? void 0 : frag.sn) === "number" ? frag.sn : void 0;
|
|
4354
|
+
if (fragmentSn === void 0) {
|
|
4355
|
+
return;
|
|
3945
4356
|
}
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
var
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
"deviceAdvertisingId",
|
|
3963
|
-
"aaid",
|
|
3964
|
-
"adid",
|
|
3965
|
-
"rida",
|
|
3966
|
-
"tifa"
|
|
3967
|
-
];
|
|
3968
|
-
function resolveCtvVastSignals() {
|
|
3969
|
-
var _ref, _bridgeSignals_limitAdTracking;
|
|
3970
|
-
var bridgeSignals = readNativeBridgeSignals();
|
|
3971
|
-
var deviceId = bridgeSignals.deviceId || readStoredDeviceId();
|
|
3972
|
-
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || inferDeviceIdType();
|
|
3973
|
-
var contentUrl = bridgeSignals.contentUrl || readStoredString("contentUrl") || AIRY_DEFAULT_CONTENT_URL;
|
|
3974
|
-
return _object_spread_props(_object_spread({
|
|
3975
|
-
contentUrl: contentUrl,
|
|
3976
|
-
appId: AIRY_ANDROID_APP_ID,
|
|
3977
|
-
appName: AIRY_APP_NAME,
|
|
3978
|
-
sessionId: getOrCreateCtvSessionId()
|
|
3979
|
-
}, deviceId ? {
|
|
3980
|
-
deviceId: deviceId
|
|
3981
|
-
} : {}, deviceId && deviceIdType ? {
|
|
3982
|
-
deviceIdType: deviceIdType
|
|
3983
|
-
} : {}, deviceId ? {
|
|
3984
|
-
limitAdTracking: (_ref = (_bridgeSignals_limitAdTracking = bridgeSignals.limitAdTracking) !== null && _bridgeSignals_limitAdTracking !== void 0 ? _bridgeSignals_limitAdTracking : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false
|
|
3985
|
-
} : {}), {
|
|
3986
|
-
deviceTypeHint: 5
|
|
3987
|
-
});
|
|
3988
|
-
}
|
|
3989
|
-
function getOrCreateCtvSessionId() {
|
|
3990
|
-
var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
|
|
3991
|
-
if (existing) {
|
|
3992
|
-
return existing;
|
|
3993
|
-
}
|
|
3994
|
-
var sessionId = createUuid();
|
|
3995
|
-
try {
|
|
3996
|
-
var _window_localStorage;
|
|
3997
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
3998
|
-
} catch (unused) {}
|
|
3999
|
-
return sessionId;
|
|
4000
|
-
}
|
|
4001
|
-
function createUuid() {
|
|
4002
|
-
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
4003
|
-
return crypto.randomUUID();
|
|
4004
|
-
}
|
|
4005
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
|
|
4006
|
-
var value = Math.floor(Math.random() * 16);
|
|
4007
|
-
var nibble = char === "x" ? value : value & 3 | 8;
|
|
4008
|
-
return nibble.toString(16);
|
|
4009
|
-
});
|
|
4010
|
-
}
|
|
4011
|
-
function readNativeBridgeSignals() {
|
|
4012
|
-
if (typeof window === "undefined") {
|
|
4013
|
-
return {};
|
|
4014
|
-
}
|
|
4015
|
-
var candidates = [
|
|
4016
|
-
window.__STORMCLOUD_CTV_AD_INFO__,
|
|
4017
|
-
window.__STORMCLOUD_CTV__,
|
|
4018
|
-
window.stormcloudCtv,
|
|
4019
|
-
window.AiryTV,
|
|
4020
|
-
window.Android
|
|
4021
|
-
].filter(Boolean);
|
|
4022
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4023
|
-
try {
|
|
4024
|
-
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4025
|
-
var source = _step.value;
|
|
4026
|
-
var contentUrl = readBridgeValue(source, [
|
|
4027
|
-
"contentUrl",
|
|
4028
|
-
"url",
|
|
4029
|
-
"videoUrl",
|
|
4030
|
-
"canonicalUrl"
|
|
4031
|
-
]) || void 0;
|
|
4032
|
-
var deviceId = readBridgeValue(source, [
|
|
4033
|
-
"rdid",
|
|
4034
|
-
"ifa",
|
|
4035
|
-
"advertisingId",
|
|
4036
|
-
"adId",
|
|
4037
|
-
"deviceId"
|
|
4038
|
-
]) || void 0;
|
|
4039
|
-
if (!contentUrl && !deviceId) continue;
|
|
4040
|
-
var deviceIdType = readBridgeValue(source, [
|
|
4041
|
-
"idtype",
|
|
4042
|
-
"deviceIdType",
|
|
4043
|
-
"advertisingIdType"
|
|
4044
|
-
]) || inferDeviceIdType();
|
|
4045
|
-
var limitAdTracking = readBridgeBoolean(source, [
|
|
4046
|
-
"is_lat",
|
|
4047
|
-
"limitAdTracking",
|
|
4048
|
-
"limitedAdTracking",
|
|
4049
|
-
"lat"
|
|
4050
|
-
]);
|
|
4051
|
-
return _object_spread({}, contentUrl ? {
|
|
4052
|
-
contentUrl: contentUrl
|
|
4053
|
-
} : {}, deviceId ? {
|
|
4054
|
-
deviceId: deviceId
|
|
4055
|
-
} : {}, deviceId && deviceIdType ? {
|
|
4056
|
-
deviceIdType: deviceIdType
|
|
4057
|
-
} : {}, deviceId && limitAdTracking != null ? {
|
|
4058
|
-
limitAdTracking: limitAdTracking
|
|
4059
|
-
} : {});
|
|
4060
|
-
}
|
|
4061
|
-
} catch (err) {
|
|
4062
|
-
_didIteratorError = true;
|
|
4063
|
-
_iteratorError = err;
|
|
4064
|
-
} finally{
|
|
4065
|
-
try {
|
|
4066
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4067
|
-
_iterator.return();
|
|
4068
|
-
}
|
|
4069
|
-
} finally{
|
|
4070
|
-
if (_didIteratorError) {
|
|
4071
|
-
throw _iteratorError;
|
|
4072
|
-
}
|
|
4073
|
-
}
|
|
4074
|
-
}
|
|
4075
|
-
return {};
|
|
4076
|
-
}
|
|
4077
|
-
function readBridgeValue(source, keys) {
|
|
4078
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4079
|
-
try {
|
|
4080
|
-
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4081
|
-
var key = _step.value;
|
|
4082
|
-
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
4083
|
-
if (typeof value === "string" && value) {
|
|
4084
|
-
return value;
|
|
4085
|
-
}
|
|
4086
|
-
if (typeof value === "function") {
|
|
4087
|
-
try {
|
|
4088
|
-
var result = value.call(source);
|
|
4089
|
-
if (typeof result === "string" && result) {
|
|
4090
|
-
return result;
|
|
4357
|
+
var matchingCues = Array.from(this.pendingScte35Cues.entries()).filter(function(param) {
|
|
4358
|
+
var _param = _sliced_to_array(param, 2), cue = _param[1];
|
|
4359
|
+
return cue.fragmentSn === fragmentSn;
|
|
4360
|
+
});
|
|
4361
|
+
matchingCues.forEach(function(param) {
|
|
4362
|
+
var _param = _sliced_to_array(param, 2), pendingKey = _param[0], cue = _param[1];
|
|
4363
|
+
var _cue_fragmentStartSeconds;
|
|
4364
|
+
_this.pendingScte35Cues.delete(pendingKey);
|
|
4365
|
+
var context = {
|
|
4366
|
+
source: cue.source,
|
|
4367
|
+
readiness: "playback"
|
|
4368
|
+
};
|
|
4369
|
+
context.fragmentSn = fragmentSn;
|
|
4370
|
+
var fragmentStartSec = (_cue_fragmentStartSeconds = cue.fragmentStartSeconds) !== null && _cue_fragmentStartSeconds !== void 0 ? _cue_fragmentStartSeconds : getFragmentStartSeconds(frag);
|
|
4371
|
+
if (fragmentStartSec !== void 0) {
|
|
4372
|
+
context.fragmentStartSeconds = fragmentStartSec;
|
|
4091
4373
|
}
|
|
4092
|
-
|
|
4374
|
+
_this.onScte35Cue(cue.marker, context);
|
|
4375
|
+
});
|
|
4093
4376
|
}
|
|
4094
|
-
}
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4377
|
+
},
|
|
4378
|
+
{
|
|
4379
|
+
key: "createScte35Cue",
|
|
4380
|
+
value: function createScte35Cue(marker, context) {
|
|
4381
|
+
var cue = {
|
|
4382
|
+
marker: marker,
|
|
4383
|
+
source: context.source,
|
|
4384
|
+
readiness: context.readiness,
|
|
4385
|
+
key: this.getScte35CueKey(marker, context)
|
|
4386
|
+
};
|
|
4387
|
+
if (context.fragmentSn !== void 0) {
|
|
4388
|
+
cue.fragmentSn = context.fragmentSn;
|
|
4389
|
+
}
|
|
4390
|
+
if (context.fragmentStartSeconds !== void 0) {
|
|
4391
|
+
cue.fragmentStartSeconds = context.fragmentStartSeconds;
|
|
4392
|
+
}
|
|
4393
|
+
return cue;
|
|
4102
4394
|
}
|
|
4103
|
-
}
|
|
4104
|
-
|
|
4105
|
-
|
|
4395
|
+
},
|
|
4396
|
+
{
|
|
4397
|
+
key: "getScte35CueKey",
|
|
4398
|
+
value: function getScte35CueKey(marker, context) {
|
|
4399
|
+
var _raw_attrs, _raw_attrs1, _raw_attrs2;
|
|
4400
|
+
var raw = this.getScte35MarkerRaw(marker);
|
|
4401
|
+
var spliceEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.splice_event_id);
|
|
4402
|
+
if (spliceEventId) {
|
|
4403
|
+
return "splice:".concat(spliceEventId);
|
|
4404
|
+
}
|
|
4405
|
+
var segmentationEventId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : raw.segmentation_event_id);
|
|
4406
|
+
if (segmentationEventId) {
|
|
4407
|
+
return "segmentation:".concat(segmentationEventId);
|
|
4408
|
+
}
|
|
4409
|
+
var daterangeId = this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs = raw.attrs) === null || _raw_attrs === void 0 ? void 0 : _raw_attrs.ID);
|
|
4410
|
+
if (daterangeId) {
|
|
4411
|
+
return "daterange:".concat(daterangeId);
|
|
4412
|
+
}
|
|
4413
|
+
var scteValue = this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs1 = raw.attrs) === null || _raw_attrs1 === void 0 ? void 0 : _raw_attrs1["SCTE35-OUT"]) || this.toIdentityString(raw === null || raw === void 0 ? void 0 : (_raw_attrs2 = raw.attrs) === null || _raw_attrs2 === void 0 ? void 0 : _raw_attrs2["SCTE35-IN"]);
|
|
4414
|
+
if (scteValue) {
|
|
4415
|
+
return "daterange-scte:".concat(scteValue);
|
|
4416
|
+
}
|
|
4417
|
+
if (typeof marker.ptsSeconds === "number" && Number.isFinite(marker.ptsSeconds)) {
|
|
4418
|
+
return "pts:".concat(Math.round(marker.ptsSeconds * 2) / 2);
|
|
4419
|
+
}
|
|
4420
|
+
if (context.fragmentSn !== void 0) {
|
|
4421
|
+
return "fragment:".concat(context.fragmentSn);
|
|
4422
|
+
}
|
|
4423
|
+
return "".concat(context.source, ":wallclock:").concat(Math.floor(Date.now() / 1e3));
|
|
4106
4424
|
}
|
|
4107
|
-
}
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4113
|
-
try {
|
|
4114
|
-
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4115
|
-
var key = _step.value;
|
|
4116
|
-
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
4117
|
-
var normalized = normalizeBoolean(value);
|
|
4118
|
-
if (normalized != null) {
|
|
4119
|
-
return normalized;
|
|
4425
|
+
},
|
|
4426
|
+
{
|
|
4427
|
+
key: "getPendingScte35CueKey",
|
|
4428
|
+
value: function getPendingScte35CueKey(cue) {
|
|
4429
|
+
return "".concat(cue.marker.type, ":").concat(cue.key, ":").concat(cue.fragmentSn !== void 0 ? cue.fragmentSn : "unknown");
|
|
4120
4430
|
}
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
}
|
|
4127
|
-
} catch (unused) {}
|
|
4431
|
+
},
|
|
4432
|
+
{
|
|
4433
|
+
key: "getScte35MarkerRaw",
|
|
4434
|
+
value: function getScte35MarkerRaw(marker) {
|
|
4435
|
+
return _type_of(marker.raw) === "object" && marker.raw !== null ? marker.raw : {};
|
|
4128
4436
|
}
|
|
4129
|
-
}
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4437
|
+
},
|
|
4438
|
+
{
|
|
4439
|
+
key: "toIdentityString",
|
|
4440
|
+
value: function toIdentityString(value) {
|
|
4441
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
4442
|
+
return String(value);
|
|
4443
|
+
}
|
|
4444
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
4445
|
+
return value.trim();
|
|
4446
|
+
}
|
|
4447
|
+
return void 0;
|
|
4137
4448
|
}
|
|
4138
|
-
}
|
|
4139
|
-
|
|
4140
|
-
|
|
4449
|
+
},
|
|
4450
|
+
{
|
|
4451
|
+
key: "isStrongScte35CueKey",
|
|
4452
|
+
value: function isStrongScte35CueKey(key) {
|
|
4453
|
+
return !!(key && (key.startsWith("splice:") || key.startsWith("segmentation:") || key.startsWith("daterange:") || key.startsWith("daterange-scte:")));
|
|
4141
4454
|
}
|
|
4142
|
-
}
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
var value = readStoredString(key);
|
|
4152
|
-
if (value) {
|
|
4153
|
-
return value;
|
|
4455
|
+
},
|
|
4456
|
+
{
|
|
4457
|
+
key: "hasRecentlyHandledScte35Cue",
|
|
4458
|
+
value: function hasRecentlyHandledScte35Cue(cue) {
|
|
4459
|
+
if (this.activeScte35BreakKeyValue === cue.key || this.scheduledScte35BreakKeyValue === cue.key) {
|
|
4460
|
+
return true;
|
|
4461
|
+
}
|
|
4462
|
+
var recentKey = "".concat(cue.marker.type, ":").concat(cue.key);
|
|
4463
|
+
return this.recentScte35CueKeys.has(recentKey);
|
|
4154
4464
|
}
|
|
4155
|
-
}
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
4162
|
-
_iterator.return();
|
|
4465
|
+
},
|
|
4466
|
+
{
|
|
4467
|
+
key: "markScte35CueHandled",
|
|
4468
|
+
value: function markScte35CueHandled(cue) {
|
|
4469
|
+
this.recentScte35CueKeys.set("".concat(cue.marker.type, ":").concat(cue.key), Date.now());
|
|
4470
|
+
this.trimRecentScte35CueMaps();
|
|
4163
4471
|
}
|
|
4164
|
-
}
|
|
4165
|
-
|
|
4166
|
-
|
|
4472
|
+
},
|
|
4473
|
+
{
|
|
4474
|
+
key: "trimRecentScte35CueMaps",
|
|
4475
|
+
value: function trimRecentScte35CueMaps() {
|
|
4476
|
+
while(this.recentScte35CueKeys.size > this.recentScte35CueLimit){
|
|
4477
|
+
var firstKey = this.recentScte35CueKeys.keys().next().value;
|
|
4478
|
+
if (!firstKey) {
|
|
4479
|
+
break;
|
|
4480
|
+
}
|
|
4481
|
+
this.recentScte35CueKeys.delete(firstKey);
|
|
4482
|
+
}
|
|
4483
|
+
while(this.pendingScte35Cues.size > this.recentScte35CueLimit){
|
|
4484
|
+
var firstKey1 = this.pendingScte35Cues.keys().next().value;
|
|
4485
|
+
if (!firstKey1) {
|
|
4486
|
+
break;
|
|
4487
|
+
}
|
|
4488
|
+
this.pendingScte35Cues.delete(firstKey1);
|
|
4489
|
+
}
|
|
4490
|
+
}
|
|
4491
|
+
},
|
|
4492
|
+
{
|
|
4493
|
+
key: "shouldAcceptScte35EndCue",
|
|
4494
|
+
value: function shouldAcceptScte35EndCue(cue) {
|
|
4495
|
+
if (!this.callbacks.isInAdBreak()) {
|
|
4496
|
+
return false;
|
|
4497
|
+
}
|
|
4498
|
+
if (this.isStrongScte35CueKey(this.activeScte35BreakKeyValue) && this.isStrongScte35CueKey(cue.key) && this.activeScte35BreakKeyValue !== cue.key) {
|
|
4499
|
+
return false;
|
|
4500
|
+
}
|
|
4501
|
+
return true;
|
|
4167
4502
|
}
|
|
4168
4503
|
}
|
|
4169
|
-
|
|
4170
|
-
return
|
|
4171
|
-
}
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
try {
|
|
4177
|
-
var _window_localStorage;
|
|
4178
|
-
var value = (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key);
|
|
4179
|
-
return value || void 0;
|
|
4180
|
-
} catch (unused) {
|
|
4181
|
-
return void 0;
|
|
4182
|
-
}
|
|
4183
|
-
}
|
|
4184
|
-
function readStoredLimitAdTracking() {
|
|
4185
|
-
return normalizeBoolean(readStoredString("limitAdTracking") || readStoredString("limitedAdTracking") || readStoredString("is_lat"));
|
|
4186
|
-
}
|
|
4187
|
-
function normalizeBoolean(value) {
|
|
4188
|
-
if (typeof value === "boolean") {
|
|
4189
|
-
return value;
|
|
4190
|
-
}
|
|
4191
|
-
if (typeof value === "number") {
|
|
4192
|
-
return value === 1;
|
|
4193
|
-
}
|
|
4194
|
-
if (typeof value === "string") {
|
|
4195
|
-
var normalized = value.toLowerCase();
|
|
4196
|
-
if (normalized === "1" || normalized === "true" || normalized === "yes") {
|
|
4197
|
-
return true;
|
|
4198
|
-
}
|
|
4199
|
-
if (normalized === "0" || normalized === "false" || normalized === "no") {
|
|
4200
|
-
return false;
|
|
4201
|
-
}
|
|
4202
|
-
}
|
|
4203
|
-
return void 0;
|
|
4204
|
-
}
|
|
4205
|
-
function inferDeviceIdType() {
|
|
4206
|
-
if (typeof navigator === "undefined") {
|
|
4207
|
-
return void 0;
|
|
4208
|
-
}
|
|
4209
|
-
var ua = navigator.userAgent;
|
|
4210
|
-
if (/Roku/i.test(ua)) return "rida";
|
|
4211
|
-
if (/Tizen|Samsung/i.test(ua)) return "tifa";
|
|
4212
|
-
if (/AppleTV/i.test(ua)) return "tvOS";
|
|
4213
|
-
if (/AFT|Fire TV|Amazon/i.test(ua)) return "afai";
|
|
4214
|
-
if (/Web0S|webOS|LG/i.test(ua)) return "lgudid";
|
|
4215
|
-
if (/Android|Google TV/i.test(ua)) return "aaid";
|
|
4216
|
-
return void 0;
|
|
4217
|
-
}
|
|
4218
|
-
// src/player/VmapManager.ts
|
|
4219
|
-
var VmapManager = /*#__PURE__*/ function() {
|
|
4220
|
-
function VmapManager(config, video) {
|
|
4221
|
-
_class_call_check(this, VmapManager);
|
|
4504
|
+
]);
|
|
4505
|
+
return Scte35CueManager;
|
|
4506
|
+
}();
|
|
4507
|
+
// src/player/AdConfigManager.ts
|
|
4508
|
+
var AdConfigManager = /*#__PURE__*/ function() {
|
|
4509
|
+
function AdConfigManager(config, video) {
|
|
4510
|
+
_class_call_check(this, AdConfigManager);
|
|
4222
4511
|
this.vmapBreaks = [];
|
|
4223
4512
|
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
4224
4513
|
this.streamCorrelator = generateCorrelator();
|
|
@@ -4230,7 +4519,7 @@ var VmapManager = /*#__PURE__*/ function() {
|
|
|
4230
4519
|
this.config = config;
|
|
4231
4520
|
this.video = video;
|
|
4232
4521
|
}
|
|
4233
|
-
_create_class(
|
|
4522
|
+
_create_class(AdConfigManager, [
|
|
4234
4523
|
{
|
|
4235
4524
|
key: "debug",
|
|
4236
4525
|
get: function get() {
|
|
@@ -4292,7 +4581,7 @@ var VmapManager = /*#__PURE__*/ function() {
|
|
|
4292
4581
|
];
|
|
4293
4582
|
}
|
|
4294
4583
|
if (this.config.vastTagUrl) {
|
|
4295
|
-
this.apiVastTagUrl = this.config.vastTagUrl;
|
|
4584
|
+
this.apiVastTagUrl = normalizeVastTagUrl(this.config.vastTagUrl);
|
|
4296
4585
|
if (this.debug) {
|
|
4297
4586
|
console.log("[StormcloudVideoPlayer] Using custom VAST tag URL:", this.apiVastTagUrl);
|
|
4298
4587
|
}
|
|
@@ -4332,7 +4621,7 @@ var VmapManager = /*#__PURE__*/ function() {
|
|
|
4332
4621
|
data = _state.sent();
|
|
4333
4622
|
imaPayload = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : (_data_response_ima = _data_response.ima) === null || _data_response_ima === void 0 ? void 0 : (_data_response_ima_publisherdeskima = _data_response_ima["publisherdesk.ima"]) === null || _data_response_ima_publisherdeskima === void 0 ? void 0 : _data_response_ima_publisherdeskima.payload;
|
|
4334
4623
|
if (imaPayload) {
|
|
4335
|
-
this.apiVastTagUrl =
|
|
4624
|
+
this.apiVastTagUrl = normalizeVastTagUrl(imaPayload);
|
|
4336
4625
|
if (this.debug) {
|
|
4337
4626
|
console.log("[StormcloudVideoPlayer] Extracted VAST tag URL from /ads/web:", this.apiVastTagUrl);
|
|
4338
4627
|
}
|
|
@@ -4647,24 +4936,24 @@ var VmapManager = /*#__PURE__*/ function() {
|
|
|
4647
4936
|
for(var i = 0; i < count; i++){
|
|
4648
4937
|
this.adRequestPositionInBreak++;
|
|
4649
4938
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
4650
|
-
var
|
|
4939
|
+
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
4651
4940
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
4652
4941
|
correlator: generateCorrelator(),
|
|
4653
4942
|
streamCorrelator: this.streamCorrelator,
|
|
4654
4943
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
4655
4944
|
adPosition: this.adRequestPositionInBreak,
|
|
4656
|
-
isCtv:
|
|
4657
|
-
contentUrl:
|
|
4658
|
-
pageUrl: !
|
|
4945
|
+
isCtv: envSignals.isCtv,
|
|
4946
|
+
contentUrl: envSignals.contentUrl,
|
|
4947
|
+
pageUrl: !envSignals.isCtv && typeof window !== "undefined" ? window.location.href : void 0,
|
|
4659
4948
|
adWillPlayMuted: adWillPlayMuted,
|
|
4660
4949
|
adWillAutoPlay: !!this.config.autoplay,
|
|
4661
|
-
appId:
|
|
4662
|
-
appName:
|
|
4663
|
-
sessionId:
|
|
4664
|
-
deviceId:
|
|
4665
|
-
deviceIdType:
|
|
4666
|
-
limitAdTracking:
|
|
4667
|
-
deviceTypeHint:
|
|
4950
|
+
appId: envSignals.appId,
|
|
4951
|
+
appName: envSignals.appName,
|
|
4952
|
+
sessionId: envSignals.sessionId,
|
|
4953
|
+
deviceId: envSignals.deviceId,
|
|
4954
|
+
deviceIdType: envSignals.deviceIdType,
|
|
4955
|
+
limitAdTracking: envSignals.limitAdTracking,
|
|
4956
|
+
deviceTypeHint: envSignals.deviceTypeHint,
|
|
4668
4957
|
adTest: this.config.adTest,
|
|
4669
4958
|
consent: this.consentSignals
|
|
4670
4959
|
});
|
|
@@ -4717,7 +5006,7 @@ var VmapManager = /*#__PURE__*/ function() {
|
|
|
4717
5006
|
}
|
|
4718
5007
|
}
|
|
4719
5008
|
]);
|
|
4720
|
-
return
|
|
5009
|
+
return AdConfigManager;
|
|
4721
5010
|
}();
|
|
4722
5011
|
// src/player/AdTimingService.ts
|
|
4723
5012
|
var AdTimingService = /*#__PURE__*/ function() {
|
|
@@ -6444,7 +6733,7 @@ function resizePlayer(video, adPlayer, debug) {
|
|
|
6444
6733
|
}
|
|
6445
6734
|
// src/player/AdBreakOrchestrator.ts
|
|
6446
6735
|
var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
6447
|
-
function AdBreakOrchestrator(host, timing, preloadPool,
|
|
6736
|
+
function AdBreakOrchestrator(host, timing, preloadPool, adConfig, cueManager, placeholder) {
|
|
6448
6737
|
_class_call_check(this, AdBreakOrchestrator);
|
|
6449
6738
|
this.inAdBreak = false;
|
|
6450
6739
|
this.showAds = false;
|
|
@@ -6459,7 +6748,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
6459
6748
|
this.host = host;
|
|
6460
6749
|
this.timing = timing;
|
|
6461
6750
|
this.preloadPool = preloadPool;
|
|
6462
|
-
this.
|
|
6751
|
+
this.adConfig = adConfig;
|
|
6463
6752
|
this.cueManager = cueManager;
|
|
6464
6753
|
this.placeholder = placeholder;
|
|
6465
6754
|
}
|
|
@@ -6625,7 +6914,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
6625
6914
|
}
|
|
6626
6915
|
this.pendingAdBreak = null;
|
|
6627
6916
|
this.cueManager.pendingScte35CueKey = void 0;
|
|
6628
|
-
this.
|
|
6917
|
+
this.adConfig.podAssignedByPrefetch = false;
|
|
6629
6918
|
}
|
|
6630
6919
|
},
|
|
6631
6920
|
{
|
|
@@ -6639,15 +6928,15 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
6639
6928
|
return _ts_generator(this, function(_state) {
|
|
6640
6929
|
switch(_state.label){
|
|
6641
6930
|
case 0:
|
|
6642
|
-
scheduled = this.
|
|
6931
|
+
scheduled = this.adConfig.findCurrentOrNextBreak(this.host.video.currentTime * 1e3);
|
|
6643
6932
|
if (scheduled) {
|
|
6644
|
-
this.
|
|
6933
|
+
this.adConfig.consumedVmapBreakIds.add(this.adConfig.getAdBreakKey(scheduled));
|
|
6645
6934
|
}
|
|
6646
|
-
tags = this.
|
|
6935
|
+
tags = this.adConfig.selectVastTagsForBreak(scheduled);
|
|
6647
6936
|
if (tags && tags.length > 0 && tags[0]) {
|
|
6648
6937
|
baseVastUrl = tags[0];
|
|
6649
|
-
} else if (this.
|
|
6650
|
-
baseVastUrl = this.
|
|
6938
|
+
} else if (this.adConfig.apiVastTagUrl) {
|
|
6939
|
+
baseVastUrl = this.adConfig.apiVastTagUrl;
|
|
6651
6940
|
} else {
|
|
6652
6941
|
this.clearPendingAdBreak();
|
|
6653
6942
|
return [
|
|
@@ -6665,10 +6954,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
6665
6954
|
this.continuousFetchingActive = true;
|
|
6666
6955
|
this.isShowingPlaceholder = false;
|
|
6667
6956
|
this.timing.totalAdRequestsInBreak = 0;
|
|
6668
|
-
if (this.
|
|
6669
|
-
this.
|
|
6957
|
+
if (this.adConfig.podAssignedByPrefetch) {
|
|
6958
|
+
this.adConfig.podAssignedByPrefetch = false;
|
|
6670
6959
|
} else {
|
|
6671
|
-
this.
|
|
6960
|
+
this.adConfig.beginNewAdPod();
|
|
6672
6961
|
}
|
|
6673
6962
|
currentMuted = this.host.video.muted;
|
|
6674
6963
|
currentVolume = this.host.video.volume;
|
|
@@ -7940,7 +8229,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
7940
8229
|
return _this.adBreak.inAdBreak;
|
|
7941
8230
|
}
|
|
7942
8231
|
});
|
|
7943
|
-
this.
|
|
8232
|
+
this.adConfig = new AdConfigManager(this.config, this.video);
|
|
7944
8233
|
this.timing = new AdTimingService(this.config, this.video, {
|
|
7945
8234
|
onAdStopTimerFired: function onAdStopTimerFired() {
|
|
7946
8235
|
return _this.onAdStopTimerFired();
|
|
@@ -8020,7 +8309,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8020
8309
|
generateVastUrls: function generateVastUrls(base, count) {
|
|
8021
8310
|
return _this.generateVastUrls(base, count);
|
|
8022
8311
|
}
|
|
8023
|
-
}, this.timing, this.preloadPool, this.
|
|
8312
|
+
}, this.timing, this.preloadPool, this.adConfig, this.cueManager, this.placeholder);
|
|
8024
8313
|
}
|
|
8025
8314
|
_create_class(StormcloudVideoPlayer, [
|
|
8026
8315
|
{
|
|
@@ -8048,7 +8337,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8048
8337
|
{
|
|
8049
8338
|
key: "generateVastUrls",
|
|
8050
8339
|
value: function generateVastUrls(baseUrl, count) {
|
|
8051
|
-
return this.
|
|
8340
|
+
return this.adConfig.generateVastUrlsWithCorrelators(baseUrl, count, this.adPlayer, this.palNonce, this.adBreak.inAdBreak);
|
|
8052
8341
|
}
|
|
8053
8342
|
},
|
|
8054
8343
|
{
|
|
@@ -8076,7 +8365,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8076
8365
|
]);
|
|
8077
8366
|
return [
|
|
8078
8367
|
4,
|
|
8079
|
-
this.
|
|
8368
|
+
this.adConfig.fetchAdConfiguration()
|
|
8080
8369
|
];
|
|
8081
8370
|
case 2:
|
|
8082
8371
|
_state.sent();
|
|
@@ -8103,9 +8392,9 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8103
8392
|
continuousPlayback: (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false
|
|
8104
8393
|
}).catch(function() {});
|
|
8105
8394
|
fetchConsentSignals().then(function(signals) {
|
|
8106
|
-
_this.
|
|
8395
|
+
_this.adConfig.consentSignals = signals;
|
|
8107
8396
|
}).catch(function() {});
|
|
8108
|
-
this.
|
|
8397
|
+
this.adConfig.initializeTracking();
|
|
8109
8398
|
if (!this.hlsEngine.shouldUseNativeHls(function() {
|
|
8110
8399
|
return _this.getStreamType();
|
|
8111
8400
|
})) return [
|
|
@@ -8140,14 +8429,14 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8140
8429
|
return _async_to_generator(function() {
|
|
8141
8430
|
var prerollKey, adBehavior;
|
|
8142
8431
|
return _ts_generator(this, function(_state) {
|
|
8143
|
-
if (!this.
|
|
8432
|
+
if (!this.adConfig.isVmapEnabled() && !isLive && this.adConfig.vmapBreaks.length === 0 && this.adConfig.apiVastTagUrl) {
|
|
8144
8433
|
prerollKey = "synthetic-vod-preroll";
|
|
8145
|
-
if (!this.
|
|
8146
|
-
this.
|
|
8434
|
+
if (!this.adConfig.consumedVmapBreakIds.has(prerollKey)) {
|
|
8435
|
+
this.adConfig.vmapBreaks = [
|
|
8147
8436
|
{
|
|
8148
8437
|
id: prerollKey,
|
|
8149
8438
|
startTimeMs: 0,
|
|
8150
|
-
vastTagUrl: this.
|
|
8439
|
+
vastTagUrl: this.adConfig.apiVastTagUrl
|
|
8151
8440
|
}
|
|
8152
8441
|
];
|
|
8153
8442
|
if (this.debug) {
|
|
@@ -8414,19 +8703,19 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8414
8703
|
key: "startAdPrefetch",
|
|
8415
8704
|
value: function startAdPrefetch(marker, fragmentSn, cueKey) {
|
|
8416
8705
|
if (this.adBreak.pendingAdBreak || this.adBreak.inAdBreak) return;
|
|
8417
|
-
var scheduled = this.
|
|
8418
|
-
var tags = this.
|
|
8706
|
+
var scheduled = this.adConfig.findCurrentOrNextBreak(this.video.currentTime * 1e3);
|
|
8707
|
+
var tags = this.adConfig.selectVastTagsForBreak(scheduled);
|
|
8419
8708
|
var baseVastUrl;
|
|
8420
8709
|
if (tags && tags.length > 0 && tags[0]) {
|
|
8421
8710
|
baseVastUrl = tags[0];
|
|
8422
|
-
} else if (this.
|
|
8423
|
-
baseVastUrl = this.
|
|
8711
|
+
} else if (this.adConfig.apiVastTagUrl) {
|
|
8712
|
+
baseVastUrl = this.adConfig.apiVastTagUrl;
|
|
8424
8713
|
} else {
|
|
8425
8714
|
if (this.debug) console.warn("[StormcloudVideoPlayer] No VAST URL available for prefetch");
|
|
8426
8715
|
return;
|
|
8427
8716
|
}
|
|
8428
|
-
this.
|
|
8429
|
-
this.
|
|
8717
|
+
this.adConfig.beginNewAdPod();
|
|
8718
|
+
this.adConfig.podAssignedByPrefetch = true;
|
|
8430
8719
|
var generatedUrls = this.generateVastUrls(baseVastUrl, 1);
|
|
8431
8720
|
this.adBreak.pendingAdBreak = _object_spread_props(_object_spread({
|
|
8432
8721
|
marker: marker
|
|
@@ -8461,10 +8750,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8461
8750
|
key: "onTimeUpdate",
|
|
8462
8751
|
value: function onTimeUpdate(currentTimeSec) {
|
|
8463
8752
|
var _this = this;
|
|
8464
|
-
if (!this.
|
|
8753
|
+
if (!this.adConfig.isVmapEnabled() || this.adConfig.vmapBreaks.length === 0) return;
|
|
8465
8754
|
if (this.adPlayer.isAdPlaying() || this.adBreak.inAdBreak) return;
|
|
8466
8755
|
var nowMs = currentTimeSec * 1e3;
|
|
8467
|
-
var breakToPlay = this.
|
|
8756
|
+
var breakToPlay = this.adConfig.findBreakForTime(nowMs);
|
|
8468
8757
|
if (breakToPlay) {
|
|
8469
8758
|
void this.handleVmapAdBreak(breakToPlay, nowMs).catch(function(error) {
|
|
8470
8759
|
if (_this.debug) {
|
|
@@ -8478,11 +8767,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8478
8767
|
key: "onVideoEnded",
|
|
8479
8768
|
value: function onVideoEnded() {
|
|
8480
8769
|
var _this = this;
|
|
8481
|
-
if (!this.
|
|
8770
|
+
if (!this.adConfig.isVmapEnabled() || this.adConfig.vmapBreaks.length === 0) return;
|
|
8482
8771
|
if (this.adPlayer.isAdPlaying() || this.adBreak.inAdBreak) return;
|
|
8483
8772
|
var durationMs = Number.isFinite(this.video.duration) ? Math.floor(this.video.duration * 1e3) : 0;
|
|
8484
|
-
var postroll = this.
|
|
8485
|
-
return b.startTimeMs === -1 && !_this.
|
|
8773
|
+
var postroll = this.adConfig.vmapBreaks.find(function(b) {
|
|
8774
|
+
return b.startTimeMs === -1 && !_this.adConfig.consumedVmapBreakIds.has(_this.adConfig.getAdBreakKey(b));
|
|
8486
8775
|
});
|
|
8487
8776
|
if (postroll) {
|
|
8488
8777
|
void this.handleVmapAdBreak(postroll, durationMs).catch(function(error) {
|
|
@@ -8501,11 +8790,11 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8501
8790
|
return _ts_generator(this, function(_state) {
|
|
8502
8791
|
switch(_state.label){
|
|
8503
8792
|
case 0:
|
|
8504
|
-
key = this.
|
|
8505
|
-
if (this.
|
|
8793
|
+
key = this.adConfig.getAdBreakKey(adBreak);
|
|
8794
|
+
if (this.adConfig.consumedVmapBreakIds.has(key)) return [
|
|
8506
8795
|
2
|
|
8507
8796
|
];
|
|
8508
|
-
breakStartMs = this.
|
|
8797
|
+
breakStartMs = this.adConfig.resolveBreakStartMs(adBreak);
|
|
8509
8798
|
if (breakStartMs == null) return [
|
|
8510
8799
|
2
|
|
8511
8800
|
];
|
|
@@ -8516,8 +8805,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8516
8805
|
3,
|
|
8517
8806
|
4
|
|
8518
8807
|
];
|
|
8519
|
-
this.
|
|
8520
|
-
tags = this.
|
|
8808
|
+
this.adConfig.consumedVmapBreakIds.add(key);
|
|
8809
|
+
tags = this.adConfig.selectVastTagsForBreak(adBreak);
|
|
8521
8810
|
if (!tags || tags.length === 0) return [
|
|
8522
8811
|
2
|
|
8523
8812
|
];
|
|
@@ -8709,7 +8998,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
8709
8998
|
this.video.removeEventListener("emptied", this.emptiedHandler);
|
|
8710
8999
|
delete this.emptiedHandler;
|
|
8711
9000
|
}
|
|
8712
|
-
this.
|
|
9001
|
+
this.adConfig.destroyTracking();
|
|
8713
9002
|
this.hlsEngine.destroy();
|
|
8714
9003
|
(_this_adPlayer = this.adPlayer) === null || _this_adPlayer === void 0 ? void 0 : _this_adPlayer.destroy();
|
|
8715
9004
|
if (this.palPlaybackStarted) {
|
|
@@ -9346,7 +9635,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
9346
9635
|
})
|
|
9347
9636
|
]
|
|
9348
9637
|
}),
|
|
9349
|
-
adStatus.showAds && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
9638
|
+
adStatus.showAds && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
9350
9639
|
style: {
|
|
9351
9640
|
position: "absolute",
|
|
9352
9641
|
top: "".concat(12 * responsiveScale, "px"),
|
|
@@ -9358,35 +9647,20 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
9358
9647
|
pointerEvents: "none",
|
|
9359
9648
|
animation: "sc-fade-in 0.3s ease"
|
|
9360
9649
|
},
|
|
9361
|
-
children:
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
}),
|
|
9376
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
9377
|
-
style: {
|
|
9378
|
-
background: "rgba(0, 0, 0, 0.58)",
|
|
9379
|
-
color: "rgba(255, 255, 255, 0.92)",
|
|
9380
|
-
padding: "".concat(4 * responsiveScale, "px ").concat(10 * responsiveScale, "px"),
|
|
9381
|
-
borderRadius: "6px",
|
|
9382
|
-
fontSize: "".concat(11 * responsiveScale, "px"),
|
|
9383
|
-
fontWeight: 600,
|
|
9384
|
-
border: "1px solid rgba(255, 255, 255, 0.1)",
|
|
9385
|
-
boxShadow: "0 2px 10px rgba(0, 0, 0, 0.25)"
|
|
9386
|
-
},
|
|
9387
|
-
children: "".concat(Math.max(1, adStatus.currentIndex), " of ").concat(Math.max(Math.max(1, adStatus.currentIndex), adStatus.totalAds))
|
|
9388
|
-
})
|
|
9389
|
-
]
|
|
9650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
9651
|
+
style: {
|
|
9652
|
+
background: "rgba(234, 179, 8, 0.95)",
|
|
9653
|
+
color: "#111",
|
|
9654
|
+
padding: "".concat(4 * responsiveScale, "px ").concat(12 * responsiveScale, "px"),
|
|
9655
|
+
borderRadius: "6px",
|
|
9656
|
+
fontSize: "".concat(11 * responsiveScale, "px"),
|
|
9657
|
+
fontWeight: 700,
|
|
9658
|
+
letterSpacing: "0.08em",
|
|
9659
|
+
textTransform: "uppercase",
|
|
9660
|
+
boxShadow: "0 2px 12px rgba(234, 179, 8, 0.35)"
|
|
9661
|
+
},
|
|
9662
|
+
children: "Ad ".concat(Math.max(1, adStatus.currentIndex))
|
|
9663
|
+
})
|
|
9390
9664
|
}),
|
|
9391
9665
|
showCenterPlay && !isLoading && !isBuffering && !showLicenseWarning && !adStatus.showAds && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
9392
9666
|
onClick: handleCenterPlayClick,
|