stormcloud-video-player 0.8.22 → 0.8.24
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 +1062 -912
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1062 -912
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +396 -19
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +1 -0
- package/lib/player/AdConfigManager.cjs +149 -30
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/HlsEngine.cjs +12 -3
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +1059 -912
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +1060 -912
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +1060 -912
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +1061 -913
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/ctvVastSignals.cjs +72 -4
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/tracking.cjs +389 -19
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.cjs +109 -4
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.d.cts +4 -1
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ interface AdBreakOrchestratorHost {
|
|
|
15
15
|
setAdPlayer(player: AdController): void;
|
|
16
16
|
createAdPlayer(continueLiveStreamDuringAds: boolean): AdController;
|
|
17
17
|
shouldContinueLiveStreamDuringAds(): boolean;
|
|
18
|
+
getLiveSyncPosition(): number | undefined;
|
|
18
19
|
generateVastUrls(baseUrl: string, count: number): string[];
|
|
19
20
|
}
|
|
20
21
|
declare class AdBreakOrchestrator {
|
|
@@ -334,6 +334,7 @@ var AIRY_ROKU_APP_ID = "com.freeairytv.roku";
|
|
|
334
334
|
var AIRY_APP_NAME = "AiryTV Movies & TV";
|
|
335
335
|
var AIRY_DEFAULT_CONTENT_URL = "https://live.airy.tv";
|
|
336
336
|
var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
|
|
337
|
+
var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
|
|
337
338
|
var LG_TEST_APP_ID = "com.hulu.plus";
|
|
338
339
|
var LG_TEST_APP_NAME = "Hulu";
|
|
339
340
|
var LG_TEST_CONTENT_URL = "https://www.hulu.com/live-tv";
|
|
@@ -371,12 +372,14 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
|
|
|
371
372
|
"adid"
|
|
372
373
|
]);
|
|
373
374
|
function resolveVastEnvironmentSignals(isCtv) {
|
|
374
|
-
var _ref
|
|
375
|
+
var _ref;
|
|
375
376
|
var bridgeSignals = readNativeBridgeSignals();
|
|
377
|
+
var platformDevice = readPlatformNativeDeviceId();
|
|
376
378
|
var lg = isCtv && isLgWebOS();
|
|
377
|
-
var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || (lg ? getLgTestDeviceId() : void 0);
|
|
378
|
-
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || inferDeviceIdType() || (lg ? "lgudid" : void 0);
|
|
379
|
-
var
|
|
379
|
+
var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId || (lg && platformDevice.limitAdTracking !== true ? getLgTestDeviceId() : void 0);
|
|
380
|
+
var deviceIdType = bridgeSignals.deviceIdType || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType() || (lg ? "lgudid" : void 0);
|
|
381
|
+
var platformLat = bridgeSignals.deviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
|
|
382
|
+
var limitAdTracking = deviceId != null ? (_ref = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking()) !== null && _ref !== void 0 ? _ref : false : void 0;
|
|
380
383
|
if (isCtv) {
|
|
381
384
|
return _object_spread_props(_object_spread({
|
|
382
385
|
isCtv: true,
|
|
@@ -425,6 +428,30 @@ function isEquivalentDeviceIdType(tagType, runtimeType) {
|
|
|
425
428
|
if (tag === runtime) return true;
|
|
426
429
|
return ANDROID_ID_TYPES.has(tag) && ANDROID_ID_TYPES.has(runtime);
|
|
427
430
|
}
|
|
431
|
+
function resolveNativeDeviceId() {
|
|
432
|
+
var bridgeSignals = readNativeBridgeSignals();
|
|
433
|
+
var platformDevice = readPlatformNativeDeviceId();
|
|
434
|
+
var deviceId = bridgeSignals.deviceId || readStoredDeviceId() || platformDevice.deviceId;
|
|
435
|
+
if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
|
|
436
|
+
return void 0;
|
|
437
|
+
}
|
|
438
|
+
return deviceId;
|
|
439
|
+
}
|
|
440
|
+
function getOrCreateStoredUuid(storageKey) {
|
|
441
|
+
if (typeof window === "undefined") {
|
|
442
|
+
return void 0;
|
|
443
|
+
}
|
|
444
|
+
var existing = readStoredString(storageKey);
|
|
445
|
+
if (existing) {
|
|
446
|
+
return existing;
|
|
447
|
+
}
|
|
448
|
+
var id = createUuid();
|
|
449
|
+
try {
|
|
450
|
+
var _window_localStorage;
|
|
451
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, id);
|
|
452
|
+
} catch (unused) {}
|
|
453
|
+
return id;
|
|
454
|
+
}
|
|
428
455
|
function getOrCreateCtvSessionId() {
|
|
429
456
|
var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
|
|
430
457
|
if (existing) {
|
|
@@ -447,6 +474,72 @@ function createUuid() {
|
|
|
447
474
|
return nibble.toString(16);
|
|
448
475
|
});
|
|
449
476
|
}
|
|
477
|
+
function readPlatformNativeDeviceId() {
|
|
478
|
+
if (typeof window === "undefined") return {};
|
|
479
|
+
try {
|
|
480
|
+
var _window_webapis;
|
|
481
|
+
var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
|
|
482
|
+
if (adinfo) {
|
|
483
|
+
var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
|
|
484
|
+
if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
|
|
485
|
+
var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
|
|
486
|
+
return _object_spread({
|
|
487
|
+
deviceId: tifa,
|
|
488
|
+
deviceIdType: "tifa"
|
|
489
|
+
}, typeof lat === "boolean" ? {
|
|
490
|
+
limitAdTracking: lat
|
|
491
|
+
} : {});
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
} catch (unused) {}
|
|
495
|
+
try {
|
|
496
|
+
var webOSDev = window.webOSDev;
|
|
497
|
+
if (webOSDev) {
|
|
498
|
+
var _webOSDev_lgudid;
|
|
499
|
+
var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
|
|
500
|
+
if (typeof lgudid === "string" && lgudid) {
|
|
501
|
+
if (isZeroedAdId(lgudid)) {
|
|
502
|
+
return {
|
|
503
|
+
deviceIdType: "lgudid",
|
|
504
|
+
limitAdTracking: true
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
if (!isMacroPlaceholder(lgudid)) {
|
|
508
|
+
return {
|
|
509
|
+
deviceId: lgudid,
|
|
510
|
+
deviceIdType: "lgudid",
|
|
511
|
+
limitAdTracking: false
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
} catch (unused) {}
|
|
517
|
+
try {
|
|
518
|
+
var roku = window.Roku;
|
|
519
|
+
if (roku) {
|
|
520
|
+
var rida = typeof roku.getPublisherUniqueId === "function" ? roku.getPublisherUniqueId() : roku.rida;
|
|
521
|
+
if (typeof rida === "string" && rida && !isMacroPlaceholder(rida)) {
|
|
522
|
+
return {
|
|
523
|
+
deviceId: rida,
|
|
524
|
+
deviceIdType: "rida",
|
|
525
|
+
limitAdTracking: false
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
} catch (unused) {}
|
|
530
|
+
return {};
|
|
531
|
+
}
|
|
532
|
+
var ZEROED_AD_ID_PATTERNS = /* @__PURE__ */ new Set([
|
|
533
|
+
"38400000-8cf0-11bd-b23e-10b96e40000d",
|
|
534
|
+
"00000000-0000-0000-0000-000000000000"
|
|
535
|
+
]);
|
|
536
|
+
function isMacroPlaceholder(value) {
|
|
537
|
+
var t = value.trim();
|
|
538
|
+
return !t || /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/.test(t) || /^(unknown|null|undefined|none|n\/a|\$\{[^}]+\})$/i.test(t) || ZEROED_AD_ID_PATTERNS.has(t.toLowerCase());
|
|
539
|
+
}
|
|
540
|
+
function isZeroedAdId(value) {
|
|
541
|
+
return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
|
|
542
|
+
}
|
|
450
543
|
function readNativeBridgeSignals() {
|
|
451
544
|
if (typeof window === "undefined") {
|
|
452
545
|
return {};
|
|
@@ -787,7 +880,7 @@ var INLINE_DEVICE_MACRO_REPLACEMENTS = [
|
|
|
787
880
|
}
|
|
788
881
|
}
|
|
789
882
|
];
|
|
790
|
-
function
|
|
883
|
+
function isMacroPlaceholder2(value) {
|
|
791
884
|
if (value == null) return true;
|
|
792
885
|
var trimmed = value.trim();
|
|
793
886
|
if (!trimmed) return true;
|
|
@@ -846,11 +939,11 @@ function applyDeviceIdentityParams(params, ctx) {
|
|
|
846
939
|
if (runtimeId) {
|
|
847
940
|
params.set("rdid", runtimeId);
|
|
848
941
|
params.set("idtype", runtimeType || tagType || "aaid");
|
|
849
|
-
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue :
|
|
942
|
+
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : isMacroPlaceholder2(tagLat) ? "0" : tagLat);
|
|
850
943
|
return;
|
|
851
944
|
}
|
|
852
|
-
var tagRdidValid = Boolean(tagRdid && !
|
|
853
|
-
var tagTypeValid = Boolean(tagType && !
|
|
945
|
+
var tagRdidValid = Boolean(tagRdid && !isMacroPlaceholder2(tagRdid));
|
|
946
|
+
var tagTypeValid = Boolean(tagType && !isMacroPlaceholder2(tagType));
|
|
854
947
|
if (tagRdidValid && tagTypeValid && runtimeType && !isEquivalentDeviceIdType(tagType, runtimeType)) {
|
|
855
948
|
params.delete("rdid");
|
|
856
949
|
params.delete("idtype");
|
|
@@ -858,10 +951,10 @@ function applyDeviceIdentityParams(params, ctx) {
|
|
|
858
951
|
return;
|
|
859
952
|
}
|
|
860
953
|
if (tagRdidValid) {
|
|
861
|
-
if (
|
|
954
|
+
if (isMacroPlaceholder2(tagType) && runtimeType) {
|
|
862
955
|
params.set("idtype", runtimeType);
|
|
863
956
|
}
|
|
864
|
-
if (
|
|
957
|
+
if (isMacroPlaceholder2(tagLat)) {
|
|
865
958
|
params.set("is_lat", latValue !== null && latValue !== void 0 ? latValue : "0");
|
|
866
959
|
}
|
|
867
960
|
return;
|
|
@@ -1047,7 +1140,7 @@ function applyVastMacros(baseUrl, ctx) {
|
|
|
1047
1140
|
}
|
|
1048
1141
|
var staleKeys = [];
|
|
1049
1142
|
params.forEach(function(value, key) {
|
|
1050
|
-
if (
|
|
1143
|
+
if (isMacroPlaceholder2(value)) {
|
|
1051
1144
|
staleKeys.push(key);
|
|
1052
1145
|
}
|
|
1053
1146
|
});
|
|
@@ -1319,19 +1412,12 @@ function getClientInfo() {
|
|
|
1319
1412
|
visibilityState: document.visibilityState
|
|
1320
1413
|
};
|
|
1321
1414
|
}
|
|
1322
|
-
function
|
|
1415
|
+
function sha256Hex(input) {
|
|
1323
1416
|
return _async_to_generator(function() {
|
|
1324
|
-
var _crypto_subtle,
|
|
1417
|
+
var _crypto_subtle, encodedData, utf8, buffer, i, hashBuffer, unused, hash, i1, char, fallbackHash, timestamp, random;
|
|
1325
1418
|
return _ts_generator(this, function(_state) {
|
|
1326
1419
|
switch(_state.label){
|
|
1327
1420
|
case 0:
|
|
1328
|
-
if (cachedBrowserId) {
|
|
1329
|
-
return [
|
|
1330
|
-
2,
|
|
1331
|
-
cachedBrowserId
|
|
1332
|
-
];
|
|
1333
|
-
}
|
|
1334
|
-
fingerprintString = JSON.stringify(clientInfo);
|
|
1335
1421
|
if (!(typeof crypto !== "undefined" && ((_crypto_subtle = crypto.subtle) === null || _crypto_subtle === void 0 ? void 0 : _crypto_subtle.digest))) return [
|
|
1336
1422
|
3,
|
|
1337
1423
|
5
|
|
@@ -1355,9 +1441,9 @@ function getBrowserID(clientInfo) {
|
|
|
1355
1441
|
case 2:
|
|
1356
1442
|
_state.sent();
|
|
1357
1443
|
if (typeof TextEncoder !== "undefined") {
|
|
1358
|
-
encodedData = new TextEncoder().encode(
|
|
1444
|
+
encodedData = new TextEncoder().encode(input);
|
|
1359
1445
|
} else {
|
|
1360
|
-
utf8 = unescape(encodeURIComponent(
|
|
1446
|
+
utf8 = unescape(encodeURIComponent(input));
|
|
1361
1447
|
buffer = new Uint8Array(utf8.length);
|
|
1362
1448
|
for(i = 0; i < utf8.length; i++){
|
|
1363
1449
|
buffer[i] = utf8.charCodeAt(i);
|
|
@@ -1370,13 +1456,11 @@ function getBrowserID(clientInfo) {
|
|
|
1370
1456
|
];
|
|
1371
1457
|
case 3:
|
|
1372
1458
|
hashBuffer = _state.sent();
|
|
1373
|
-
hashHex = Array.from(new Uint8Array(hashBuffer)).map(function(b) {
|
|
1374
|
-
return b.toString(16).padStart(2, "0");
|
|
1375
|
-
}).join("");
|
|
1376
|
-
cachedBrowserId = hashHex;
|
|
1377
1459
|
return [
|
|
1378
1460
|
2,
|
|
1379
|
-
|
|
1461
|
+
Array.from(new Uint8Array(hashBuffer)).map(function(b) {
|
|
1462
|
+
return b.toString(16).padStart(2, "0");
|
|
1463
|
+
}).join("")
|
|
1380
1464
|
];
|
|
1381
1465
|
case 4:
|
|
1382
1466
|
unused = _state.sent();
|
|
@@ -1387,15 +1471,50 @@ function getBrowserID(clientInfo) {
|
|
|
1387
1471
|
];
|
|
1388
1472
|
case 5:
|
|
1389
1473
|
hash = 0;
|
|
1390
|
-
for(i1 = 0; i1 <
|
|
1391
|
-
char =
|
|
1474
|
+
for(i1 = 0; i1 < input.length; i1++){
|
|
1475
|
+
char = input.charCodeAt(i1);
|
|
1392
1476
|
hash = (hash << 5) - hash + char;
|
|
1393
1477
|
hash = hash & hash;
|
|
1394
1478
|
}
|
|
1395
1479
|
fallbackHash = Math.abs(hash).toString(16).padStart(8, "0");
|
|
1396
1480
|
timestamp = Date.now().toString(16).padStart(12, "0");
|
|
1397
1481
|
random = Math.random().toString(16).substring(2, 14).padStart(12, "0");
|
|
1398
|
-
|
|
1482
|
+
return [
|
|
1483
|
+
2,
|
|
1484
|
+
(fallbackHash + timestamp + random).padEnd(64, "0")
|
|
1485
|
+
];
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
})();
|
|
1489
|
+
}
|
|
1490
|
+
function resolvePlayerIdentitySeed(clientInfo) {
|
|
1491
|
+
var nativeDeviceId = resolveNativeDeviceId();
|
|
1492
|
+
if (nativeDeviceId) {
|
|
1493
|
+
return "device:".concat(nativeDeviceId);
|
|
1494
|
+
}
|
|
1495
|
+
var persistedId = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
|
|
1496
|
+
if (persistedId) {
|
|
1497
|
+
return "persisted:".concat(persistedId);
|
|
1498
|
+
}
|
|
1499
|
+
return "fingerprint:".concat(JSON.stringify(clientInfo));
|
|
1500
|
+
}
|
|
1501
|
+
function getBrowserID(clientInfo) {
|
|
1502
|
+
return _async_to_generator(function() {
|
|
1503
|
+
return _ts_generator(this, function(_state) {
|
|
1504
|
+
switch(_state.label){
|
|
1505
|
+
case 0:
|
|
1506
|
+
if (cachedBrowserId) {
|
|
1507
|
+
return [
|
|
1508
|
+
2,
|
|
1509
|
+
cachedBrowserId
|
|
1510
|
+
];
|
|
1511
|
+
}
|
|
1512
|
+
return [
|
|
1513
|
+
4,
|
|
1514
|
+
sha256Hex(resolvePlayerIdentitySeed(clientInfo))
|
|
1515
|
+
];
|
|
1516
|
+
case 1:
|
|
1517
|
+
cachedBrowserId = _state.sent();
|
|
1399
1518
|
return [
|
|
1400
1519
|
2,
|
|
1401
1520
|
cachedBrowserId
|