stormcloud-video-player 0.8.12 → 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 +355 -39
- 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 +355 -39
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +347 -36
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +348 -36
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +348 -36
- 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 +353 -39
- 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.cjs
CHANGED
|
@@ -2548,6 +2548,20 @@ function generateCorrelator() {
|
|
|
2548
2548
|
return String(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER) + 1);
|
|
2549
2549
|
}
|
|
2550
2550
|
var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
|
|
2551
|
+
var CTV_UNSUPPORTED_PARAMS = [
|
|
2552
|
+
"description_url",
|
|
2553
|
+
"tfcd",
|
|
2554
|
+
"npa",
|
|
2555
|
+
"min_ad_duration",
|
|
2556
|
+
"max_ad_duration",
|
|
2557
|
+
"unviewed_position_start",
|
|
2558
|
+
"impl",
|
|
2559
|
+
"scor",
|
|
2560
|
+
"vad_type",
|
|
2561
|
+
"gdpr",
|
|
2562
|
+
"gdpr_consent",
|
|
2563
|
+
"us_privacy"
|
|
2564
|
+
];
|
|
2551
2565
|
function applyVastMacros(baseUrl, ctx) {
|
|
2552
2566
|
var url;
|
|
2553
2567
|
try {
|
|
@@ -2557,16 +2571,42 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2557
2571
|
}
|
|
2558
2572
|
var params = url.searchParams;
|
|
2559
2573
|
params.set("correlator", ctx.correlator);
|
|
2560
|
-
|
|
2574
|
+
if (ctx.isCtv) {
|
|
2575
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2576
|
+
try {
|
|
2577
|
+
for(var _iterator = CTV_UNSUPPORTED_PARAMS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2578
|
+
var key = _step.value;
|
|
2579
|
+
params.delete(key);
|
|
2580
|
+
}
|
|
2581
|
+
} catch (err) {
|
|
2582
|
+
_didIteratorError = true;
|
|
2583
|
+
_iteratorError = err;
|
|
2584
|
+
} finally{
|
|
2585
|
+
try {
|
|
2586
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2587
|
+
_iterator.return();
|
|
2588
|
+
}
|
|
2589
|
+
} finally{
|
|
2590
|
+
if (_didIteratorError) {
|
|
2591
|
+
throw _iteratorError;
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
} else {
|
|
2596
|
+
params.set("scor", ctx.streamCorrelator);
|
|
2597
|
+
}
|
|
2561
2598
|
if (ctx.pod != null) {
|
|
2562
2599
|
params.set("pod", String(ctx.pod));
|
|
2563
2600
|
}
|
|
2564
2601
|
if (ctx.adPosition != null) {
|
|
2565
2602
|
params.set("ppos", String(ctx.adPosition));
|
|
2566
2603
|
}
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
params.set("
|
|
2604
|
+
var requestUrl = ctx.contentUrl || ctx.pageUrl;
|
|
2605
|
+
if (requestUrl) {
|
|
2606
|
+
params.set("url", requestUrl);
|
|
2607
|
+
if (!ctx.isCtv) {
|
|
2608
|
+
params.set("description_url", requestUrl);
|
|
2609
|
+
}
|
|
2570
2610
|
}
|
|
2571
2611
|
if (ctx.adWillPlayMuted != null) {
|
|
2572
2612
|
params.set("vpmute", ctx.adWillPlayMuted ? "1" : "0");
|
|
@@ -2574,6 +2614,20 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2574
2614
|
if (ctx.adWillAutoPlay != null) {
|
|
2575
2615
|
params.set("vpa", ctx.adWillAutoPlay ? "auto" : "click");
|
|
2576
2616
|
}
|
|
2617
|
+
if (ctx.appId) {
|
|
2618
|
+
params.set("msid", ctx.appId);
|
|
2619
|
+
}
|
|
2620
|
+
if (ctx.appName) {
|
|
2621
|
+
params.set("an", ctx.appName);
|
|
2622
|
+
}
|
|
2623
|
+
if (ctx.sessionId) {
|
|
2624
|
+
params.set("sid", ctx.sessionId);
|
|
2625
|
+
}
|
|
2626
|
+
if (ctx.deviceTypeHint != null) {
|
|
2627
|
+
params.set("dth", String(ctx.deviceTypeHint));
|
|
2628
|
+
} else if (ctx.isCtv) {
|
|
2629
|
+
params.set("dth", "5");
|
|
2630
|
+
}
|
|
2577
2631
|
if (ctx.deviceId && ctx.deviceIdType) {
|
|
2578
2632
|
params.set("rdid", ctx.deviceId);
|
|
2579
2633
|
params.set("idtype", ctx.deviceIdType);
|
|
@@ -2583,15 +2637,17 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2583
2637
|
params.delete("idtype");
|
|
2584
2638
|
params.delete("is_lat");
|
|
2585
2639
|
}
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2640
|
+
if (!ctx.isCtv) {
|
|
2641
|
+
var consent = ctx.consent;
|
|
2642
|
+
if ((consent === null || consent === void 0 ? void 0 : consent.gdpr) != null) {
|
|
2643
|
+
params.set("gdpr", consent.gdpr);
|
|
2644
|
+
}
|
|
2645
|
+
if ((consent === null || consent === void 0 ? void 0 : consent.gdprConsent) != null) {
|
|
2646
|
+
params.set("gdpr_consent", consent.gdprConsent);
|
|
2647
|
+
}
|
|
2648
|
+
if ((consent === null || consent === void 0 ? void 0 : consent.usPrivacy) != null) {
|
|
2649
|
+
params.set("us_privacy", consent.usPrivacy);
|
|
2650
|
+
}
|
|
2595
2651
|
}
|
|
2596
2652
|
if (ctx.adTest) {
|
|
2597
2653
|
params.set("adtest", "on");
|
|
@@ -2602,23 +2658,23 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
2602
2658
|
staleKeys.push(key);
|
|
2603
2659
|
}
|
|
2604
2660
|
});
|
|
2605
|
-
var
|
|
2661
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
2606
2662
|
try {
|
|
2607
|
-
for(var
|
|
2608
|
-
var
|
|
2609
|
-
params.delete(
|
|
2663
|
+
for(var _iterator1 = staleKeys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
2664
|
+
var key1 = _step1.value;
|
|
2665
|
+
params.delete(key1);
|
|
2610
2666
|
}
|
|
2611
2667
|
} catch (err) {
|
|
2612
|
-
|
|
2613
|
-
|
|
2668
|
+
_didIteratorError1 = true;
|
|
2669
|
+
_iteratorError1 = err;
|
|
2614
2670
|
} finally{
|
|
2615
2671
|
try {
|
|
2616
|
-
if (!
|
|
2617
|
-
|
|
2672
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
2673
|
+
_iterator1.return();
|
|
2618
2674
|
}
|
|
2619
2675
|
} finally{
|
|
2620
|
-
if (
|
|
2621
|
-
throw
|
|
2676
|
+
if (_didIteratorError1) {
|
|
2677
|
+
throw _iteratorError1;
|
|
2622
2678
|
}
|
|
2623
2679
|
}
|
|
2624
2680
|
}
|
|
@@ -2881,6 +2937,262 @@ function supportsFeature(feature) {
|
|
|
2881
2937
|
return false;
|
|
2882
2938
|
}
|
|
2883
2939
|
}
|
|
2940
|
+
// src/utils/ctvVastSignals.ts
|
|
2941
|
+
var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
|
|
2942
|
+
var AIRY_APP_NAME = "AiryTV Movies & TV";
|
|
2943
|
+
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
2944
|
+
var DEVICE_ID_STORAGE_KEYS = [
|
|
2945
|
+
"rdid",
|
|
2946
|
+
"ifa",
|
|
2947
|
+
"advertisingId",
|
|
2948
|
+
"advertising_id",
|
|
2949
|
+
"deviceAdvertisingId",
|
|
2950
|
+
"aaid",
|
|
2951
|
+
"adid",
|
|
2952
|
+
"rida",
|
|
2953
|
+
"tifa"
|
|
2954
|
+
];
|
|
2955
|
+
function resolveCtvVastSignals() {
|
|
2956
|
+
var _ref, _bridgeSignals_limitAdTracking;
|
|
2957
|
+
var bridgeSignals = readNativeBridgeSignals();
|
|
2958
|
+
var deviceId = bridgeSignals.deviceId || readStoredDeviceId();
|
|
2959
|
+
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || inferDeviceIdType();
|
|
2960
|
+
return _object_spread_props(_object_spread({
|
|
2961
|
+
contentUrl: "https://".concat(AIRY_ANDROID_APP_ID, ".example.com"),
|
|
2962
|
+
appId: AIRY_ANDROID_APP_ID,
|
|
2963
|
+
appName: AIRY_APP_NAME,
|
|
2964
|
+
sessionId: getOrCreateCtvSessionId()
|
|
2965
|
+
}, deviceId ? {
|
|
2966
|
+
deviceId: deviceId
|
|
2967
|
+
} : {}, deviceId && deviceIdType ? {
|
|
2968
|
+
deviceIdType: deviceIdType
|
|
2969
|
+
} : {}, deviceId ? {
|
|
2970
|
+
limitAdTracking: (_ref = (_bridgeSignals_limitAdTracking = bridgeSignals.limitAdTracking) !== null && _bridgeSignals_limitAdTracking !== void 0 ? _bridgeSignals_limitAdTracking : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false
|
|
2971
|
+
} : {}), {
|
|
2972
|
+
deviceTypeHint: 5
|
|
2973
|
+
});
|
|
2974
|
+
}
|
|
2975
|
+
function getOrCreateCtvSessionId() {
|
|
2976
|
+
var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
|
|
2977
|
+
if (existing) {
|
|
2978
|
+
return existing;
|
|
2979
|
+
}
|
|
2980
|
+
var sessionId = createUuid();
|
|
2981
|
+
try {
|
|
2982
|
+
var _window_localStorage;
|
|
2983
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
2984
|
+
} catch (unused) {}
|
|
2985
|
+
return sessionId;
|
|
2986
|
+
}
|
|
2987
|
+
function createUuid() {
|
|
2988
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
2989
|
+
return crypto.randomUUID();
|
|
2990
|
+
}
|
|
2991
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(char) {
|
|
2992
|
+
var value = Math.floor(Math.random() * 16);
|
|
2993
|
+
var nibble = char === "x" ? value : value & 3 | 8;
|
|
2994
|
+
return nibble.toString(16);
|
|
2995
|
+
});
|
|
2996
|
+
}
|
|
2997
|
+
function readNativeBridgeSignals() {
|
|
2998
|
+
if (typeof window === "undefined") {
|
|
2999
|
+
return {};
|
|
3000
|
+
}
|
|
3001
|
+
var candidates = [
|
|
3002
|
+
window.__STORMCLOUD_CTV_AD_INFO__,
|
|
3003
|
+
window.__STORMCLOUD_CTV__,
|
|
3004
|
+
window.stormcloudCtv,
|
|
3005
|
+
window.AiryTV,
|
|
3006
|
+
window.Android
|
|
3007
|
+
].filter(Boolean);
|
|
3008
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3009
|
+
try {
|
|
3010
|
+
for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3011
|
+
var source = _step.value;
|
|
3012
|
+
var deviceId = readBridgeValue(source, [
|
|
3013
|
+
"rdid",
|
|
3014
|
+
"ifa",
|
|
3015
|
+
"advertisingId",
|
|
3016
|
+
"adId",
|
|
3017
|
+
"deviceId"
|
|
3018
|
+
]) || void 0;
|
|
3019
|
+
if (!deviceId) continue;
|
|
3020
|
+
var deviceIdType = readBridgeValue(source, [
|
|
3021
|
+
"idtype",
|
|
3022
|
+
"deviceIdType",
|
|
3023
|
+
"advertisingIdType"
|
|
3024
|
+
]) || inferDeviceIdType();
|
|
3025
|
+
var limitAdTracking = readBridgeBoolean(source, [
|
|
3026
|
+
"is_lat",
|
|
3027
|
+
"limitAdTracking",
|
|
3028
|
+
"limitedAdTracking",
|
|
3029
|
+
"lat"
|
|
3030
|
+
]);
|
|
3031
|
+
return _object_spread({
|
|
3032
|
+
deviceId: deviceId
|
|
3033
|
+
}, deviceIdType ? {
|
|
3034
|
+
deviceIdType: deviceIdType
|
|
3035
|
+
} : {}, limitAdTracking != null ? {
|
|
3036
|
+
limitAdTracking: limitAdTracking
|
|
3037
|
+
} : {});
|
|
3038
|
+
}
|
|
3039
|
+
} catch (err) {
|
|
3040
|
+
_didIteratorError = true;
|
|
3041
|
+
_iteratorError = err;
|
|
3042
|
+
} finally{
|
|
3043
|
+
try {
|
|
3044
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3045
|
+
_iterator.return();
|
|
3046
|
+
}
|
|
3047
|
+
} finally{
|
|
3048
|
+
if (_didIteratorError) {
|
|
3049
|
+
throw _iteratorError;
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
return {};
|
|
3054
|
+
}
|
|
3055
|
+
function readBridgeValue(source, keys) {
|
|
3056
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3057
|
+
try {
|
|
3058
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3059
|
+
var key = _step.value;
|
|
3060
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
3061
|
+
if (typeof value === "string" && value) {
|
|
3062
|
+
return value;
|
|
3063
|
+
}
|
|
3064
|
+
if (typeof value === "function") {
|
|
3065
|
+
try {
|
|
3066
|
+
var result = value.call(source);
|
|
3067
|
+
if (typeof result === "string" && result) {
|
|
3068
|
+
return result;
|
|
3069
|
+
}
|
|
3070
|
+
} catch (unused) {}
|
|
3071
|
+
}
|
|
3072
|
+
}
|
|
3073
|
+
} catch (err) {
|
|
3074
|
+
_didIteratorError = true;
|
|
3075
|
+
_iteratorError = err;
|
|
3076
|
+
} finally{
|
|
3077
|
+
try {
|
|
3078
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3079
|
+
_iterator.return();
|
|
3080
|
+
}
|
|
3081
|
+
} finally{
|
|
3082
|
+
if (_didIteratorError) {
|
|
3083
|
+
throw _iteratorError;
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
}
|
|
3087
|
+
return void 0;
|
|
3088
|
+
}
|
|
3089
|
+
function readBridgeBoolean(source, keys) {
|
|
3090
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3091
|
+
try {
|
|
3092
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3093
|
+
var key = _step.value;
|
|
3094
|
+
var value = source === null || source === void 0 ? void 0 : source[key];
|
|
3095
|
+
var normalized = normalizeBoolean(value);
|
|
3096
|
+
if (normalized != null) {
|
|
3097
|
+
return normalized;
|
|
3098
|
+
}
|
|
3099
|
+
if (typeof value === "function") {
|
|
3100
|
+
try {
|
|
3101
|
+
var result = normalizeBoolean(value.call(source));
|
|
3102
|
+
if (result != null) {
|
|
3103
|
+
return result;
|
|
3104
|
+
}
|
|
3105
|
+
} catch (unused) {}
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
} catch (err) {
|
|
3109
|
+
_didIteratorError = true;
|
|
3110
|
+
_iteratorError = err;
|
|
3111
|
+
} finally{
|
|
3112
|
+
try {
|
|
3113
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3114
|
+
_iterator.return();
|
|
3115
|
+
}
|
|
3116
|
+
} finally{
|
|
3117
|
+
if (_didIteratorError) {
|
|
3118
|
+
throw _iteratorError;
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
return void 0;
|
|
3123
|
+
}
|
|
3124
|
+
function readStoredDeviceId() {
|
|
3125
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3126
|
+
try {
|
|
3127
|
+
for(var _iterator = DEVICE_ID_STORAGE_KEYS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3128
|
+
var key = _step.value;
|
|
3129
|
+
var value = readStoredString(key);
|
|
3130
|
+
if (value) {
|
|
3131
|
+
return value;
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
} catch (err) {
|
|
3135
|
+
_didIteratorError = true;
|
|
3136
|
+
_iteratorError = err;
|
|
3137
|
+
} finally{
|
|
3138
|
+
try {
|
|
3139
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3140
|
+
_iterator.return();
|
|
3141
|
+
}
|
|
3142
|
+
} finally{
|
|
3143
|
+
if (_didIteratorError) {
|
|
3144
|
+
throw _iteratorError;
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
return void 0;
|
|
3149
|
+
}
|
|
3150
|
+
function readStoredString(key) {
|
|
3151
|
+
if (typeof window === "undefined") {
|
|
3152
|
+
return void 0;
|
|
3153
|
+
}
|
|
3154
|
+
try {
|
|
3155
|
+
var _window_localStorage;
|
|
3156
|
+
var value = (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key);
|
|
3157
|
+
return value || void 0;
|
|
3158
|
+
} catch (unused) {
|
|
3159
|
+
return void 0;
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
function readStoredLimitAdTracking() {
|
|
3163
|
+
return normalizeBoolean(readStoredString("limitAdTracking") || readStoredString("limitedAdTracking") || readStoredString("is_lat"));
|
|
3164
|
+
}
|
|
3165
|
+
function normalizeBoolean(value) {
|
|
3166
|
+
if (typeof value === "boolean") {
|
|
3167
|
+
return value;
|
|
3168
|
+
}
|
|
3169
|
+
if (typeof value === "number") {
|
|
3170
|
+
return value === 1;
|
|
3171
|
+
}
|
|
3172
|
+
if (typeof value === "string") {
|
|
3173
|
+
var normalized = value.toLowerCase();
|
|
3174
|
+
if (normalized === "1" || normalized === "true" || normalized === "yes") {
|
|
3175
|
+
return true;
|
|
3176
|
+
}
|
|
3177
|
+
if (normalized === "0" || normalized === "false" || normalized === "no") {
|
|
3178
|
+
return false;
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3181
|
+
return void 0;
|
|
3182
|
+
}
|
|
3183
|
+
function inferDeviceIdType() {
|
|
3184
|
+
if (typeof navigator === "undefined") {
|
|
3185
|
+
return void 0;
|
|
3186
|
+
}
|
|
3187
|
+
var ua = navigator.userAgent;
|
|
3188
|
+
if (/Roku/i.test(ua)) return "rida";
|
|
3189
|
+
if (/Tizen|Samsung/i.test(ua)) return "tifa";
|
|
3190
|
+
if (/AppleTV/i.test(ua)) return "tvOS";
|
|
3191
|
+
if (/AFT|Fire TV|Amazon/i.test(ua)) return "afai";
|
|
3192
|
+
if (/Web0S|webOS|LG/i.test(ua)) return "lgudid";
|
|
3193
|
+
if (/Android|Google TV/i.test(ua)) return "aaid";
|
|
3194
|
+
return void 0;
|
|
3195
|
+
}
|
|
2884
3196
|
// src/player/StormcloudVideoPlayer.ts
|
|
2885
3197
|
var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
2886
3198
|
function StormcloudVideoPlayer(config) {
|
|
@@ -5322,17 +5634,24 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5322
5634
|
for(var i = 0; i < count; i++){
|
|
5323
5635
|
this.adRequestPositionInBreak++;
|
|
5324
5636
|
var adWillPlayMuted = this.inAdBreak ? this.adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5637
|
+
var ctvSignals = this.config.ctvAdRequest ? resolveCtvVastSignals() : void 0;
|
|
5325
5638
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5326
5639
|
correlator: generateCorrelator(),
|
|
5327
5640
|
streamCorrelator: this.streamCorrelator,
|
|
5328
5641
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5329
5642
|
adPosition: this.adRequestPositionInBreak,
|
|
5330
|
-
|
|
5643
|
+
isCtv: this.config.ctvAdRequest,
|
|
5644
|
+
contentUrl: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.contentUrl,
|
|
5645
|
+
pageUrl: !this.config.ctvAdRequest && typeof window !== "undefined" ? window.location.href : void 0,
|
|
5331
5646
|
adWillPlayMuted: adWillPlayMuted,
|
|
5332
5647
|
adWillAutoPlay: !!this.config.autoplay,
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5648
|
+
appId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.appId,
|
|
5649
|
+
appName: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.appName,
|
|
5650
|
+
sessionId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.sessionId,
|
|
5651
|
+
deviceId: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceId,
|
|
5652
|
+
deviceIdType: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceIdType,
|
|
5653
|
+
limitAdTracking: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.limitAdTracking,
|
|
5654
|
+
deviceTypeHint: ctvSignals === null || ctvSignals === void 0 ? void 0 : ctvSignals.deviceTypeHint,
|
|
5336
5655
|
adTest: this.config.adTest,
|
|
5337
5656
|
consent: this.consentSignals
|
|
5338
5657
|
});
|
|
@@ -5916,21 +6235,13 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5916
6235
|
currentMuted = this.video.muted;
|
|
5917
6236
|
currentVolume = this.video.volume;
|
|
5918
6237
|
this.adPlayer.updateOriginalMutedState(currentMuted, currentVolume);
|
|
5919
|
-
if (!this.video.muted) {
|
|
5920
|
-
this.video.muted = true;
|
|
5921
|
-
if (this.config.debugAdTiming) {
|
|
5922
|
-
console.log("[StormcloudVideoPlayer] Muted video in handleAdStart");
|
|
5923
|
-
}
|
|
5924
|
-
}
|
|
5925
6238
|
this.inAdBreak = true;
|
|
5926
6239
|
this.currentAdBreakStartWallClockMs = Date.now();
|
|
5927
6240
|
this.adBreakPlayedDurationMs = 0;
|
|
5928
6241
|
this.currentAdIndex = 0;
|
|
5929
6242
|
this.totalAdsInBreak = 0;
|
|
5930
6243
|
this.adPodQueue = [];
|
|
5931
|
-
this.showAds =
|
|
5932
|
-
this.showPlaceholderLayer();
|
|
5933
|
-
this.adPlayer.showPlaceholder();
|
|
6244
|
+
this.showAds = false;
|
|
5934
6245
|
if (this.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
|
|
5935
6246
|
this.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
5936
6247
|
}
|
|
@@ -8145,12 +8456,13 @@ var CRITICAL_PROPS = [
|
|
|
8145
8456
|
"vmapUrl",
|
|
8146
8457
|
"lowLatencyMode",
|
|
8147
8458
|
"driftToleranceMs",
|
|
8148
|
-
"vastMode"
|
|
8459
|
+
"vastMode",
|
|
8460
|
+
"ctvAdRequest"
|
|
8149
8461
|
];
|
|
8150
8462
|
var CONTROLS_HIDE_DELAY = 3e3;
|
|
8151
8463
|
var DEFAULT_PLAYER_ASPECT_RATIO = 16 / 9;
|
|
8152
8464
|
var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
8153
|
-
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, [
|
|
8465
|
+
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, [
|
|
8154
8466
|
"src",
|
|
8155
8467
|
"autoplay",
|
|
8156
8468
|
"muted",
|
|
@@ -8180,7 +8492,8 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
8180
8492
|
"vastTagUrl",
|
|
8181
8493
|
"isVmap",
|
|
8182
8494
|
"vmapUrl",
|
|
8183
|
-
"minSegmentsBeforePlay"
|
|
8495
|
+
"minSegmentsBeforePlay",
|
|
8496
|
+
"ctvAdRequest"
|
|
8184
8497
|
]);
|
|
8185
8498
|
var videoRef = (0, import_react.useRef)(null);
|
|
8186
8499
|
var playerRef = (0, import_react.useRef)(null);
|
|
@@ -8369,6 +8682,7 @@ var StormcloudVideoPlayerComponent = import_react.default.memo(function(props) {
|
|
|
8369
8682
|
if (isVmap !== void 0) cfg.isVmap = isVmap;
|
|
8370
8683
|
if (vmapUrl !== void 0) cfg.vmapUrl = vmapUrl;
|
|
8371
8684
|
if (minSegmentsBeforePlay !== void 0) cfg.minSegmentsBeforePlay = minSegmentsBeforePlay;
|
|
8685
|
+
if (ctvAdRequest !== void 0) cfg.ctvAdRequest = ctvAdRequest;
|
|
8372
8686
|
var player = new StormcloudVideoPlayer(cfg);
|
|
8373
8687
|
playerRef.current = player;
|
|
8374
8688
|
player.load().then(function() {
|
|
@@ -9714,6 +10028,7 @@ var HlsPlayer = /*#__PURE__*/ function(_import_react3_Component) {
|
|
|
9714
10028
|
if (_this1.props.licenseKey !== void 0) config.licenseKey = _this1.props.licenseKey;
|
|
9715
10029
|
if (_this1.props.adFailsafeTimeoutMs !== void 0) config.adFailsafeTimeoutMs = _this1.props.adFailsafeTimeoutMs;
|
|
9716
10030
|
if (_this1.props.minSegmentsBeforePlay !== void 0) config.minSegmentsBeforePlay = _this1.props.minSegmentsBeforePlay;
|
|
10031
|
+
if (_this1.props.ctvAdRequest !== void 0) config.ctvAdRequest = _this1.props.ctvAdRequest;
|
|
9717
10032
|
_this1.player = new StormcloudVideoPlayer(config);
|
|
9718
10033
|
(_this_props_onMount = (_this_props = _this1.props).onMount) === null || _this_props_onMount === void 0 ? void 0 : _this_props_onMount.call(_this_props, _this1);
|
|
9719
10034
|
return [
|
|
@@ -10478,6 +10793,7 @@ var SUPPORTED_PROPS = [
|
|
|
10478
10793
|
"vmapUrl",
|
|
10479
10794
|
"adFailsafeTimeoutMs",
|
|
10480
10795
|
"minSegmentsBeforePlay",
|
|
10796
|
+
"ctvAdRequest",
|
|
10481
10797
|
"onReady",
|
|
10482
10798
|
"onStart",
|
|
10483
10799
|
"onPlay",
|