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
|
@@ -8,6 +8,7 @@ declare class AdConfigManager {
|
|
|
8
8
|
apiVastTagUrl: string | undefined;
|
|
9
9
|
apiNumberAds: number | undefined;
|
|
10
10
|
readonly streamCorrelator: string;
|
|
11
|
+
readonly viewCorrelator: string;
|
|
11
12
|
consentSignals: VastConsentSignals;
|
|
12
13
|
podCounter: number;
|
|
13
14
|
podAssignedByPrefetch: boolean;
|
|
@@ -1897,38 +1897,108 @@ function getOrCreateStoredUuid(storageKey) {
|
|
|
1897
1897
|
if (typeof window === "undefined") {
|
|
1898
1898
|
return void 0;
|
|
1899
1899
|
}
|
|
1900
|
-
var existing =
|
|
1900
|
+
var existing = readPersistentId(storageKey);
|
|
1901
1901
|
if (existing) {
|
|
1902
|
+
writePersistentId(storageKey, existing);
|
|
1902
1903
|
return existing;
|
|
1903
1904
|
}
|
|
1904
1905
|
var id = createUuid();
|
|
1905
|
-
|
|
1906
|
-
var _window_localStorage;
|
|
1907
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, id);
|
|
1908
|
-
} catch (unused) {}
|
|
1906
|
+
writePersistentId(storageKey, id);
|
|
1909
1907
|
return id;
|
|
1910
1908
|
}
|
|
1911
1909
|
function getOrCreateCtvSessionId() {
|
|
1912
|
-
var existing =
|
|
1910
|
+
var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
|
|
1913
1911
|
if (existing) {
|
|
1912
|
+
writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
|
|
1914
1913
|
return existing;
|
|
1915
1914
|
}
|
|
1916
1915
|
var sessionId = createUuid();
|
|
1916
|
+
writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
1917
|
+
return sessionId;
|
|
1918
|
+
}
|
|
1919
|
+
function readPersistentId(storageKey) {
|
|
1920
|
+
return readStoredString(storageKey) || readCookie(storageKey);
|
|
1921
|
+
}
|
|
1922
|
+
function writePersistentId(storageKey, value) {
|
|
1917
1923
|
try {
|
|
1918
1924
|
var _window_localStorage;
|
|
1919
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(
|
|
1925
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, value);
|
|
1926
|
+
} catch (unused) {}
|
|
1927
|
+
writeCookie(storageKey, value);
|
|
1928
|
+
}
|
|
1929
|
+
var PERSISTENT_ID_COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5;
|
|
1930
|
+
function readCookie(name) {
|
|
1931
|
+
if (typeof document === "undefined") {
|
|
1932
|
+
return void 0;
|
|
1933
|
+
}
|
|
1934
|
+
try {
|
|
1935
|
+
var prefix = encodeURIComponent(name) + "=";
|
|
1936
|
+
var parts = document.cookie ? document.cookie.split(";") : [];
|
|
1937
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1938
|
+
try {
|
|
1939
|
+
for(var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1940
|
+
var part = _step.value;
|
|
1941
|
+
var entry = part.trim();
|
|
1942
|
+
if (entry.startsWith(prefix)) {
|
|
1943
|
+
return decodeURIComponent(entry.slice(prefix.length)) || void 0;
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
} catch (err) {
|
|
1947
|
+
_didIteratorError = true;
|
|
1948
|
+
_iteratorError = err;
|
|
1949
|
+
} finally{
|
|
1950
|
+
try {
|
|
1951
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1952
|
+
_iterator.return();
|
|
1953
|
+
}
|
|
1954
|
+
} finally{
|
|
1955
|
+
if (_didIteratorError) {
|
|
1956
|
+
throw _iteratorError;
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
} catch (unused) {}
|
|
1961
|
+
return void 0;
|
|
1962
|
+
}
|
|
1963
|
+
function writeCookie(name, value) {
|
|
1964
|
+
if (typeof document === "undefined") {
|
|
1965
|
+
return;
|
|
1966
|
+
}
|
|
1967
|
+
try {
|
|
1968
|
+
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
|
|
1920
1969
|
} catch (unused) {}
|
|
1921
|
-
return sessionId;
|
|
1922
1970
|
}
|
|
1923
1971
|
function createUuid() {
|
|
1972
|
+
var _bytes_, _bytes_1;
|
|
1924
1973
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
1925
1974
|
return crypto.randomUUID();
|
|
1926
1975
|
}
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1976
|
+
var bytes = new Uint8Array(16);
|
|
1977
|
+
if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
|
|
1978
|
+
crypto.getRandomValues(bytes);
|
|
1979
|
+
} else {
|
|
1980
|
+
var seed = Date.now() ^ Math.floor(performanceNow() * 1e3);
|
|
1981
|
+
for(var i = 0; i < 16; i++){
|
|
1982
|
+
seed = seed * 1103515245 + 12345 & 2147483647;
|
|
1983
|
+
bytes[i] = (seed ^ Math.floor(Math.random() * 256)) & 255;
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
|
|
1987
|
+
bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
|
|
1988
|
+
var hex = "";
|
|
1989
|
+
for(var i1 = 0; i1 < 16; i1++){
|
|
1990
|
+
var _bytes_i;
|
|
1991
|
+
hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
|
|
1992
|
+
}
|
|
1993
|
+
return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20, 32);
|
|
1994
|
+
}
|
|
1995
|
+
function performanceNow() {
|
|
1996
|
+
try {
|
|
1997
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
1998
|
+
return performance.now();
|
|
1999
|
+
}
|
|
2000
|
+
} catch (unused) {}
|
|
2001
|
+
return 0;
|
|
1932
2002
|
}
|
|
1933
2003
|
function readPlatformNativeDeviceId() {
|
|
1934
2004
|
if (typeof window === "undefined") return {};
|
|
@@ -4696,6 +4766,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
4696
4766
|
this.vmapBreaks = [];
|
|
4697
4767
|
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
4698
4768
|
this.streamCorrelator = generateCorrelator();
|
|
4769
|
+
this.viewCorrelator = generateCorrelator();
|
|
4699
4770
|
this.consentSignals = {};
|
|
4700
4771
|
this.podCounter = 0;
|
|
4701
4772
|
this.podAssignedByPrefetch = false;
|
|
@@ -5131,7 +5202,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5131
5202
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5132
5203
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
5133
5204
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5134
|
-
correlator:
|
|
5205
|
+
correlator: this.viewCorrelator,
|
|
5135
5206
|
streamCorrelator: this.streamCorrelator,
|
|
5136
5207
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5137
5208
|
adPosition: this.adRequestPositionInBreak,
|
|
@@ -5177,7 +5248,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5177
5248
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5178
5249
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
5179
5250
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5180
|
-
correlator:
|
|
5251
|
+
correlator: this.viewCorrelator,
|
|
5181
5252
|
streamCorrelator: this.streamCorrelator,
|
|
5182
5253
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5183
5254
|
podMaxAds: podParams.maxAds,
|
|
@@ -7028,7 +7099,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
7028
7099
|
// IMA event listeners
|
|
7029
7100
|
// ───────────────────────────────────────────────────────────────
|
|
7030
7101
|
function get() {
|
|
7031
|
-
return
|
|
7102
|
+
return this.host.config.optimizedPods !== false;
|
|
7032
7103
|
}
|
|
7033
7104
|
},
|
|
7034
7105
|
{
|
|
@@ -9168,7 +9239,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9168
9239
|
}
|
|
9169
9240
|
this.adConfig.beginNewAdPod();
|
|
9170
9241
|
this.adConfig.podAssignedByPrefetch = true;
|
|
9171
|
-
var optimizedPods =
|
|
9242
|
+
var optimizedPods = this.config.optimizedPods !== false;
|
|
9172
9243
|
var breakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0;
|
|
9173
9244
|
var generatedUrls = optimizedPods ? [
|
|
9174
9245
|
this.generatePodVastUrl(baseVastUrl, breakDurationMs)
|