stormcloud-video-player 0.8.13 → 0.8.14
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 +354 -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 +354 -30
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +346 -27
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +347 -27
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +347 -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 +352 -30
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/ctvVastSignals.cjs +371 -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
package/lib/index.d.cts
CHANGED
|
@@ -39,9 +39,7 @@ interface StormcloudVideoPlayerConfig {
|
|
|
39
39
|
vmapUrl?: string;
|
|
40
40
|
vastMode?: 'adstorm' | 'default';
|
|
41
41
|
minSegmentsBeforePlay?: number;
|
|
42
|
-
|
|
43
|
-
deviceIdType?: string;
|
|
44
|
-
limitAdTracking?: boolean;
|
|
42
|
+
ctvAdRequest?: boolean;
|
|
45
43
|
adTest?: boolean;
|
|
46
44
|
}
|
|
47
45
|
interface AdController {
|
|
@@ -413,6 +411,7 @@ interface BaseStormcloudPlayerProps {
|
|
|
413
411
|
vmapUrl?: string;
|
|
414
412
|
adFailsafeTimeoutMs?: number;
|
|
415
413
|
minSegmentsBeforePlay?: number;
|
|
414
|
+
ctvAdRequest?: boolean;
|
|
416
415
|
onReady?: (player: StormcloudVideoPlayer) => void;
|
|
417
416
|
onStart?: () => void;
|
|
418
417
|
onPlay?: () => void;
|
package/lib/index.d.ts
CHANGED
|
@@ -39,9 +39,7 @@ interface StormcloudVideoPlayerConfig {
|
|
|
39
39
|
vmapUrl?: string;
|
|
40
40
|
vastMode?: 'adstorm' | 'default';
|
|
41
41
|
minSegmentsBeforePlay?: number;
|
|
42
|
-
|
|
43
|
-
deviceIdType?: string;
|
|
44
|
-
limitAdTracking?: boolean;
|
|
42
|
+
ctvAdRequest?: boolean;
|
|
45
43
|
adTest?: boolean;
|
|
46
44
|
}
|
|
47
45
|
interface AdController {
|
|
@@ -413,6 +411,7 @@ interface BaseStormcloudPlayerProps {
|
|
|
413
411
|
vmapUrl?: string;
|
|
414
412
|
adFailsafeTimeoutMs?: number;
|
|
415
413
|
minSegmentsBeforePlay?: number;
|
|
414
|
+
ctvAdRequest?: boolean;
|
|
416
415
|
onReady?: (player: StormcloudVideoPlayer) => void;
|
|
417
416
|
onStart?: () => void;
|
|
418
417
|
onPlay?: () => void;
|
package/lib/index.js
CHANGED
|
@@ -2336,6 +2336,20 @@ function generateCorrelator() {
|
|
|
2336
2336
|
return String(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER) + 1);
|
|
2337
2337
|
}
|
|
2338
2338
|
var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
|
|
2339
|
+
var CTV_UNSUPPORTED_PARAMS = [
|
|
2340
|
+
"description_url",
|
|
2341
|
+
"tfcd",
|
|
2342
|
+
"npa",
|
|
2343
|
+
"min_ad_duration",
|
|
2344
|
+
"max_ad_duration",
|
|
2345
|
+
"unviewed_position_start",
|
|
2346
|
+
"impl",
|
|
2347
|
+
"scor",
|
|
2348
|
+
"vad_type",
|
|
2349
|
+
"gdpr",
|
|
2350
|
+
"gdpr_consent",
|
|
2351
|
+
"us_privacy"
|
|
2352
|
+
];
|
|
2339
2353
|
function applyVastMacros(baseUrl, ctx) {
|
|
2340
2354
|
var url;
|
|
2341
2355
|
try {
|
|
@@ -2345,16 +2359,42 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2345
2359
|
}
|
|
2346
2360
|
var params = url.searchParams;
|
|
2347
2361
|
params.set("correlator", ctx.correlator);
|
|
2348
|
-
|
|
2362
|
+
if (ctx.isCtv) {
|
|
2363
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2364
|
+
try {
|
|
2365
|
+
for(var _iterator = CTV_UNSUPPORTED_PARAMS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2366
|
+
var key = _step.value;
|
|
2367
|
+
params.delete(key);
|
|
2368
|
+
}
|
|
2369
|
+
} catch (err) {
|
|
2370
|
+
_didIteratorError = true;
|
|
2371
|
+
_iteratorError = err;
|
|
2372
|
+
} finally{
|
|
2373
|
+
try {
|
|
2374
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2375
|
+
_iterator.return();
|
|
2376
|
+
}
|
|
2377
|
+
} finally{
|
|
2378
|
+
if (_didIteratorError) {
|
|
2379
|
+
throw _iteratorError;
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
} else {
|
|
2384
|
+
params.set("scor", ctx.streamCorrelator);
|
|
2385
|
+
}
|
|
2349
2386
|
if (ctx.pod != null) {
|
|
2350
2387
|
params.set("pod", String(ctx.pod));
|
|
2351
2388
|
}
|
|
2352
2389
|
if (ctx.adPosition != null) {
|
|
2353
2390
|
params.set("ppos", String(ctx.adPosition));
|
|
2354
2391
|
}
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
params.set("
|
|
2392
|
+
var requestUrl = ctx.contentUrl || ctx.pageUrl;
|
|
2393
|
+
if (requestUrl) {
|
|
2394
|
+
params.set("url", requestUrl);
|
|
2395
|
+
if (!ctx.isCtv) {
|
|
2396
|
+
params.set("description_url", requestUrl);
|
|
2397
|
+
}
|
|
2358
2398
|
}
|
|
2359
2399
|
if (ctx.adWillPlayMuted != null) {
|
|
2360
2400
|
params.set("vpmute", ctx.adWillPlayMuted ? "1" : "0");
|
|
@@ -2362,6 +2402,20 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2362
2402
|
if (ctx.adWillAutoPlay != null) {
|
|
2363
2403
|
params.set("vpa", ctx.adWillAutoPlay ? "auto" : "click");
|
|
2364
2404
|
}
|
|
2405
|
+
if (ctx.appId) {
|
|
2406
|
+
params.set("msid", ctx.appId);
|
|
2407
|
+
}
|
|
2408
|
+
if (ctx.appName) {
|
|
2409
|
+
params.set("an", ctx.appName);
|
|
2410
|
+
}
|
|
2411
|
+
if (ctx.sessionId) {
|
|
2412
|
+
params.set("sid", ctx.sessionId);
|
|
2413
|
+
}
|
|
2414
|
+
if (ctx.deviceTypeHint != null) {
|
|
2415
|
+
params.set("dth", String(ctx.deviceTypeHint));
|
|
2416
|
+
} else if (ctx.isCtv) {
|
|
2417
|
+
params.set("dth", "5");
|
|
2418
|
+
}
|
|
2365
2419
|
if (ctx.deviceId && ctx.deviceIdType) {
|
|
2366
2420
|
params.set("rdid", ctx.deviceId);
|
|
2367
2421
|
params.set("idtype", ctx.deviceIdType);
|
|
@@ -2371,15 +2425,17 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2371
2425
|
params.delete("idtype");
|
|
2372
2426
|
params.delete("is_lat");
|
|
2373
2427
|
}
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2428
|
+
if (!ctx.isCtv) {
|
|
2429
|
+
var consent = ctx.consent;
|
|
2430
|
+
if ((consent === null || consent === void 0 ? void 0 : consent.gdpr) != null) {
|
|
2431
|
+
params.set("gdpr", consent.gdpr);
|
|
2432
|
+
}
|
|
2433
|
+
if ((consent === null || consent === void 0 ? void 0 : consent.gdprConsent) != null) {
|
|
2434
|
+
params.set("gdpr_consent", consent.gdprConsent);
|
|
2435
|
+
}
|
|
2436
|
+
if ((consent === null || consent === void 0 ? void 0 : consent.usPrivacy) != null) {
|
|
2437
|
+
params.set("us_privacy", consent.usPrivacy);
|
|
2438
|
+
}
|
|
2383
2439
|
}
|
|
2384
2440
|
if (ctx.adTest) {
|
|
2385
2441
|
params.set("adtest", "on");
|
|
@@ -2390,23 +2446,23 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2390
2446
|
staleKeys.push(key);
|
|
2391
2447
|
}
|
|
2392
2448
|
});
|
|
2393
|
-
var
|
|
2449
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
2394
2450
|
try {
|
|
2395
|
-
for(var
|
|
2396
|
-
var
|
|
2397
|
-
params.delete(
|
|
2451
|
+
for(var _iterator1 = staleKeys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2452
|
+
var key1 = _step1.value;
|
|
2453
|
+
params.delete(key1);
|
|
2398
2454
|
}
|
|
2399
2455
|
} catch (err) {
|
|
2400
|
-
|
|
2401
|
-
|
|
2456
|
+
_didIteratorError1 = true;
|
|
2457
|
+
_iteratorError1 = err;
|
|
2402
2458
|
} finally{
|
|
2403
2459
|
try {
|
|
2404
|
-
if (!
|
|
2405
|
-
|
|
2460
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
2461
|
+
_iterator1.return();
|
|
2406
2462
|
}
|
|
2407
2463
|
} finally{
|
|
2408
|
-
if (
|
|
2409
|
-
throw
|
|
2464
|
+
if (_didIteratorError1) {
|
|
2465
|
+
throw _iteratorError1;
|
|
2410
2466
|
}
|
|
2411
2467
|
}
|
|
2412
2468
|
}
|
|
@@ -2669,6 +2725,262 @@ function supportsFeature(feature) {
|
|
|
2669
2725
|
return false;
|
|
2670
2726
|
}
|
|
2671
2727
|
}
|
|
2728
|
+
// src/utils/ctvVastSignals.ts
|
|
2729
|
+
var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
|
|
2730
|
+
var AIRY_APP_NAME = "AiryTV Movies & TV";
|
|
2731
|
+
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
2732
|
+
var DEVICE_ID_STORAGE_KEYS = [
|
|
2733
|
+
"rdid",
|
|
2734
|
+
"ifa",
|
|
2735
|
+
"advertisingId",
|
|
2736
|
+
"advertising_id",
|
|
2737
|
+
"deviceAdvertisingId",
|
|
2738
|
+
"aaid",
|
|
2739
|
+
"adid",
|
|
2740
|
+
"rida",
|
|
2741
|
+
"tifa"
|
|
2742
|
+
];
|
|
2743
|
+
function resolveCtvVastSignals() {
|
|
2744
|
+
var _ref, _bridgeSignals_limitAdTracking;
|
|
2745
|
+
var bridgeSignals = readNativeBridgeSignals();
|
|
2746
|
+
var deviceId = bridgeSignals.deviceId || readStoredDeviceId();
|
|
2747
|
+
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || inferDeviceIdType();
|
|
2748
|
+
return _object_spread_props(_object_spread({
|
|
2749
|
+
contentUrl: "https://".concat(AIRY_ANDROID_APP_ID, ".example.com"),
|
|
2750
|
+
appId: AIRY_ANDROID_APP_ID,
|
|
2751
|
+
appName: AIRY_APP_NAME,
|
|
2752
|
+
sessionId: getOrCreateCtvSessionId()
|
|
2753
|
+
}, deviceId ? {
|
|
2754
|
+
deviceId: deviceId
|
|
2755
|
+
} : {}, deviceId && deviceIdType ? {
|
|
2756
|
+
deviceIdType: deviceIdType
|
|
2757
|
+
} : {}, deviceId ? {
|
|
2758
|
+
limitAdTracking: (_ref = (_bridgeSignals_limitAdTracking = bridgeSignals.limitAdTracking) !== null && _bridgeSignals_limitAdTracking !== void 0 ? _bridgeSignals_limitAdTracking : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false
|
|
2759
|
+
} : {}), {
|
|
2760
|
+
deviceTypeHint: 5
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
function getOrCreateCtvSessionId() {
|
|
2764
|
+
var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
|
|
2765
|
+
if (existing) {
|
|
2766
|
+
return existing;
|
|
2767
|
+
}
|
|
2768
|
+
var sessionId = createUuid();
|
|
2769
|
+
try {
|
|
2770
|
+
var _window_localStorage;
|
|
2771
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
2772
|
+
} catch (unused) {}
|
|
2773
|
+
return sessionId;
|
|
2774
|
+
}
|
|
2775
|
+
function createUuid() {
|
|
2776
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
2777
|
+
return crypto.randomUUID();
|
|
2778
|
+
}
|
|
2779
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
|
|
2780
|
+
var value = Math.floor(Math.random() * 16);
|
|
2781
|
+
var nibble = char === "x" ? value : value & 3 | 8;
|
|
2782
|
+
return nibble.toString(16);
|
|
2783
|
+
});
|
|
2784
|
+
}
|
|
2785
|
+
function readNativeBridgeSignals() {
|
|
2786
|
+
if (typeof window === "undefined") {
|
|
2787
|
+
return {};
|
|
2788
|
+
}
|
|
2789
|
+
var candidates = [
|
|
2790
|
+
window.__STORMCLOUD_CTV_AD_INFO__,
|
|
2791
|
+
window.__STORMCLOUD_CTV__,
|
|
2792
|
+
window.stormcloudCtv,
|
|
2793
|
+
window.AiryTV,
|
|
2794
|
+
window.Android
|
|
2795
|
+
].filter(Boolean);
|
|
2796
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2797
|
+
try {
|
|
2798
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2799
|
+
var source = _step.value;
|
|
2800
|
+
var deviceId = readBridgeValue(source, [
|
|
2801
|
+
"rdid",
|
|
2802
|
+
"ifa",
|
|
2803
|
+
"advertisingId",
|
|
2804
|
+
"adId",
|
|
2805
|
+
"deviceId"
|
|
2806
|
+
]) || void 0;
|
|
2807
|
+
if (!deviceId) continue;
|
|
2808
|
+
var deviceIdType = readBridgeValue(source, [
|
|
2809
|
+
"idtype",
|
|
2810
|
+
"deviceIdType",
|
|
2811
|
+
"advertisingIdType"
|
|
2812
|
+
]) || inferDeviceIdType();
|
|
2813
|
+
var limitAdTracking = readBridgeBoolean(source, [
|
|
2814
|
+
"is_lat",
|
|
2815
|
+
"limitAdTracking",
|
|
2816
|
+
"limitedAdTracking",
|
|
2817
|
+
"lat"
|
|
2818
|
+
]);
|
|
2819
|
+
return _object_spread({
|
|
2820
|
+
deviceId: deviceId
|
|
2821
|
+
}, deviceIdType ? {
|
|
2822
|
+
deviceIdType: deviceIdType
|
|
2823
|
+
} : {}, limitAdTracking != null ? {
|
|
2824
|
+
limitAdTracking: limitAdTracking
|
|
2825
|
+
} : {});
|
|
2826
|
+
}
|
|
2827
|
+
} catch (err) {
|
|
2828
|
+
_didIteratorError = true;
|
|
2829
|
+
_iteratorError = err;
|
|
2830
|
+
} finally{
|
|
2831
|
+
try {
|
|
2832
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2833
|
+
_iterator.return();
|
|
2834
|
+
}
|
|
2835
|
+
} finally{
|
|
2836
|
+
if (_didIteratorError) {
|
|
2837
|
+
throw _iteratorError;
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
return {};
|
|
2842
|
+
}
|
|
2843
|
+
function readBridgeValue(source, keys) {
|
|
2844
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2845
|
+
try {
|
|
2846
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2847
|
+
var key = _step.value;
|
|
2848
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
2849
|
+
if (typeof value === "string" && value) {
|
|
2850
|
+
return value;
|
|
2851
|
+
}
|
|
2852
|
+
if (typeof value === "function") {
|
|
2853
|
+
try {
|
|
2854
|
+
var result = value.call(source);
|
|
2855
|
+
if (typeof result === "string" && result) {
|
|
2856
|
+
return result;
|
|
2857
|
+
}
|
|
2858
|
+
} catch (unused) {}
|
|
2859
|
+
}
|
|
2860
|
+
}
|
|
2861
|
+
} catch (err) {
|
|
2862
|
+
_didIteratorError = true;
|
|
2863
|
+
_iteratorError = err;
|
|
2864
|
+
} finally{
|
|
2865
|
+
try {
|
|
2866
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2867
|
+
_iterator.return();
|
|
2868
|
+
}
|
|
2869
|
+
} finally{
|
|
2870
|
+
if (_didIteratorError) {
|
|
2871
|
+
throw _iteratorError;
|
|
2872
|
+
}
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
return void 0;
|
|
2876
|
+
}
|
|
2877
|
+
function readBridgeBoolean(source, keys) {
|
|
2878
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2879
|
+
try {
|
|
2880
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2881
|
+
var key = _step.value;
|
|
2882
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
2883
|
+
var normalized = normalizeBoolean(value);
|
|
2884
|
+
if (normalized != null) {
|
|
2885
|
+
return normalized;
|
|
2886
|
+
}
|
|
2887
|
+
if (typeof value === "function") {
|
|
2888
|
+
try {
|
|
2889
|
+
var result = normalizeBoolean(value.call(source));
|
|
2890
|
+
if (result != null) {
|
|
2891
|
+
return result;
|
|
2892
|
+
}
|
|
2893
|
+
} catch (unused) {}
|
|
2894
|
+
}
|
|
2895
|
+
}
|
|
2896
|
+
} catch (err) {
|
|
2897
|
+
_didIteratorError = true;
|
|
2898
|
+
_iteratorError = err;
|
|
2899
|
+
} finally{
|
|
2900
|
+
try {
|
|
2901
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2902
|
+
_iterator.return();
|
|
2903
|
+
}
|
|
2904
|
+
} finally{
|
|
2905
|
+
if (_didIteratorError) {
|
|
2906
|
+
throw _iteratorError;
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
return void 0;
|
|
2911
|
+
}
|
|
2912
|
+
function readStoredDeviceId() {
|
|
2913
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2914
|
+
try {
|
|
2915
|
+
for(var _iterator = DEVICE_ID_STORAGE_KEYS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2916
|
+
var key = _step.value;
|
|
2917
|
+
var value = readStoredString(key);
|
|
2918
|
+
if (value) {
|
|
2919
|
+
return value;
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
} catch (err) {
|
|
2923
|
+
_didIteratorError = true;
|
|
2924
|
+
_iteratorError = err;
|
|
2925
|
+
} finally{
|
|
2926
|
+
try {
|
|
2927
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2928
|
+
_iterator.return();
|
|
2929
|
+
}
|
|
2930
|
+
} finally{
|
|
2931
|
+
if (_didIteratorError) {
|
|
2932
|
+
throw _iteratorError;
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
return void 0;
|
|
2937
|
+
}
|
|
2938
|
+
function readStoredString(key) {
|
|
2939
|
+
if (typeof window === "undefined") {
|
|
2940
|
+
return void 0;
|
|
2941
|
+
}
|
|
2942
|
+
try {
|
|
2943
|
+
var _window_localStorage;
|
|
2944
|
+
var value = (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key);
|
|
2945
|
+
return value || void 0;
|
|
2946
|
+
} catch (unused) {
|
|
2947
|
+
return void 0;
|
|
2948
|
+
}
|
|
2949
|
+
}
|
|
2950
|
+
function readStoredLimitAdTracking() {
|
|
2951
|
+
return normalizeBoolean(readStoredString("limitAdTracking") || readStoredString("limitedAdTracking") || readStoredString("is_lat"));
|
|
2952
|
+
}
|
|
2953
|
+
function normalizeBoolean(value) {
|
|
2954
|
+
if (typeof value === "boolean") {
|
|
2955
|
+
return value;
|
|
2956
|
+
}
|
|
2957
|
+
if (typeof value === "number") {
|
|
2958
|
+
return value === 1;
|
|
2959
|
+
}
|
|
2960
|
+
if (typeof value === "string") {
|
|
2961
|
+
var normalized = value.toLowerCase();
|
|
2962
|
+
if (normalized === "1" || normalized === "true" || normalized === "yes") {
|
|
2963
|
+
return true;
|
|
2964
|
+
}
|
|
2965
|
+
if (normalized === "0" || normalized === "false" || normalized === "no") {
|
|
2966
|
+
return false;
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
return void 0;
|
|
2970
|
+
}
|
|
2971
|
+
function inferDeviceIdType() {
|
|
2972
|
+
if (typeof navigator === "undefined") {
|
|
2973
|
+
return void 0;
|
|
2974
|
+
}
|
|
2975
|
+
var ua = navigator.userAgent;
|
|
2976
|
+
if (/Roku/i.test(ua)) return "rida";
|
|
2977
|
+
if (/Tizen|Samsung/i.test(ua)) return "tifa";
|
|
2978
|
+
if (/AppleTV/i.test(ua)) return "tvOS";
|
|
2979
|
+
if (/AFT|Fire TV|Amazon/i.test(ua)) return "afai";
|
|
2980
|
+
if (/Web0S|webOS|LG/i.test(ua)) return "lgudid";
|
|
2981
|
+
if (/Android|Google TV/i.test(ua)) return "aaid";
|
|
2982
|
+
return void 0;
|
|
2983
|
+
}
|
|
2672
2984
|
// src/player/StormcloudVideoPlayer.ts
|
|
2673
2985
|
var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
2674
2986
|
"use strict";
|
|
@@ -5111,17 +5423,24 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5111
5423
|
for(var i = 0; i < count; i++){
|
|
5112
5424
|
this.adRequestPositionInBreak++;
|
|
5113
5425
|
var adWillPlayMuted = this.inAdBreak ? this.adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5426
|
+
var ctvSignals = this.config.ctvAdRequest ? resolveCtvVastSignals() : void 0;
|
|
5114
5427
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5115
5428
|
correlator: generateCorrelator(),
|
|
5116
5429
|
streamCorrelator: this.streamCorrelator,
|
|
5117
5430
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5118
5431
|
adPosition: this.adRequestPositionInBreak,
|
|
5119
|
-
|
|
5432
|
+
isCtv: this.config.ctvAdRequest,
|
|
5433
|
+
contentUrl: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.contentUrl,
|
|
5434
|
+
pageUrl: !this.config.ctvAdRequest && typeof window !== "undefined" ? window.location.href : void 0,
|
|
5120
5435
|
adWillPlayMuted: adWillPlayMuted,
|
|
5121
5436
|
adWillAutoPlay: !!this.config.autoplay,
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5437
|
+
appId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.appId,
|
|
5438
|
+
appName: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.appName,
|
|
5439
|
+
sessionId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.sessionId,
|
|
5440
|
+
deviceId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceId,
|
|
5441
|
+
deviceIdType: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceIdType,
|
|
5442
|
+
limitAdTracking: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.limitAdTracking,
|
|
5443
|
+
deviceTypeHint: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceTypeHint,
|
|
5125
5444
|
adTest: this.config.adTest,
|
|
5126
5445
|
consent: this.consentSignals
|
|
5127
5446
|
});
|
|
@@ -7926,12 +8245,13 @@ var CRITICAL_PROPS = [
|
|
|
7926
8245
|
"vmapUrl",
|
|
7927
8246
|
"lowLatencyMode",
|
|
7928
8247
|
"driftToleranceMs",
|
|
7929
|
-
"vastMode"
|
|
8248
|
+
"vastMode",
|
|
8249
|
+
"ctvAdRequest"
|
|
7930
8250
|
];
|
|
7931
8251
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
7932
8252
|
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
7933
8253
|
var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
7934
|
-
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, [
|
|
8254
|
+
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, [
|
|
7935
8255
|
"src",
|
|
7936
8256
|
"autoplay",
|
|
7937
8257
|
"muted",
|
|
@@ -7961,7 +8281,8 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7961
8281
|
"vastTagUrl",
|
|
7962
8282
|
"isVmap",
|
|
7963
8283
|
"vmapUrl",
|
|
7964
|
-
"minSegmentsBeforePlay"
|
|
8284
|
+
"minSegmentsBeforePlay",
|
|
8285
|
+
"ctvAdRequest"
|
|
7965
8286
|
]);
|
|
7966
8287
|
var videoRef = useRef(null);
|
|
7967
8288
|
var playerRef = useRef(null);
|
|
@@ -8150,6 +8471,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
8150
8471
|
if (isVmap !== void 0) cfg.isVmap = isVmap;
|
|
8151
8472
|
if (vmapUrl !== void 0) cfg.vmapUrl = vmapUrl;
|
|
8152
8473
|
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
8474
|
+
if (ctvAdRequest !== void 0) cfg.ctvAdRequest = ctvAdRequest;
|
|
8153
8475
|
var player = new StormcloudVideoPlayer(cfg);
|
|
8154
8476
|
playerRef.current = player;
|
|
8155
8477
|
player.load().then(function() {
|
|
@@ -9496,6 +9818,7 @@ var HlsPlayer = /*#__PURE__*/ function(Component) {
|
|
|
9496
9818
|
if (_this1.props.licenseKey !== void 0) config.licenseKey = _this1.props.licenseKey;
|
|
9497
9819
|
if (_this1.props.adFailsafeTimeoutMs !== void 0) config.adFailsafeTimeoutMs = _this1.props.adFailsafeTimeoutMs;
|
|
9498
9820
|
if (_this1.props.minSegmentsBeforePlay !== void 0) config.minSegmentsBeforePlay = _this1.props.minSegmentsBeforePlay;
|
|
9821
|
+
if (_this1.props.ctvAdRequest !== void 0) config.ctvAdRequest = _this1.props.ctvAdRequest;
|
|
9499
9822
|
_this1.player = new StormcloudVideoPlayer(config);
|
|
9500
9823
|
(_this_props_onMount = (_this_props = _this1.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this1);
|
|
9501
9824
|
return [
|
|
@@ -10262,6 +10585,7 @@ var SUPPORTED_PROPS = [
|
|
|
10262
10585
|
"vmapUrl",
|
|
10263
10586
|
"adFailsafeTimeoutMs",
|
|
10264
10587
|
"minSegmentsBeforePlay",
|
|
10588
|
+
"ctvAdRequest",
|
|
10265
10589
|
"onReady",
|
|
10266
10590
|
"onStart",
|
|
10267
10591
|
"onPlay",
|