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/index.js
CHANGED
|
@@ -1942,38 +1942,108 @@ function getOrCreateStoredUuid(storageKey) {
|
|
|
1942
1942
|
if (typeof window === "undefined") {
|
|
1943
1943
|
return void 0;
|
|
1944
1944
|
}
|
|
1945
|
-
var existing =
|
|
1945
|
+
var existing = readPersistentId(storageKey);
|
|
1946
1946
|
if (existing) {
|
|
1947
|
+
writePersistentId(storageKey, existing);
|
|
1947
1948
|
return existing;
|
|
1948
1949
|
}
|
|
1949
1950
|
var id = createUuid();
|
|
1950
|
-
|
|
1951
|
-
var _window_localStorage;
|
|
1952
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, id);
|
|
1953
|
-
} catch (unused) {}
|
|
1951
|
+
writePersistentId(storageKey, id);
|
|
1954
1952
|
return id;
|
|
1955
1953
|
}
|
|
1956
1954
|
function getOrCreateCtvSessionId() {
|
|
1957
|
-
var existing =
|
|
1955
|
+
var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
|
|
1958
1956
|
if (existing) {
|
|
1957
|
+
writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
|
|
1959
1958
|
return existing;
|
|
1960
1959
|
}
|
|
1961
1960
|
var sessionId = createUuid();
|
|
1961
|
+
writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
1962
|
+
return sessionId;
|
|
1963
|
+
}
|
|
1964
|
+
function readPersistentId(storageKey) {
|
|
1965
|
+
return readStoredString(storageKey) || readCookie(storageKey);
|
|
1966
|
+
}
|
|
1967
|
+
function writePersistentId(storageKey, value) {
|
|
1962
1968
|
try {
|
|
1963
1969
|
var _window_localStorage;
|
|
1964
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(
|
|
1970
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, value);
|
|
1971
|
+
} catch (unused) {}
|
|
1972
|
+
writeCookie(storageKey, value);
|
|
1973
|
+
}
|
|
1974
|
+
var PERSISTENT_ID_COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5;
|
|
1975
|
+
function readCookie(name) {
|
|
1976
|
+
if (typeof document === "undefined") {
|
|
1977
|
+
return void 0;
|
|
1978
|
+
}
|
|
1979
|
+
try {
|
|
1980
|
+
var prefix = encodeURIComponent(name) + "=";
|
|
1981
|
+
var parts = document.cookie ? document.cookie.split(";") : [];
|
|
1982
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1983
|
+
try {
|
|
1984
|
+
for(var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1985
|
+
var part = _step.value;
|
|
1986
|
+
var entry = part.trim();
|
|
1987
|
+
if (entry.startsWith(prefix)) {
|
|
1988
|
+
return decodeURIComponent(entry.slice(prefix.length)) || void 0;
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
} catch (err) {
|
|
1992
|
+
_didIteratorError = true;
|
|
1993
|
+
_iteratorError = err;
|
|
1994
|
+
} finally{
|
|
1995
|
+
try {
|
|
1996
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1997
|
+
_iterator.return();
|
|
1998
|
+
}
|
|
1999
|
+
} finally{
|
|
2000
|
+
if (_didIteratorError) {
|
|
2001
|
+
throw _iteratorError;
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
} catch (unused) {}
|
|
2006
|
+
return void 0;
|
|
2007
|
+
}
|
|
2008
|
+
function writeCookie(name, value) {
|
|
2009
|
+
if (typeof document === "undefined") {
|
|
2010
|
+
return;
|
|
2011
|
+
}
|
|
2012
|
+
try {
|
|
2013
|
+
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
|
|
1965
2014
|
} catch (unused) {}
|
|
1966
|
-
return sessionId;
|
|
1967
2015
|
}
|
|
1968
2016
|
function createUuid() {
|
|
2017
|
+
var _bytes_, _bytes_1;
|
|
1969
2018
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
1970
2019
|
return crypto.randomUUID();
|
|
1971
2020
|
}
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
2021
|
+
var bytes = new Uint8Array(16);
|
|
2022
|
+
if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
|
|
2023
|
+
crypto.getRandomValues(bytes);
|
|
2024
|
+
} else {
|
|
2025
|
+
var seed = Date.now() ^ Math.floor(performanceNow() * 1e3);
|
|
2026
|
+
for(var i = 0; i < 16; i++){
|
|
2027
|
+
seed = seed * 1103515245 + 12345 & 2147483647;
|
|
2028
|
+
bytes[i] = (seed ^ Math.floor(Math.random() * 256)) & 255;
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
|
|
2032
|
+
bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
|
|
2033
|
+
var hex = "";
|
|
2034
|
+
for(var i1 = 0; i1 < 16; i1++){
|
|
2035
|
+
var _bytes_i;
|
|
2036
|
+
hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
|
|
2037
|
+
}
|
|
2038
|
+
return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20, 32);
|
|
2039
|
+
}
|
|
2040
|
+
function performanceNow() {
|
|
2041
|
+
try {
|
|
2042
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
2043
|
+
return performance.now();
|
|
2044
|
+
}
|
|
2045
|
+
} catch (unused) {}
|
|
2046
|
+
return 0;
|
|
1977
2047
|
}
|
|
1978
2048
|
function readPlatformNativeDeviceId() {
|
|
1979
2049
|
if (typeof window === "undefined") return {};
|
|
@@ -4769,6 +4839,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
4769
4839
|
this.vmapBreaks = [];
|
|
4770
4840
|
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
4771
4841
|
this.streamCorrelator = generateCorrelator();
|
|
4842
|
+
this.viewCorrelator = generateCorrelator();
|
|
4772
4843
|
this.consentSignals = {};
|
|
4773
4844
|
this.podCounter = 0;
|
|
4774
4845
|
this.podAssignedByPrefetch = false;
|
|
@@ -5204,7 +5275,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5204
5275
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5205
5276
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
5206
5277
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5207
|
-
correlator:
|
|
5278
|
+
correlator: this.viewCorrelator,
|
|
5208
5279
|
streamCorrelator: this.streamCorrelator,
|
|
5209
5280
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5210
5281
|
adPosition: this.adRequestPositionInBreak,
|
|
@@ -5250,7 +5321,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5250
5321
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5251
5322
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
5252
5323
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5253
|
-
correlator:
|
|
5324
|
+
correlator: this.viewCorrelator,
|
|
5254
5325
|
streamCorrelator: this.streamCorrelator,
|
|
5255
5326
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5256
5327
|
podMaxAds: podParams.maxAds,
|
|
@@ -7106,7 +7177,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
7106
7177
|
// IMA event listeners
|
|
7107
7178
|
// ───────────────────────────────────────────────────────────────
|
|
7108
7179
|
function get() {
|
|
7109
|
-
return
|
|
7180
|
+
return this.host.config.optimizedPods !== false;
|
|
7110
7181
|
}
|
|
7111
7182
|
},
|
|
7112
7183
|
{
|
|
@@ -9247,7 +9318,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9247
9318
|
}
|
|
9248
9319
|
this.adConfig.beginNewAdPod();
|
|
9249
9320
|
this.adConfig.podAssignedByPrefetch = true;
|
|
9250
|
-
var optimizedPods =
|
|
9321
|
+
var optimizedPods = this.config.optimizedPods !== false;
|
|
9251
9322
|
var breakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0;
|
|
9252
9323
|
var generatedUrls = optimizedPods ? [
|
|
9253
9324
|
this.generatePodVastUrl(baseVastUrl, breakDurationMs)
|