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
package/lib/players/index.cjs
CHANGED
|
@@ -1984,38 +1984,108 @@ function getOrCreateStoredUuid(storageKey) {
|
|
|
1984
1984
|
if (typeof window === "undefined") {
|
|
1985
1985
|
return void 0;
|
|
1986
1986
|
}
|
|
1987
|
-
var existing =
|
|
1987
|
+
var existing = readPersistentId(storageKey);
|
|
1988
1988
|
if (existing) {
|
|
1989
|
+
writePersistentId(storageKey, existing);
|
|
1989
1990
|
return existing;
|
|
1990
1991
|
}
|
|
1991
1992
|
var id = createUuid();
|
|
1992
|
-
|
|
1993
|
-
var _window_localStorage;
|
|
1994
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, id);
|
|
1995
|
-
} catch (unused) {}
|
|
1993
|
+
writePersistentId(storageKey, id);
|
|
1996
1994
|
return id;
|
|
1997
1995
|
}
|
|
1998
1996
|
function getOrCreateCtvSessionId() {
|
|
1999
|
-
var existing =
|
|
1997
|
+
var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
|
|
2000
1998
|
if (existing) {
|
|
1999
|
+
writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
|
|
2001
2000
|
return existing;
|
|
2002
2001
|
}
|
|
2003
2002
|
var sessionId = createUuid();
|
|
2003
|
+
writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
2004
|
+
return sessionId;
|
|
2005
|
+
}
|
|
2006
|
+
function readPersistentId(storageKey) {
|
|
2007
|
+
return readStoredString(storageKey) || readCookie(storageKey);
|
|
2008
|
+
}
|
|
2009
|
+
function writePersistentId(storageKey, value) {
|
|
2004
2010
|
try {
|
|
2005
2011
|
var _window_localStorage;
|
|
2006
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(
|
|
2012
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, value);
|
|
2013
|
+
} catch (unused) {}
|
|
2014
|
+
writeCookie(storageKey, value);
|
|
2015
|
+
}
|
|
2016
|
+
var PERSISTENT_ID_COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5;
|
|
2017
|
+
function readCookie(name) {
|
|
2018
|
+
if (typeof document === "undefined") {
|
|
2019
|
+
return void 0;
|
|
2020
|
+
}
|
|
2021
|
+
try {
|
|
2022
|
+
var prefix = encodeURIComponent(name) + "=";
|
|
2023
|
+
var parts = document.cookie ? document.cookie.split(";") : [];
|
|
2024
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2025
|
+
try {
|
|
2026
|
+
for(var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2027
|
+
var part = _step.value;
|
|
2028
|
+
var entry = part.trim();
|
|
2029
|
+
if (entry.startsWith(prefix)) {
|
|
2030
|
+
return decodeURIComponent(entry.slice(prefix.length)) || void 0;
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
} catch (err) {
|
|
2034
|
+
_didIteratorError = true;
|
|
2035
|
+
_iteratorError = err;
|
|
2036
|
+
} finally{
|
|
2037
|
+
try {
|
|
2038
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2039
|
+
_iterator.return();
|
|
2040
|
+
}
|
|
2041
|
+
} finally{
|
|
2042
|
+
if (_didIteratorError) {
|
|
2043
|
+
throw _iteratorError;
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
} catch (unused) {}
|
|
2048
|
+
return void 0;
|
|
2049
|
+
}
|
|
2050
|
+
function writeCookie(name, value) {
|
|
2051
|
+
if (typeof document === "undefined") {
|
|
2052
|
+
return;
|
|
2053
|
+
}
|
|
2054
|
+
try {
|
|
2055
|
+
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
|
|
2007
2056
|
} catch (unused) {}
|
|
2008
|
-
return sessionId;
|
|
2009
2057
|
}
|
|
2010
2058
|
function createUuid() {
|
|
2059
|
+
var _bytes_, _bytes_1;
|
|
2011
2060
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
2012
2061
|
return crypto.randomUUID();
|
|
2013
2062
|
}
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2063
|
+
var bytes = new Uint8Array(16);
|
|
2064
|
+
if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
|
|
2065
|
+
crypto.getRandomValues(bytes);
|
|
2066
|
+
} else {
|
|
2067
|
+
var seed = Date.now() ^ Math.floor(performanceNow() * 1e3);
|
|
2068
|
+
for(var i = 0; i < 16; i++){
|
|
2069
|
+
seed = seed * 1103515245 + 12345 & 2147483647;
|
|
2070
|
+
bytes[i] = (seed ^ Math.floor(Math.random() * 256)) & 255;
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
|
|
2074
|
+
bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
|
|
2075
|
+
var hex = "";
|
|
2076
|
+
for(var i1 = 0; i1 < 16; i1++){
|
|
2077
|
+
var _bytes_i;
|
|
2078
|
+
hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
|
|
2079
|
+
}
|
|
2080
|
+
return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20, 32);
|
|
2081
|
+
}
|
|
2082
|
+
function performanceNow() {
|
|
2083
|
+
try {
|
|
2084
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
2085
|
+
return performance.now();
|
|
2086
|
+
}
|
|
2087
|
+
} catch (unused) {}
|
|
2088
|
+
return 0;
|
|
2019
2089
|
}
|
|
2020
2090
|
function readPlatformNativeDeviceId() {
|
|
2021
2091
|
if (typeof window === "undefined") return {};
|
|
@@ -4783,6 +4853,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
4783
4853
|
this.vmapBreaks = [];
|
|
4784
4854
|
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
4785
4855
|
this.streamCorrelator = generateCorrelator();
|
|
4856
|
+
this.viewCorrelator = generateCorrelator();
|
|
4786
4857
|
this.consentSignals = {};
|
|
4787
4858
|
this.podCounter = 0;
|
|
4788
4859
|
this.podAssignedByPrefetch = false;
|
|
@@ -5218,7 +5289,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5218
5289
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5219
5290
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
5220
5291
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5221
|
-
correlator:
|
|
5292
|
+
correlator: this.viewCorrelator,
|
|
5222
5293
|
streamCorrelator: this.streamCorrelator,
|
|
5223
5294
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5224
5295
|
adPosition: this.adRequestPositionInBreak,
|
|
@@ -5264,7 +5335,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5264
5335
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5265
5336
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
5266
5337
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5267
|
-
correlator:
|
|
5338
|
+
correlator: this.viewCorrelator,
|
|
5268
5339
|
streamCorrelator: this.streamCorrelator,
|
|
5269
5340
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5270
5341
|
podMaxAds: podParams.maxAds,
|
|
@@ -7115,7 +7186,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
7115
7186
|
// IMA event listeners
|
|
7116
7187
|
// ───────────────────────────────────────────────────────────────
|
|
7117
7188
|
function get() {
|
|
7118
|
-
return
|
|
7189
|
+
return this.host.config.optimizedPods !== false;
|
|
7119
7190
|
}
|
|
7120
7191
|
},
|
|
7121
7192
|
{
|
|
@@ -9255,7 +9326,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9255
9326
|
}
|
|
9256
9327
|
this.adConfig.beginNewAdPod();
|
|
9257
9328
|
this.adConfig.podAssignedByPrefetch = true;
|
|
9258
|
-
var optimizedPods =
|
|
9329
|
+
var optimizedPods = this.config.optimizedPods !== false;
|
|
9259
9330
|
var breakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0;
|
|
9260
9331
|
var generatedUrls = optimizedPods ? [
|
|
9261
9332
|
this.generatePodVastUrl(baseVastUrl, breakDurationMs)
|