stormcloud-video-player 0.8.26 → 0.8.28
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 +88 -17
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +88 -17
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +81 -9
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdConfigManager.cjs +86 -15
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdConfigManager.d.cts +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +88 -17
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +88 -17
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +88 -17
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +88 -17
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/ctvVastSignals.cjs +80 -8
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/tracking.cjs +80 -8
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.cjs +83 -13
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
- package/lib/utils/vastMacros.cjs +1 -0
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -441,38 +441,108 @@ function getOrCreateStoredUuid(storageKey) {
|
|
|
441
441
|
if (typeof window === "undefined") {
|
|
442
442
|
return void 0;
|
|
443
443
|
}
|
|
444
|
-
var existing =
|
|
444
|
+
var existing = readPersistentId(storageKey);
|
|
445
445
|
if (existing) {
|
|
446
|
+
writePersistentId(storageKey, existing);
|
|
446
447
|
return existing;
|
|
447
448
|
}
|
|
448
449
|
var id = createUuid();
|
|
449
|
-
|
|
450
|
-
var _window_localStorage;
|
|
451
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, id);
|
|
452
|
-
} catch (unused) {}
|
|
450
|
+
writePersistentId(storageKey, id);
|
|
453
451
|
return id;
|
|
454
452
|
}
|
|
455
453
|
function getOrCreateCtvSessionId() {
|
|
456
|
-
var existing =
|
|
454
|
+
var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
|
|
457
455
|
if (existing) {
|
|
456
|
+
writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
|
|
458
457
|
return existing;
|
|
459
458
|
}
|
|
460
459
|
var sessionId = createUuid();
|
|
460
|
+
writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
461
|
+
return sessionId;
|
|
462
|
+
}
|
|
463
|
+
function readPersistentId(storageKey) {
|
|
464
|
+
return readStoredString(storageKey) || readCookie(storageKey);
|
|
465
|
+
}
|
|
466
|
+
function writePersistentId(storageKey, value) {
|
|
461
467
|
try {
|
|
462
468
|
var _window_localStorage;
|
|
463
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(
|
|
469
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, value);
|
|
470
|
+
} catch (unused) {}
|
|
471
|
+
writeCookie(storageKey, value);
|
|
472
|
+
}
|
|
473
|
+
var PERSISTENT_ID_COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5;
|
|
474
|
+
function readCookie(name) {
|
|
475
|
+
if (typeof document === "undefined") {
|
|
476
|
+
return void 0;
|
|
477
|
+
}
|
|
478
|
+
try {
|
|
479
|
+
var prefix = encodeURIComponent(name) + "=";
|
|
480
|
+
var parts = document.cookie ? document.cookie.split(";") : [];
|
|
481
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
482
|
+
try {
|
|
483
|
+
for(var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
484
|
+
var part = _step.value;
|
|
485
|
+
var entry = part.trim();
|
|
486
|
+
if (entry.startsWith(prefix)) {
|
|
487
|
+
return decodeURIComponent(entry.slice(prefix.length)) || void 0;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
} catch (err) {
|
|
491
|
+
_didIteratorError = true;
|
|
492
|
+
_iteratorError = err;
|
|
493
|
+
} finally{
|
|
494
|
+
try {
|
|
495
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
496
|
+
_iterator.return();
|
|
497
|
+
}
|
|
498
|
+
} finally{
|
|
499
|
+
if (_didIteratorError) {
|
|
500
|
+
throw _iteratorError;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
} catch (unused) {}
|
|
505
|
+
return void 0;
|
|
506
|
+
}
|
|
507
|
+
function writeCookie(name, value) {
|
|
508
|
+
if (typeof document === "undefined") {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
try {
|
|
512
|
+
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
|
|
464
513
|
} catch (unused) {}
|
|
465
|
-
return sessionId;
|
|
466
514
|
}
|
|
467
515
|
function createUuid() {
|
|
516
|
+
var _bytes_, _bytes_1;
|
|
468
517
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
469
518
|
return crypto.randomUUID();
|
|
470
519
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
520
|
+
var bytes = new Uint8Array(16);
|
|
521
|
+
if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
|
|
522
|
+
crypto.getRandomValues(bytes);
|
|
523
|
+
} else {
|
|
524
|
+
var seed = Date.now() ^ Math.floor(performanceNow() * 1e3);
|
|
525
|
+
for(var i = 0; i < 16; i++){
|
|
526
|
+
seed = seed * 1103515245 + 12345 & 2147483647;
|
|
527
|
+
bytes[i] = (seed ^ Math.floor(Math.random() * 256)) & 255;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
|
|
531
|
+
bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
|
|
532
|
+
var hex = "";
|
|
533
|
+
for(var i1 = 0; i1 < 16; i1++){
|
|
534
|
+
var _bytes_i;
|
|
535
|
+
hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
|
|
536
|
+
}
|
|
537
|
+
return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20, 32);
|
|
538
|
+
}
|
|
539
|
+
function performanceNow() {
|
|
540
|
+
try {
|
|
541
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
542
|
+
return performance.now();
|
|
543
|
+
}
|
|
544
|
+
} catch (unused) {}
|
|
545
|
+
return 0;
|
|
476
546
|
}
|
|
477
547
|
function readPlatformNativeDeviceId() {
|
|
478
548
|
if (typeof window === "undefined") return {};
|
|
@@ -1697,6 +1767,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
1697
1767
|
this.vmapBreaks = [];
|
|
1698
1768
|
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
1699
1769
|
this.streamCorrelator = generateCorrelator();
|
|
1770
|
+
this.viewCorrelator = generateCorrelator();
|
|
1700
1771
|
this.consentSignals = {};
|
|
1701
1772
|
this.podCounter = 0;
|
|
1702
1773
|
this.podAssignedByPrefetch = false;
|
|
@@ -2132,7 +2203,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
2132
2203
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
2133
2204
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
2134
2205
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
2135
|
-
correlator:
|
|
2206
|
+
correlator: this.viewCorrelator,
|
|
2136
2207
|
streamCorrelator: this.streamCorrelator,
|
|
2137
2208
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
2138
2209
|
adPosition: this.adRequestPositionInBreak,
|
|
@@ -2178,7 +2249,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
2178
2249
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
2179
2250
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
2180
2251
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
2181
|
-
correlator:
|
|
2252
|
+
correlator: this.viewCorrelator,
|
|
2182
2253
|
streamCorrelator: this.streamCorrelator,
|
|
2183
2254
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
2184
2255
|
podMaxAds: podParams.maxAds,
|