stormcloud-video-player 0.8.23 → 0.8.25
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 +1187 -1109
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +3 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +1028 -954
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +419 -26
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +2 -1
- package/lib/player/AdConfigManager.cjs +90 -22
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdConfigManager.d.cts +1 -1
- package/lib/player/AdPreloadPool.d.cts +1 -1
- package/lib/player/AdTimingService.d.cts +1 -1
- package/lib/player/HlsEngine.d.cts +1 -1
- package/lib/player/PlayerControls.d.cts +1 -1
- package/lib/player/Scte35CueManager.d.cts +1 -1
- package/lib/player/Scte35Parser.d.cts +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +1184 -1110
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/player/playerTypes.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +1184 -1110
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +1184 -1110
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/{types-DNiBmPKK.d.cts → types-Bz4aRmzc.d.cts} +1 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +1184 -1110
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/tracking.cjs +411 -20
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +3 -2
- package/lib/utils/vastEnvironmentSignals.cjs +37 -0
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as Scte35Marker, a as StormcloudVideoPlayerConfig, A as AdController } from '../types-
|
|
1
|
+
import { S as Scte35Marker, a as StormcloudVideoPlayerConfig, A as AdController } from '../types-Bz4aRmzc.cjs';
|
|
2
2
|
import { AdTimingService } from './AdTimingService.cjs';
|
|
3
3
|
import { AdPreloadPool } from './AdPreloadPool.cjs';
|
|
4
4
|
import { AdConfigManager } from './AdConfigManager.cjs';
|
|
@@ -44,6 +44,7 @@ declare class AdBreakOrchestrator {
|
|
|
44
44
|
private readonly placeholder;
|
|
45
45
|
constructor(host: AdBreakOrchestratorHost, timing: AdTimingService, preloadPool: AdPreloadPool, adConfig: AdConfigManager, cueManager: Scte35CueManager, placeholder: PlaceholderLayer);
|
|
46
46
|
private get debug();
|
|
47
|
+
private get analyticsContext();
|
|
47
48
|
attachImaEventListeners(): void;
|
|
48
49
|
recreateAdController(): void;
|
|
49
50
|
clearPendingAdBreak(): void;
|
|
@@ -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";
|
|
@@ -427,6 +428,30 @@ function isEquivalentDeviceIdType(tagType, runtimeType) {
|
|
|
427
428
|
if (tag === runtime) return true;
|
|
428
429
|
return ANDROID_ID_TYPES.has(tag) && ANDROID_ID_TYPES.has(runtime);
|
|
429
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
|
+
}
|
|
430
455
|
function getOrCreateCtvSessionId() {
|
|
431
456
|
var existing = readStoredString(CTV_SESSION_STORAGE_KEY);
|
|
432
457
|
if (existing) {
|
|
@@ -1245,6 +1270,16 @@ function publishMQTT(topic, payload) {
|
|
|
1245
1270
|
}
|
|
1246
1271
|
// src/utils/tracking.ts
|
|
1247
1272
|
var cachedBrowserId = null;
|
|
1273
|
+
function buildAnalyticsContext(config) {
|
|
1274
|
+
var context = {};
|
|
1275
|
+
if (config.debugAdTiming) {
|
|
1276
|
+
context.debugAdTiming = true;
|
|
1277
|
+
}
|
|
1278
|
+
if (config.isLiveStream !== void 0) {
|
|
1279
|
+
context.inputStreamType = config.isLiveStream ? "live" : "vod";
|
|
1280
|
+
}
|
|
1281
|
+
return context;
|
|
1282
|
+
}
|
|
1248
1283
|
function getClientInfo() {
|
|
1249
1284
|
var _screen, _screen1, _screen2, _screen3, _screen_orientation, _screen4, _screen5, _window, _window1, _window_screen_orientation, _window_screen, _navigator_languages;
|
|
1250
1285
|
var ua = navigator.userAgent;
|
|
@@ -1387,19 +1422,12 @@ function getClientInfo() {
|
|
|
1387
1422
|
visibilityState: document.visibilityState
|
|
1388
1423
|
};
|
|
1389
1424
|
}
|
|
1390
|
-
function
|
|
1425
|
+
function sha256Hex(input) {
|
|
1391
1426
|
return _async_to_generator(function() {
|
|
1392
|
-
var _crypto_subtle,
|
|
1427
|
+
var _crypto_subtle, encodedData, utf8, buffer, i, hashBuffer, unused, hash, i1, char, fallbackHash, timestamp, random;
|
|
1393
1428
|
return _ts_generator(this, function(_state) {
|
|
1394
1429
|
switch(_state.label){
|
|
1395
1430
|
case 0:
|
|
1396
|
-
if (cachedBrowserId) {
|
|
1397
|
-
return [
|
|
1398
|
-
2,
|
|
1399
|
-
cachedBrowserId
|
|
1400
|
-
];
|
|
1401
|
-
}
|
|
1402
|
-
fingerprintString = JSON.stringify(clientInfo);
|
|
1403
1431
|
if (!(typeof crypto !== "undefined" && ((_crypto_subtle = crypto.subtle) === null || _crypto_subtle === void 0 ? void 0 : _crypto_subtle.digest))) return [
|
|
1404
1432
|
3,
|
|
1405
1433
|
5
|
|
@@ -1423,9 +1451,9 @@ function getBrowserID(clientInfo) {
|
|
|
1423
1451
|
case 2:
|
|
1424
1452
|
_state.sent();
|
|
1425
1453
|
if (typeof TextEncoder !== "undefined") {
|
|
1426
|
-
encodedData = new TextEncoder().encode(
|
|
1454
|
+
encodedData = new TextEncoder().encode(input);
|
|
1427
1455
|
} else {
|
|
1428
|
-
utf8 = unescape(encodeURIComponent(
|
|
1456
|
+
utf8 = unescape(encodeURIComponent(input));
|
|
1429
1457
|
buffer = new Uint8Array(utf8.length);
|
|
1430
1458
|
for(i = 0; i < utf8.length; i++){
|
|
1431
1459
|
buffer[i] = utf8.charCodeAt(i);
|
|
@@ -1438,13 +1466,11 @@ function getBrowserID(clientInfo) {
|
|
|
1438
1466
|
];
|
|
1439
1467
|
case 3:
|
|
1440
1468
|
hashBuffer = _state.sent();
|
|
1441
|
-
hashHex = Array.from(new Uint8Array(hashBuffer)).map(function(b) {
|
|
1442
|
-
return b.toString(16).padStart(2, "0");
|
|
1443
|
-
}).join("");
|
|
1444
|
-
cachedBrowserId = hashHex;
|
|
1445
1469
|
return [
|
|
1446
1470
|
2,
|
|
1447
|
-
|
|
1471
|
+
Array.from(new Uint8Array(hashBuffer)).map(function(b) {
|
|
1472
|
+
return b.toString(16).padStart(2, "0");
|
|
1473
|
+
}).join("")
|
|
1448
1474
|
];
|
|
1449
1475
|
case 4:
|
|
1450
1476
|
unused = _state.sent();
|
|
@@ -1455,15 +1481,50 @@ function getBrowserID(clientInfo) {
|
|
|
1455
1481
|
];
|
|
1456
1482
|
case 5:
|
|
1457
1483
|
hash = 0;
|
|
1458
|
-
for(i1 = 0; i1 <
|
|
1459
|
-
char =
|
|
1484
|
+
for(i1 = 0; i1 < input.length; i1++){
|
|
1485
|
+
char = input.charCodeAt(i1);
|
|
1460
1486
|
hash = (hash << 5) - hash + char;
|
|
1461
1487
|
hash = hash & hash;
|
|
1462
1488
|
}
|
|
1463
1489
|
fallbackHash = Math.abs(hash).toString(16).padStart(8, "0");
|
|
1464
1490
|
timestamp = Date.now().toString(16).padStart(12, "0");
|
|
1465
1491
|
random = Math.random().toString(16).substring(2, 14).padStart(12, "0");
|
|
1466
|
-
|
|
1492
|
+
return [
|
|
1493
|
+
2,
|
|
1494
|
+
(fallbackHash + timestamp + random).padEnd(64, "0")
|
|
1495
|
+
];
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
})();
|
|
1499
|
+
}
|
|
1500
|
+
function resolvePlayerIdentitySeed(clientInfo) {
|
|
1501
|
+
var nativeDeviceId = resolveNativeDeviceId();
|
|
1502
|
+
if (nativeDeviceId) {
|
|
1503
|
+
return "device:".concat(nativeDeviceId);
|
|
1504
|
+
}
|
|
1505
|
+
var persistedId = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
|
|
1506
|
+
if (persistedId) {
|
|
1507
|
+
return "persisted:".concat(persistedId);
|
|
1508
|
+
}
|
|
1509
|
+
return "fingerprint:".concat(JSON.stringify(clientInfo));
|
|
1510
|
+
}
|
|
1511
|
+
function getBrowserID(clientInfo) {
|
|
1512
|
+
return _async_to_generator(function() {
|
|
1513
|
+
return _ts_generator(this, function(_state) {
|
|
1514
|
+
switch(_state.label){
|
|
1515
|
+
case 0:
|
|
1516
|
+
if (cachedBrowserId) {
|
|
1517
|
+
return [
|
|
1518
|
+
2,
|
|
1519
|
+
cachedBrowserId
|
|
1520
|
+
];
|
|
1521
|
+
}
|
|
1522
|
+
return [
|
|
1523
|
+
4,
|
|
1524
|
+
sha256Hex(resolvePlayerIdentitySeed(clientInfo))
|
|
1525
|
+
];
|
|
1526
|
+
case 1:
|
|
1527
|
+
cachedBrowserId = _state.sent();
|
|
1467
1528
|
return [
|
|
1468
1529
|
2,
|
|
1469
1530
|
cachedBrowserId
|
|
@@ -1477,19 +1538,26 @@ function canPublish(licenseKey) {
|
|
|
1477
1538
|
}
|
|
1478
1539
|
function buildPlayerMetricEvent() {
|
|
1479
1540
|
return _async_to_generator(function() {
|
|
1480
|
-
var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, playerId, captureAt;
|
|
1541
|
+
var context, flags, _flags_captureAt, _flags_adLoaded, _flags_adDetect, clientInfo, debugAdTiming, playerId, captureAt;
|
|
1481
1542
|
var _arguments = arguments;
|
|
1482
1543
|
return _ts_generator(this, function(_state) {
|
|
1483
1544
|
switch(_state.label){
|
|
1484
1545
|
case 0:
|
|
1485
1546
|
context = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}, flags = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {};
|
|
1486
1547
|
clientInfo = getClientInfo();
|
|
1548
|
+
debugAdTiming = !!context.debugAdTiming;
|
|
1549
|
+
if (debugAdTiming) {
|
|
1550
|
+
console.log("[StormcloudVideoPlayer] clientInfo: ", JSON.stringify(clientInfo, null, 2));
|
|
1551
|
+
}
|
|
1487
1552
|
return [
|
|
1488
1553
|
4,
|
|
1489
1554
|
getBrowserID(clientInfo)
|
|
1490
1555
|
];
|
|
1491
1556
|
case 1:
|
|
1492
1557
|
playerId = _state.sent();
|
|
1558
|
+
if (debugAdTiming) {
|
|
1559
|
+
console.log("[StormcloudVideoPlayer] playerId: ", playerId);
|
|
1560
|
+
}
|
|
1493
1561
|
captureAt = (_flags_captureAt = flags.captureAt) !== null && _flags_captureAt !== void 0 ? _flags_captureAt : /* @__PURE__ */ new Date().toISOString();
|
|
1494
1562
|
return [
|
|
1495
1563
|
2,
|
|
@@ -2081,7 +2149,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
2081
2149
|
key: "initializeTracking",
|
|
2082
2150
|
value: function initializeTracking() {
|
|
2083
2151
|
var _this = this;
|
|
2084
|
-
sendInitialTracking(this.config.licenseKey).then(function() {
|
|
2152
|
+
sendInitialTracking(this.config.licenseKey, buildAnalyticsContext(this.config)).then(function() {
|
|
2085
2153
|
_this.heartbeatInterval = window.setInterval(function() {
|
|
2086
2154
|
_this.sendHeartbeatIfNeeded();
|
|
2087
2155
|
}, 5e3);
|
|
@@ -2102,7 +2170,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
2102
2170
|
var now = Date.now();
|
|
2103
2171
|
if (!this.lastHeartbeatTime || now - this.lastHeartbeatTime > 3e4) {
|
|
2104
2172
|
this.lastHeartbeatTime = now;
|
|
2105
|
-
sendHeartbeat(this.config.licenseKey).catch(function(error) {
|
|
2173
|
+
sendHeartbeat(this.config.licenseKey, buildAnalyticsContext(this.config)).catch(function(error) {
|
|
2106
2174
|
if (_this.debug) {
|
|
2107
2175
|
console.warn("[StormcloudVideoPlayer] Failed to send heartbeat:", error);
|
|
2108
2176
|
}
|