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
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,272 @@ 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 AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
|
|
2732
|
+
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
2733
|
+
var DEVICE_ID_STORAGE_KEYS = [
|
|
2734
|
+
"rdid",
|
|
2735
|
+
"ifa",
|
|
2736
|
+
"advertisingId",
|
|
2737
|
+
"advertising_id",
|
|
2738
|
+
"deviceAdvertisingId",
|
|
2739
|
+
"aaid",
|
|
2740
|
+
"adid",
|
|
2741
|
+
"rida",
|
|
2742
|
+
"tifa"
|
|
2743
|
+
];
|
|
2744
|
+
function resolveCtvVastSignals() {
|
|
2745
|
+
var _ref, _bridgeSignals_limitAdTracking;
|
|
2746
|
+
var bridgeSignals = readNativeBridgeSignals();
|
|
2747
|
+
var deviceId = bridgeSignals.deviceId || readStoredDeviceId();
|
|
2748
|
+
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || inferDeviceIdType();
|
|
2749
|
+
var contentUrl = bridgeSignals.contentUrl || readStoredString("contentUrl") || AIRY_DEFAULT_CONTENT_URL;
|
|
2750
|
+
return _object_spread_props(_object_spread({
|
|
2751
|
+
contentUrl: contentUrl,
|
|
2752
|
+
appId: AIRY_ANDROID_APP_ID,
|
|
2753
|
+
appName: AIRY_APP_NAME,
|
|
2754
|
+
sessionId: getOrCreateCtvSessionId()
|
|
2755
|
+
}, deviceId ? {
|
|
2756
|
+
deviceId: deviceId
|
|
2757
|
+
} : {}, deviceId && deviceIdType ? {
|
|
2758
|
+
deviceIdType: deviceIdType
|
|
2759
|
+
} : {}, deviceId ? {
|
|
2760
|
+
limitAdTracking: (_ref = (_bridgeSignals_limitAdTracking = bridgeSignals.limitAdTracking) !== null && _bridgeSignals_limitAdTracking !== void 0 ? _bridgeSignals_limitAdTracking : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false
|
|
2761
|
+
} : {}), {
|
|
2762
|
+
deviceTypeHint: 5
|
|
2763
|
+
});
|
|
2764
|
+
}
|
|
2765
|
+
function getOrCreateCtvSessionId() {
|
|
2766
|
+
var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
|
|
2767
|
+
if (existing) {
|
|
2768
|
+
return existing;
|
|
2769
|
+
}
|
|
2770
|
+
var sessionId = createUuid();
|
|
2771
|
+
try {
|
|
2772
|
+
var _window_localStorage;
|
|
2773
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
2774
|
+
} catch (unused) {}
|
|
2775
|
+
return sessionId;
|
|
2776
|
+
}
|
|
2777
|
+
function createUuid() {
|
|
2778
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
2779
|
+
return crypto.randomUUID();
|
|
2780
|
+
}
|
|
2781
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
|
|
2782
|
+
var value = Math.floor(Math.random() * 16);
|
|
2783
|
+
var nibble = char === "x" ? value : value & 3 | 8;
|
|
2784
|
+
return nibble.toString(16);
|
|
2785
|
+
});
|
|
2786
|
+
}
|
|
2787
|
+
function readNativeBridgeSignals() {
|
|
2788
|
+
if (typeof window === "undefined") {
|
|
2789
|
+
return {};
|
|
2790
|
+
}
|
|
2791
|
+
var candidates = [
|
|
2792
|
+
window.__STORMCLOUD_CTV_AD_INFO__,
|
|
2793
|
+
window.__STORMCLOUD_CTV__,
|
|
2794
|
+
window.stormcloudCtv,
|
|
2795
|
+
window.AiryTV,
|
|
2796
|
+
window.Android
|
|
2797
|
+
].filter(Boolean);
|
|
2798
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2799
|
+
try {
|
|
2800
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2801
|
+
var source = _step.value;
|
|
2802
|
+
var contentUrl = readBridgeValue(source, [
|
|
2803
|
+
"contentUrl",
|
|
2804
|
+
"url",
|
|
2805
|
+
"videoUrl",
|
|
2806
|
+
"canonicalUrl"
|
|
2807
|
+
]) || void 0;
|
|
2808
|
+
var deviceId = readBridgeValue(source, [
|
|
2809
|
+
"rdid",
|
|
2810
|
+
"ifa",
|
|
2811
|
+
"advertisingId",
|
|
2812
|
+
"adId",
|
|
2813
|
+
"deviceId"
|
|
2814
|
+
]) || void 0;
|
|
2815
|
+
if (!contentUrl && !deviceId) continue;
|
|
2816
|
+
var deviceIdType = readBridgeValue(source, [
|
|
2817
|
+
"idtype",
|
|
2818
|
+
"deviceIdType",
|
|
2819
|
+
"advertisingIdType"
|
|
2820
|
+
]) || inferDeviceIdType();
|
|
2821
|
+
var limitAdTracking = readBridgeBoolean(source, [
|
|
2822
|
+
"is_lat",
|
|
2823
|
+
"limitAdTracking",
|
|
2824
|
+
"limitedAdTracking",
|
|
2825
|
+
"lat"
|
|
2826
|
+
]);
|
|
2827
|
+
return _object_spread({}, contentUrl ? {
|
|
2828
|
+
contentUrl: contentUrl
|
|
2829
|
+
} : {}, deviceId ? {
|
|
2830
|
+
deviceId: deviceId
|
|
2831
|
+
} : {}, deviceId && deviceIdType ? {
|
|
2832
|
+
deviceIdType: deviceIdType
|
|
2833
|
+
} : {}, deviceId && limitAdTracking != null ? {
|
|
2834
|
+
limitAdTracking: limitAdTracking
|
|
2835
|
+
} : {});
|
|
2836
|
+
}
|
|
2837
|
+
} catch (err) {
|
|
2838
|
+
_didIteratorError = true;
|
|
2839
|
+
_iteratorError = err;
|
|
2840
|
+
} finally{
|
|
2841
|
+
try {
|
|
2842
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2843
|
+
_iterator.return();
|
|
2844
|
+
}
|
|
2845
|
+
} finally{
|
|
2846
|
+
if (_didIteratorError) {
|
|
2847
|
+
throw _iteratorError;
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
return {};
|
|
2852
|
+
}
|
|
2853
|
+
function readBridgeValue(source, keys) {
|
|
2854
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2855
|
+
try {
|
|
2856
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2857
|
+
var key = _step.value;
|
|
2858
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
2859
|
+
if (typeof value === "string" && value) {
|
|
2860
|
+
return value;
|
|
2861
|
+
}
|
|
2862
|
+
if (typeof value === "function") {
|
|
2863
|
+
try {
|
|
2864
|
+
var result = value.call(source);
|
|
2865
|
+
if (typeof result === "string" && result) {
|
|
2866
|
+
return result;
|
|
2867
|
+
}
|
|
2868
|
+
} catch (unused) {}
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
} catch (err) {
|
|
2872
|
+
_didIteratorError = true;
|
|
2873
|
+
_iteratorError = err;
|
|
2874
|
+
} finally{
|
|
2875
|
+
try {
|
|
2876
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2877
|
+
_iterator.return();
|
|
2878
|
+
}
|
|
2879
|
+
} finally{
|
|
2880
|
+
if (_didIteratorError) {
|
|
2881
|
+
throw _iteratorError;
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
return void 0;
|
|
2886
|
+
}
|
|
2887
|
+
function readBridgeBoolean(source, keys) {
|
|
2888
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2889
|
+
try {
|
|
2890
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2891
|
+
var key = _step.value;
|
|
2892
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
2893
|
+
var normalized = normalizeBoolean(value);
|
|
2894
|
+
if (normalized != null) {
|
|
2895
|
+
return normalized;
|
|
2896
|
+
}
|
|
2897
|
+
if (typeof value === "function") {
|
|
2898
|
+
try {
|
|
2899
|
+
var result = normalizeBoolean(value.call(source));
|
|
2900
|
+
if (result != null) {
|
|
2901
|
+
return result;
|
|
2902
|
+
}
|
|
2903
|
+
} catch (unused) {}
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2906
|
+
} catch (err) {
|
|
2907
|
+
_didIteratorError = true;
|
|
2908
|
+
_iteratorError = err;
|
|
2909
|
+
} finally{
|
|
2910
|
+
try {
|
|
2911
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2912
|
+
_iterator.return();
|
|
2913
|
+
}
|
|
2914
|
+
} finally{
|
|
2915
|
+
if (_didIteratorError) {
|
|
2916
|
+
throw _iteratorError;
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
return void 0;
|
|
2921
|
+
}
|
|
2922
|
+
function readStoredDeviceId() {
|
|
2923
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2924
|
+
try {
|
|
2925
|
+
for(var _iterator = DEVICE_ID_STORAGE_KEYS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2926
|
+
var key = _step.value;
|
|
2927
|
+
var value = readStoredString(key);
|
|
2928
|
+
if (value) {
|
|
2929
|
+
return value;
|
|
2930
|
+
}
|
|
2931
|
+
}
|
|
2932
|
+
} catch (err) {
|
|
2933
|
+
_didIteratorError = true;
|
|
2934
|
+
_iteratorError = err;
|
|
2935
|
+
} finally{
|
|
2936
|
+
try {
|
|
2937
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2938
|
+
_iterator.return();
|
|
2939
|
+
}
|
|
2940
|
+
} finally{
|
|
2941
|
+
if (_didIteratorError) {
|
|
2942
|
+
throw _iteratorError;
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
return void 0;
|
|
2947
|
+
}
|
|
2948
|
+
function readStoredString(key) {
|
|
2949
|
+
if (typeof window === "undefined") {
|
|
2950
|
+
return void 0;
|
|
2951
|
+
}
|
|
2952
|
+
try {
|
|
2953
|
+
var _window_localStorage;
|
|
2954
|
+
var value = (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key);
|
|
2955
|
+
return value || void 0;
|
|
2956
|
+
} catch (unused) {
|
|
2957
|
+
return void 0;
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
function readStoredLimitAdTracking() {
|
|
2961
|
+
return normalizeBoolean(readStoredString("limitAdTracking") || readStoredString("limitedAdTracking") || readStoredString("is_lat"));
|
|
2962
|
+
}
|
|
2963
|
+
function normalizeBoolean(value) {
|
|
2964
|
+
if (typeof value === "boolean") {
|
|
2965
|
+
return value;
|
|
2966
|
+
}
|
|
2967
|
+
if (typeof value === "number") {
|
|
2968
|
+
return value === 1;
|
|
2969
|
+
}
|
|
2970
|
+
if (typeof value === "string") {
|
|
2971
|
+
var normalized = value.toLowerCase();
|
|
2972
|
+
if (normalized === "1" || normalized === "true" || normalized === "yes") {
|
|
2973
|
+
return true;
|
|
2974
|
+
}
|
|
2975
|
+
if (normalized === "0" || normalized === "false" || normalized === "no") {
|
|
2976
|
+
return false;
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
return void 0;
|
|
2980
|
+
}
|
|
2981
|
+
function inferDeviceIdType() {
|
|
2982
|
+
if (typeof navigator === "undefined") {
|
|
2983
|
+
return void 0;
|
|
2984
|
+
}
|
|
2985
|
+
var ua = navigator.userAgent;
|
|
2986
|
+
if (/Roku/i.test(ua)) return "rida";
|
|
2987
|
+
if (/Tizen|Samsung/i.test(ua)) return "tifa";
|
|
2988
|
+
if (/AppleTV/i.test(ua)) return "tvOS";
|
|
2989
|
+
if (/AFT|Fire TV|Amazon/i.test(ua)) return "afai";
|
|
2990
|
+
if (/Web0S|webOS|LG/i.test(ua)) return "lgudid";
|
|
2991
|
+
if (/Android|Google TV/i.test(ua)) return "aaid";
|
|
2992
|
+
return void 0;
|
|
2993
|
+
}
|
|
2672
2994
|
// src/player/StormcloudVideoPlayer.ts
|
|
2673
2995
|
var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
2674
2996
|
"use strict";
|
|
@@ -5111,17 +5433,24 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5111
5433
|
for(var i = 0; i < count; i++){
|
|
5112
5434
|
this.adRequestPositionInBreak++;
|
|
5113
5435
|
var adWillPlayMuted = this.inAdBreak ? this.adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5436
|
+
var ctvSignals = this.config.ctvAdRequest ? resolveCtvVastSignals() : void 0;
|
|
5114
5437
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5115
5438
|
correlator: generateCorrelator(),
|
|
5116
5439
|
streamCorrelator: this.streamCorrelator,
|
|
5117
5440
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5118
5441
|
adPosition: this.adRequestPositionInBreak,
|
|
5119
|
-
|
|
5442
|
+
isCtv: this.config.ctvAdRequest,
|
|
5443
|
+
contentUrl: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.contentUrl,
|
|
5444
|
+
pageUrl: !this.config.ctvAdRequest && typeof window !== "undefined" ? window.location.href : void 0,
|
|
5120
5445
|
adWillPlayMuted: adWillPlayMuted,
|
|
5121
5446
|
adWillAutoPlay: !!this.config.autoplay,
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5447
|
+
appId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.appId,
|
|
5448
|
+
appName: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.appName,
|
|
5449
|
+
sessionId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.sessionId,
|
|
5450
|
+
deviceId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceId,
|
|
5451
|
+
deviceIdType: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceIdType,
|
|
5452
|
+
limitAdTracking: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.limitAdTracking,
|
|
5453
|
+
deviceTypeHint: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceTypeHint,
|
|
5125
5454
|
adTest: this.config.adTest,
|
|
5126
5455
|
consent: this.consentSignals
|
|
5127
5456
|
});
|
|
@@ -7926,12 +8255,13 @@ var CRITICAL_PROPS = [
|
|
|
7926
8255
|
"vmapUrl",
|
|
7927
8256
|
"lowLatencyMode",
|
|
7928
8257
|
"driftToleranceMs",
|
|
7929
|
-
"vastMode"
|
|
8258
|
+
"vastMode",
|
|
8259
|
+
"ctvAdRequest"
|
|
7930
8260
|
];
|
|
7931
8261
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
7932
8262
|
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
7933
8263
|
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, [
|
|
8264
|
+
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
8265
|
"src",
|
|
7936
8266
|
"autoplay",
|
|
7937
8267
|
"muted",
|
|
@@ -7961,7 +8291,8 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
7961
8291
|
"vastTagUrl",
|
|
7962
8292
|
"isVmap",
|
|
7963
8293
|
"vmapUrl",
|
|
7964
|
-
"minSegmentsBeforePlay"
|
|
8294
|
+
"minSegmentsBeforePlay",
|
|
8295
|
+
"ctvAdRequest"
|
|
7965
8296
|
]);
|
|
7966
8297
|
var videoRef = useRef(null);
|
|
7967
8298
|
var playerRef = useRef(null);
|
|
@@ -8150,6 +8481,7 @@ var StormcloudVideoPlayerComponent = React.memo(function(props) {
|
|
|
8150
8481
|
if (isVmap !== void 0) cfg.isVmap = isVmap;
|
|
8151
8482
|
if (vmapUrl !== void 0) cfg.vmapUrl = vmapUrl;
|
|
8152
8483
|
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
8484
|
+
if (ctvAdRequest !== void 0) cfg.ctvAdRequest = ctvAdRequest;
|
|
8153
8485
|
var player = new StormcloudVideoPlayer(cfg);
|
|
8154
8486
|
playerRef.current = player;
|
|
8155
8487
|
player.load().then(function() {
|
|
@@ -9496,6 +9828,7 @@ var HlsPlayer = /*#__PURE__*/ function(Component) {
|
|
|
9496
9828
|
if (_this1.props.licenseKey !== void 0) config.licenseKey = _this1.props.licenseKey;
|
|
9497
9829
|
if (_this1.props.adFailsafeTimeoutMs !== void 0) config.adFailsafeTimeoutMs = _this1.props.adFailsafeTimeoutMs;
|
|
9498
9830
|
if (_this1.props.minSegmentsBeforePlay !== void 0) config.minSegmentsBeforePlay = _this1.props.minSegmentsBeforePlay;
|
|
9831
|
+
if (_this1.props.ctvAdRequest !== void 0) config.ctvAdRequest = _this1.props.ctvAdRequest;
|
|
9499
9832
|
_this1.player = new StormcloudVideoPlayer(config);
|
|
9500
9833
|
(_this_props_onMount = (_this_props = _this1.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this1);
|
|
9501
9834
|
return [
|
|
@@ -10262,6 +10595,7 @@ var SUPPORTED_PROPS = [
|
|
|
10262
10595
|
"vmapUrl",
|
|
10263
10596
|
"adFailsafeTimeoutMs",
|
|
10264
10597
|
"minSegmentsBeforePlay",
|
|
10598
|
+
"ctvAdRequest",
|
|
10265
10599
|
"onReady",
|
|
10266
10600
|
"onStart",
|
|
10267
10601
|
"onPlay",
|