stormcloud-video-player 0.8.13 → 0.8.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/stormcloud-vp.min.js +1 -1
- package/lib/index.cjs +364 -30
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2 -3
- package/lib/index.d.ts +2 -3
- package/lib/index.js +364 -30
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +356 -27
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +357 -27
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +357 -27
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/{types-BM5cceAy.d.cts → types-CWWADkvd.d.cts} +1 -3
- package/lib/ui/StormcloudVideoPlayer.cjs +362 -30
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/ctvVastSignals.cjs +381 -0
- package/lib/utils/ctvVastSignals.cjs.map +1 -0
- package/lib/utils/ctvVastSignals.d.cts +13 -0
- package/lib/utils/tracking.d.cts +1 -1
- package/lib/utils/vastMacros.cjs +79 -23
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +6 -0
- package/package.json +1 -1
|
@@ -24,9 +24,7 @@ interface StormcloudVideoPlayerConfig {
|
|
|
24
24
|
vmapUrl?: string;
|
|
25
25
|
vastMode?: 'adstorm' | 'default';
|
|
26
26
|
minSegmentsBeforePlay?: number;
|
|
27
|
-
|
|
28
|
-
deviceIdType?: string;
|
|
29
|
-
limitAdTracking?: boolean;
|
|
27
|
+
ctvAdRequest?: boolean;
|
|
30
28
|
adTest?: boolean;
|
|
31
29
|
}
|
|
32
30
|
interface AdController {
|
|
@@ -2326,6 +2326,20 @@ function generateCorrelator() {
|
|
|
2326
2326
|
return String(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER) + 1);
|
|
2327
2327
|
}
|
|
2328
2328
|
var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
|
|
2329
|
+
var CTV_UNSUPPORTED_PARAMS = [
|
|
2330
|
+
"description_url",
|
|
2331
|
+
"tfcd",
|
|
2332
|
+
"npa",
|
|
2333
|
+
"min_ad_duration",
|
|
2334
|
+
"max_ad_duration",
|
|
2335
|
+
"unviewed_position_start",
|
|
2336
|
+
"impl",
|
|
2337
|
+
"scor",
|
|
2338
|
+
"vad_type",
|
|
2339
|
+
"gdpr",
|
|
2340
|
+
"gdpr_consent",
|
|
2341
|
+
"us_privacy"
|
|
2342
|
+
];
|
|
2329
2343
|
function applyVastMacros(baseUrl, ctx) {
|
|
2330
2344
|
var url;
|
|
2331
2345
|
try {
|
|
@@ -2335,16 +2349,42 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2335
2349
|
}
|
|
2336
2350
|
var params = url.searchParams;
|
|
2337
2351
|
params.set("correlator", ctx.correlator);
|
|
2338
|
-
|
|
2352
|
+
if (ctx.isCtv) {
|
|
2353
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2354
|
+
try {
|
|
2355
|
+
for(var _iterator = CTV_UNSUPPORTED_PARAMS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2356
|
+
var key = _step.value;
|
|
2357
|
+
params.delete(key);
|
|
2358
|
+
}
|
|
2359
|
+
} catch (err) {
|
|
2360
|
+
_didIteratorError = true;
|
|
2361
|
+
_iteratorError = err;
|
|
2362
|
+
} finally{
|
|
2363
|
+
try {
|
|
2364
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2365
|
+
_iterator.return();
|
|
2366
|
+
}
|
|
2367
|
+
} finally{
|
|
2368
|
+
if (_didIteratorError) {
|
|
2369
|
+
throw _iteratorError;
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
} else {
|
|
2374
|
+
params.set("scor", ctx.streamCorrelator);
|
|
2375
|
+
}
|
|
2339
2376
|
if (ctx.pod != null) {
|
|
2340
2377
|
params.set("pod", String(ctx.pod));
|
|
2341
2378
|
}
|
|
2342
2379
|
if (ctx.adPosition != null) {
|
|
2343
2380
|
params.set("ppos", String(ctx.adPosition));
|
|
2344
2381
|
}
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
params.set("
|
|
2382
|
+
var requestUrl = ctx.contentUrl || ctx.pageUrl;
|
|
2383
|
+
if (requestUrl) {
|
|
2384
|
+
params.set("url", requestUrl);
|
|
2385
|
+
if (!ctx.isCtv) {
|
|
2386
|
+
params.set("description_url", requestUrl);
|
|
2387
|
+
}
|
|
2348
2388
|
}
|
|
2349
2389
|
if (ctx.adWillPlayMuted != null) {
|
|
2350
2390
|
params.set("vpmute", ctx.adWillPlayMuted ? "1" : "0");
|
|
@@ -2352,6 +2392,20 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2352
2392
|
if (ctx.adWillAutoPlay != null) {
|
|
2353
2393
|
params.set("vpa", ctx.adWillAutoPlay ? "auto" : "click");
|
|
2354
2394
|
}
|
|
2395
|
+
if (ctx.appId) {
|
|
2396
|
+
params.set("msid", ctx.appId);
|
|
2397
|
+
}
|
|
2398
|
+
if (ctx.appName) {
|
|
2399
|
+
params.set("an", ctx.appName);
|
|
2400
|
+
}
|
|
2401
|
+
if (ctx.sessionId) {
|
|
2402
|
+
params.set("sid", ctx.sessionId);
|
|
2403
|
+
}
|
|
2404
|
+
if (ctx.deviceTypeHint != null) {
|
|
2405
|
+
params.set("dth", String(ctx.deviceTypeHint));
|
|
2406
|
+
} else if (ctx.isCtv) {
|
|
2407
|
+
params.set("dth", "5");
|
|
2408
|
+
}
|
|
2355
2409
|
if (ctx.deviceId && ctx.deviceIdType) {
|
|
2356
2410
|
params.set("rdid", ctx.deviceId);
|
|
2357
2411
|
params.set("idtype", ctx.deviceIdType);
|
|
@@ -2361,15 +2415,17 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2361
2415
|
params.delete("idtype");
|
|
2362
2416
|
params.delete("is_lat");
|
|
2363
2417
|
}
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2418
|
+
if (!ctx.isCtv) {
|
|
2419
|
+
var consent = ctx.consent;
|
|
2420
|
+
if ((consent === null || consent === void 0 ? void 0 : consent.gdpr) != null) {
|
|
2421
|
+
params.set("gdpr", consent.gdpr);
|
|
2422
|
+
}
|
|
2423
|
+
if ((consent === null || consent === void 0 ? void 0 : consent.gdprConsent) != null) {
|
|
2424
|
+
params.set("gdpr_consent", consent.gdprConsent);
|
|
2425
|
+
}
|
|
2426
|
+
if ((consent === null || consent === void 0 ? void 0 : consent.usPrivacy) != null) {
|
|
2427
|
+
params.set("us_privacy", consent.usPrivacy);
|
|
2428
|
+
}
|
|
2373
2429
|
}
|
|
2374
2430
|
if (ctx.adTest) {
|
|
2375
2431
|
params.set("adtest", "on");
|
|
@@ -2380,23 +2436,23 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2380
2436
|
staleKeys.push(key);
|
|
2381
2437
|
}
|
|
2382
2438
|
});
|
|
2383
|
-
var
|
|
2439
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
2384
2440
|
try {
|
|
2385
|
-
for(var
|
|
2386
|
-
var
|
|
2387
|
-
params.delete(
|
|
2441
|
+
for(var _iterator1 = staleKeys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2442
|
+
var key1 = _step1.value;
|
|
2443
|
+
params.delete(key1);
|
|
2388
2444
|
}
|
|
2389
2445
|
} catch (err) {
|
|
2390
|
-
|
|
2391
|
-
|
|
2446
|
+
_didIteratorError1 = true;
|
|
2447
|
+
_iteratorError1 = err;
|
|
2392
2448
|
} finally{
|
|
2393
2449
|
try {
|
|
2394
|
-
if (!
|
|
2395
|
-
|
|
2450
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
2451
|
+
_iterator1.return();
|
|
2396
2452
|
}
|
|
2397
2453
|
} finally{
|
|
2398
|
-
if (
|
|
2399
|
-
throw
|
|
2454
|
+
if (_didIteratorError1) {
|
|
2455
|
+
throw _iteratorError1;
|
|
2400
2456
|
}
|
|
2401
2457
|
}
|
|
2402
2458
|
}
|
|
@@ -2636,6 +2692,272 @@ function logBrowserInfo() {
|
|
|
2636
2692
|
userAgent: navigator.userAgent
|
|
2637
2693
|
}));
|
|
2638
2694
|
}
|
|
2695
|
+
// src/utils/ctvVastSignals.ts
|
|
2696
|
+
var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
|
|
2697
|
+
var AIRY_APP_NAME = "AiryTV Movies & TV";
|
|
2698
|
+
var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
|
|
2699
|
+
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
2700
|
+
var DEVICE_ID_STORAGE_KEYS = [
|
|
2701
|
+
"rdid",
|
|
2702
|
+
"ifa",
|
|
2703
|
+
"advertisingId",
|
|
2704
|
+
"advertising_id",
|
|
2705
|
+
"deviceAdvertisingId",
|
|
2706
|
+
"aaid",
|
|
2707
|
+
"adid",
|
|
2708
|
+
"rida",
|
|
2709
|
+
"tifa"
|
|
2710
|
+
];
|
|
2711
|
+
function resolveCtvVastSignals() {
|
|
2712
|
+
var _ref, _bridgeSignals_limitAdTracking;
|
|
2713
|
+
var bridgeSignals = readNativeBridgeSignals();
|
|
2714
|
+
var deviceId = bridgeSignals.deviceId || readStoredDeviceId();
|
|
2715
|
+
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || inferDeviceIdType();
|
|
2716
|
+
var contentUrl = bridgeSignals.contentUrl || readStoredString("contentUrl") || AIRY_DEFAULT_CONTENT_URL;
|
|
2717
|
+
return _object_spread_props(_object_spread({
|
|
2718
|
+
contentUrl: contentUrl,
|
|
2719
|
+
appId: AIRY_ANDROID_APP_ID,
|
|
2720
|
+
appName: AIRY_APP_NAME,
|
|
2721
|
+
sessionId: getOrCreateCtvSessionId()
|
|
2722
|
+
}, deviceId ? {
|
|
2723
|
+
deviceId: deviceId
|
|
2724
|
+
} : {}, deviceId && deviceIdType ? {
|
|
2725
|
+
deviceIdType: deviceIdType
|
|
2726
|
+
} : {}, deviceId ? {
|
|
2727
|
+
limitAdTracking: (_ref = (_bridgeSignals_limitAdTracking = bridgeSignals.limitAdTracking) !== null && _bridgeSignals_limitAdTracking !== void 0 ? _bridgeSignals_limitAdTracking : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false
|
|
2728
|
+
} : {}), {
|
|
2729
|
+
deviceTypeHint: 5
|
|
2730
|
+
});
|
|
2731
|
+
}
|
|
2732
|
+
function getOrCreateCtvSessionId() {
|
|
2733
|
+
var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
|
|
2734
|
+
if (existing) {
|
|
2735
|
+
return existing;
|
|
2736
|
+
}
|
|
2737
|
+
var sessionId = createUuid();
|
|
2738
|
+
try {
|
|
2739
|
+
var _window_localStorage;
|
|
2740
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
2741
|
+
} catch (unused) {}
|
|
2742
|
+
return sessionId;
|
|
2743
|
+
}
|
|
2744
|
+
function createUuid() {
|
|
2745
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
2746
|
+
return crypto.randomUUID();
|
|
2747
|
+
}
|
|
2748
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
|
|
2749
|
+
var value = Math.floor(Math.random() * 16);
|
|
2750
|
+
var nibble = char === "x" ? value : value & 3 | 8;
|
|
2751
|
+
return nibble.toString(16);
|
|
2752
|
+
});
|
|
2753
|
+
}
|
|
2754
|
+
function readNativeBridgeSignals() {
|
|
2755
|
+
if (typeof window === "undefined") {
|
|
2756
|
+
return {};
|
|
2757
|
+
}
|
|
2758
|
+
var candidates = [
|
|
2759
|
+
window.__STORMCLOUD_CTV_AD_INFO__,
|
|
2760
|
+
window.__STORMCLOUD_CTV__,
|
|
2761
|
+
window.stormcloudCtv,
|
|
2762
|
+
window.AiryTV,
|
|
2763
|
+
window.Android
|
|
2764
|
+
].filter(Boolean);
|
|
2765
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2766
|
+
try {
|
|
2767
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2768
|
+
var source = _step.value;
|
|
2769
|
+
var contentUrl = readBridgeValue(source, [
|
|
2770
|
+
"contentUrl",
|
|
2771
|
+
"url",
|
|
2772
|
+
"videoUrl",
|
|
2773
|
+
"canonicalUrl"
|
|
2774
|
+
]) || void 0;
|
|
2775
|
+
var deviceId = readBridgeValue(source, [
|
|
2776
|
+
"rdid",
|
|
2777
|
+
"ifa",
|
|
2778
|
+
"advertisingId",
|
|
2779
|
+
"adId",
|
|
2780
|
+
"deviceId"
|
|
2781
|
+
]) || void 0;
|
|
2782
|
+
if (!contentUrl && !deviceId) continue;
|
|
2783
|
+
var deviceIdType = readBridgeValue(source, [
|
|
2784
|
+
"idtype",
|
|
2785
|
+
"deviceIdType",
|
|
2786
|
+
"advertisingIdType"
|
|
2787
|
+
]) || inferDeviceIdType();
|
|
2788
|
+
var limitAdTracking = readBridgeBoolean(source, [
|
|
2789
|
+
"is_lat",
|
|
2790
|
+
"limitAdTracking",
|
|
2791
|
+
"limitedAdTracking",
|
|
2792
|
+
"lat"
|
|
2793
|
+
]);
|
|
2794
|
+
return _object_spread({}, contentUrl ? {
|
|
2795
|
+
contentUrl: contentUrl
|
|
2796
|
+
} : {}, deviceId ? {
|
|
2797
|
+
deviceId: deviceId
|
|
2798
|
+
} : {}, deviceId && deviceIdType ? {
|
|
2799
|
+
deviceIdType: deviceIdType
|
|
2800
|
+
} : {}, deviceId && limitAdTracking != null ? {
|
|
2801
|
+
limitAdTracking: limitAdTracking
|
|
2802
|
+
} : {});
|
|
2803
|
+
}
|
|
2804
|
+
} catch (err) {
|
|
2805
|
+
_didIteratorError = true;
|
|
2806
|
+
_iteratorError = err;
|
|
2807
|
+
} finally{
|
|
2808
|
+
try {
|
|
2809
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2810
|
+
_iterator.return();
|
|
2811
|
+
}
|
|
2812
|
+
} finally{
|
|
2813
|
+
if (_didIteratorError) {
|
|
2814
|
+
throw _iteratorError;
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
return {};
|
|
2819
|
+
}
|
|
2820
|
+
function readBridgeValue(source, keys) {
|
|
2821
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2822
|
+
try {
|
|
2823
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2824
|
+
var key = _step.value;
|
|
2825
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
2826
|
+
if (typeof value === "string" && value) {
|
|
2827
|
+
return value;
|
|
2828
|
+
}
|
|
2829
|
+
if (typeof value === "function") {
|
|
2830
|
+
try {
|
|
2831
|
+
var result = value.call(source);
|
|
2832
|
+
if (typeof result === "string" && result) {
|
|
2833
|
+
return result;
|
|
2834
|
+
}
|
|
2835
|
+
} catch (unused) {}
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
} catch (err) {
|
|
2839
|
+
_didIteratorError = true;
|
|
2840
|
+
_iteratorError = err;
|
|
2841
|
+
} finally{
|
|
2842
|
+
try {
|
|
2843
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2844
|
+
_iterator.return();
|
|
2845
|
+
}
|
|
2846
|
+
} finally{
|
|
2847
|
+
if (_didIteratorError) {
|
|
2848
|
+
throw _iteratorError;
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
return void 0;
|
|
2853
|
+
}
|
|
2854
|
+
function readBridgeBoolean(source, keys) {
|
|
2855
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2856
|
+
try {
|
|
2857
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2858
|
+
var key = _step.value;
|
|
2859
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
2860
|
+
var normalized = normalizeBoolean(value);
|
|
2861
|
+
if (normalized != null) {
|
|
2862
|
+
return normalized;
|
|
2863
|
+
}
|
|
2864
|
+
if (typeof value === "function") {
|
|
2865
|
+
try {
|
|
2866
|
+
var result = normalizeBoolean(value.call(source));
|
|
2867
|
+
if (result != null) {
|
|
2868
|
+
return result;
|
|
2869
|
+
}
|
|
2870
|
+
} catch (unused) {}
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
} catch (err) {
|
|
2874
|
+
_didIteratorError = true;
|
|
2875
|
+
_iteratorError = err;
|
|
2876
|
+
} finally{
|
|
2877
|
+
try {
|
|
2878
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2879
|
+
_iterator.return();
|
|
2880
|
+
}
|
|
2881
|
+
} finally{
|
|
2882
|
+
if (_didIteratorError) {
|
|
2883
|
+
throw _iteratorError;
|
|
2884
|
+
}
|
|
2885
|
+
}
|
|
2886
|
+
}
|
|
2887
|
+
return void 0;
|
|
2888
|
+
}
|
|
2889
|
+
function readStoredDeviceId() {
|
|
2890
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2891
|
+
try {
|
|
2892
|
+
for(var _iterator = DEVICE_ID_STORAGE_KEYS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2893
|
+
var key = _step.value;
|
|
2894
|
+
var value = readStoredString(key);
|
|
2895
|
+
if (value) {
|
|
2896
|
+
return value;
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
} catch (err) {
|
|
2900
|
+
_didIteratorError = true;
|
|
2901
|
+
_iteratorError = err;
|
|
2902
|
+
} finally{
|
|
2903
|
+
try {
|
|
2904
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2905
|
+
_iterator.return();
|
|
2906
|
+
}
|
|
2907
|
+
} finally{
|
|
2908
|
+
if (_didIteratorError) {
|
|
2909
|
+
throw _iteratorError;
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
return void 0;
|
|
2914
|
+
}
|
|
2915
|
+
function readStoredString(key) {
|
|
2916
|
+
if (typeof window === "undefined") {
|
|
2917
|
+
return void 0;
|
|
2918
|
+
}
|
|
2919
|
+
try {
|
|
2920
|
+
var _window_localStorage;
|
|
2921
|
+
var value = (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key);
|
|
2922
|
+
return value || void 0;
|
|
2923
|
+
} catch (unused) {
|
|
2924
|
+
return void 0;
|
|
2925
|
+
}
|
|
2926
|
+
}
|
|
2927
|
+
function readStoredLimitAdTracking() {
|
|
2928
|
+
return normalizeBoolean(readStoredString("limitAdTracking") || readStoredString("limitedAdTracking") || readStoredString("is_lat"));
|
|
2929
|
+
}
|
|
2930
|
+
function normalizeBoolean(value) {
|
|
2931
|
+
if (typeof value === "boolean") {
|
|
2932
|
+
return value;
|
|
2933
|
+
}
|
|
2934
|
+
if (typeof value === "number") {
|
|
2935
|
+
return value === 1;
|
|
2936
|
+
}
|
|
2937
|
+
if (typeof value === "string") {
|
|
2938
|
+
var normalized = value.toLowerCase();
|
|
2939
|
+
if (normalized === "1" || normalized === "true" || normalized === "yes") {
|
|
2940
|
+
return true;
|
|
2941
|
+
}
|
|
2942
|
+
if (normalized === "0" || normalized === "false" || normalized === "no") {
|
|
2943
|
+
return false;
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
return void 0;
|
|
2947
|
+
}
|
|
2948
|
+
function inferDeviceIdType() {
|
|
2949
|
+
if (typeof navigator === "undefined") {
|
|
2950
|
+
return void 0;
|
|
2951
|
+
}
|
|
2952
|
+
var ua = navigator.userAgent;
|
|
2953
|
+
if (/Roku/i.test(ua)) return "rida";
|
|
2954
|
+
if (/Tizen|Samsung/i.test(ua)) return "tifa";
|
|
2955
|
+
if (/AppleTV/i.test(ua)) return "tvOS";
|
|
2956
|
+
if (/AFT|Fire TV|Amazon/i.test(ua)) return "afai";
|
|
2957
|
+
if (/Web0S|webOS|LG/i.test(ua)) return "lgudid";
|
|
2958
|
+
if (/Android|Google TV/i.test(ua)) return "aaid";
|
|
2959
|
+
return void 0;
|
|
2960
|
+
}
|
|
2639
2961
|
// src/player/StormcloudVideoPlayer.ts
|
|
2640
2962
|
var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
2641
2963
|
function StormcloudVideoPlayer(config) {
|
|
@@ -5077,17 +5399,24 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5077
5399
|
for(var i = 0; i < count; i++){
|
|
5078
5400
|
this.adRequestPositionInBreak++;
|
|
5079
5401
|
var adWillPlayMuted = this.inAdBreak ? this.adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5402
|
+
var ctvSignals = this.config.ctvAdRequest ? resolveCtvVastSignals() : void 0;
|
|
5080
5403
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5081
5404
|
correlator: generateCorrelator(),
|
|
5082
5405
|
streamCorrelator: this.streamCorrelator,
|
|
5083
5406
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5084
5407
|
adPosition: this.adRequestPositionInBreak,
|
|
5085
|
-
|
|
5408
|
+
isCtv: this.config.ctvAdRequest,
|
|
5409
|
+
contentUrl: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.contentUrl,
|
|
5410
|
+
pageUrl: !this.config.ctvAdRequest && typeof window !== "undefined" ? window.location.href : void 0,
|
|
5086
5411
|
adWillPlayMuted: adWillPlayMuted,
|
|
5087
5412
|
adWillAutoPlay: !!this.config.autoplay,
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5413
|
+
appId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.appId,
|
|
5414
|
+
appName: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.appName,
|
|
5415
|
+
sessionId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.sessionId,
|
|
5416
|
+
deviceId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceId,
|
|
5417
|
+
deviceIdType: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceIdType,
|
|
5418
|
+
limitAdTracking: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.limitAdTracking,
|
|
5419
|
+
deviceTypeHint: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceTypeHint,
|
|
5091
5420
|
adTest: this.config.adTest,
|
|
5092
5421
|
consent: this.consentSignals
|
|
5093
5422
|
});
|
|
@@ -7892,12 +8221,13 @@ var CRITICAL_PROPS = [
|
|
|
7892
8221
|
"vmapUrl",
|
|
7893
8222
|
"lowLatencyMode",
|
|
7894
8223
|
"driftToleranceMs",
|
|
7895
|
-
"vastMode"
|
|
8224
|
+
"vastMode",
|
|
8225
|
+
"ctvAdRequest"
|
|
7896
8226
|
];
|
|
7897
8227
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
7898
8228
|
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
7899
8229
|
var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
7900
|
-
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, restVideoAttrs = _object_without_properties(props, [
|
|
8230
|
+
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, restVideoAttrs = _object_without_properties(props, [
|
|
7901
8231
|
"src",
|
|
7902
8232
|
"autoplay",
|
|
7903
8233
|
"muted",
|
|
@@ -7927,7 +8257,8 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
7927
8257
|
"vastTagUrl",
|
|
7928
8258
|
"isVmap",
|
|
7929
8259
|
"vmapUrl",
|
|
7930
|
-
"minSegmentsBeforePlay"
|
|
8260
|
+
"minSegmentsBeforePlay",
|
|
8261
|
+
"ctvAdRequest"
|
|
7931
8262
|
]);
|
|
7932
8263
|
var videoRef = (0, import_react.useRef)(null);
|
|
7933
8264
|
var playerRef = (0, import_react.useRef)(null);
|
|
@@ -8116,6 +8447,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
8116
8447
|
if (isVmap !== void 0) cfg.isVmap = isVmap;
|
|
8117
8448
|
if (vmapUrl !== void 0) cfg.vmapUrl = vmapUrl;
|
|
8118
8449
|
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
8450
|
+
if (ctvAdRequest !== void 0) cfg.ctvAdRequest = ctvAdRequest;
|
|
8119
8451
|
var player = new StormcloudVideoPlayer(cfg);
|
|
8120
8452
|
playerRef.current = player;
|
|
8121
8453
|
player.load().then(function() {
|