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.cjs
CHANGED
|
@@ -2159,38 +2159,108 @@ function getOrCreateStoredUuid(storageKey) {
|
|
|
2159
2159
|
if (typeof window === "undefined") {
|
|
2160
2160
|
return void 0;
|
|
2161
2161
|
}
|
|
2162
|
-
var existing =
|
|
2162
|
+
var existing = readPersistentId(storageKey);
|
|
2163
2163
|
if (existing) {
|
|
2164
|
+
writePersistentId(storageKey, existing);
|
|
2164
2165
|
return existing;
|
|
2165
2166
|
}
|
|
2166
2167
|
var id = createUuid();
|
|
2167
|
-
|
|
2168
|
-
var _window_localStorage;
|
|
2169
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, id);
|
|
2170
|
-
} catch (unused) {}
|
|
2168
|
+
writePersistentId(storageKey, id);
|
|
2171
2169
|
return id;
|
|
2172
2170
|
}
|
|
2173
2171
|
function getOrCreateCtvSessionId() {
|
|
2174
|
-
var existing =
|
|
2172
|
+
var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
|
|
2175
2173
|
if (existing) {
|
|
2174
|
+
writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
|
|
2176
2175
|
return existing;
|
|
2177
2176
|
}
|
|
2178
2177
|
var sessionId = createUuid();
|
|
2178
|
+
writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
|
|
2179
|
+
return sessionId;
|
|
2180
|
+
}
|
|
2181
|
+
function readPersistentId(storageKey) {
|
|
2182
|
+
return readStoredString(storageKey) || readCookie(storageKey);
|
|
2183
|
+
}
|
|
2184
|
+
function writePersistentId(storageKey, value) {
|
|
2179
2185
|
try {
|
|
2180
2186
|
var _window_localStorage;
|
|
2181
|
-
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(
|
|
2187
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(storageKey, value);
|
|
2188
|
+
} catch (unused) {}
|
|
2189
|
+
writeCookie(storageKey, value);
|
|
2190
|
+
}
|
|
2191
|
+
var PERSISTENT_ID_COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5;
|
|
2192
|
+
function readCookie(name) {
|
|
2193
|
+
if (typeof document === "undefined") {
|
|
2194
|
+
return void 0;
|
|
2195
|
+
}
|
|
2196
|
+
try {
|
|
2197
|
+
var prefix = encodeURIComponent(name) + "=";
|
|
2198
|
+
var parts = document.cookie ? document.cookie.split(";") : [];
|
|
2199
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2200
|
+
try {
|
|
2201
|
+
for(var _iterator = parts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2202
|
+
var part = _step.value;
|
|
2203
|
+
var entry = part.trim();
|
|
2204
|
+
if (entry.startsWith(prefix)) {
|
|
2205
|
+
return decodeURIComponent(entry.slice(prefix.length)) || void 0;
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
} catch (err) {
|
|
2209
|
+
_didIteratorError = true;
|
|
2210
|
+
_iteratorError = err;
|
|
2211
|
+
} finally{
|
|
2212
|
+
try {
|
|
2213
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2214
|
+
_iterator.return();
|
|
2215
|
+
}
|
|
2216
|
+
} finally{
|
|
2217
|
+
if (_didIteratorError) {
|
|
2218
|
+
throw _iteratorError;
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
} catch (unused) {}
|
|
2223
|
+
return void 0;
|
|
2224
|
+
}
|
|
2225
|
+
function writeCookie(name, value) {
|
|
2226
|
+
if (typeof document === "undefined") {
|
|
2227
|
+
return;
|
|
2228
|
+
}
|
|
2229
|
+
try {
|
|
2230
|
+
document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
|
|
2182
2231
|
} catch (unused) {}
|
|
2183
|
-
return sessionId;
|
|
2184
2232
|
}
|
|
2185
2233
|
function createUuid() {
|
|
2234
|
+
var _bytes_, _bytes_1;
|
|
2186
2235
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
2187
2236
|
return crypto.randomUUID();
|
|
2188
2237
|
}
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2238
|
+
var bytes = new Uint8Array(16);
|
|
2239
|
+
if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
|
|
2240
|
+
crypto.getRandomValues(bytes);
|
|
2241
|
+
} else {
|
|
2242
|
+
var seed = Date.now() ^ Math.floor(performanceNow() * 1e3);
|
|
2243
|
+
for(var i = 0; i < 16; i++){
|
|
2244
|
+
seed = seed * 1103515245 + 12345 & 2147483647;
|
|
2245
|
+
bytes[i] = (seed ^ Math.floor(Math.random() * 256)) & 255;
|
|
2246
|
+
}
|
|
2247
|
+
}
|
|
2248
|
+
bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
|
|
2249
|
+
bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
|
|
2250
|
+
var hex = "";
|
|
2251
|
+
for(var i1 = 0; i1 < 16; i1++){
|
|
2252
|
+
var _bytes_i;
|
|
2253
|
+
hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
|
|
2254
|
+
}
|
|
2255
|
+
return hex.slice(0, 8) + "-" + hex.slice(8, 12) + "-" + hex.slice(12, 16) + "-" + hex.slice(16, 20) + "-" + hex.slice(20, 32);
|
|
2256
|
+
}
|
|
2257
|
+
function performanceNow() {
|
|
2258
|
+
try {
|
|
2259
|
+
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
2260
|
+
return performance.now();
|
|
2261
|
+
}
|
|
2262
|
+
} catch (unused) {}
|
|
2263
|
+
return 0;
|
|
2194
2264
|
}
|
|
2195
2265
|
function readPlatformNativeDeviceId() {
|
|
2196
2266
|
if (typeof window === "undefined") return {};
|
|
@@ -4981,6 +5051,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
4981
5051
|
this.vmapBreaks = [];
|
|
4982
5052
|
this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
|
|
4983
5053
|
this.streamCorrelator = generateCorrelator();
|
|
5054
|
+
this.viewCorrelator = generateCorrelator();
|
|
4984
5055
|
this.consentSignals = {};
|
|
4985
5056
|
this.podCounter = 0;
|
|
4986
5057
|
this.podAssignedByPrefetch = false;
|
|
@@ -5416,7 +5487,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5416
5487
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5417
5488
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
5418
5489
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5419
|
-
correlator:
|
|
5490
|
+
correlator: this.viewCorrelator,
|
|
5420
5491
|
streamCorrelator: this.streamCorrelator,
|
|
5421
5492
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5422
5493
|
adPosition: this.adRequestPositionInBreak,
|
|
@@ -5462,7 +5533,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5462
5533
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
5463
5534
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
|
|
5464
5535
|
var urlWithMacros = applyVastMacros(baseUrl, {
|
|
5465
|
-
correlator:
|
|
5536
|
+
correlator: this.viewCorrelator,
|
|
5466
5537
|
streamCorrelator: this.streamCorrelator,
|
|
5467
5538
|
pod: this.podCounter > 0 ? this.podCounter : void 0,
|
|
5468
5539
|
podMaxAds: podParams.maxAds,
|
|
@@ -7313,7 +7384,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
7313
7384
|
// IMA event listeners
|
|
7314
7385
|
// ───────────────────────────────────────────────────────────────
|
|
7315
7386
|
function get() {
|
|
7316
|
-
return
|
|
7387
|
+
return this.host.config.optimizedPods !== false;
|
|
7317
7388
|
}
|
|
7318
7389
|
},
|
|
7319
7390
|
{
|
|
@@ -9453,7 +9524,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9453
9524
|
}
|
|
9454
9525
|
this.adConfig.beginNewAdPod();
|
|
9455
9526
|
this.adConfig.podAssignedByPrefetch = true;
|
|
9456
|
-
var optimizedPods =
|
|
9527
|
+
var optimizedPods = this.config.optimizedPods !== false;
|
|
9457
9528
|
var breakDurationMs = marker.durationSeconds != null ? marker.durationSeconds * 1e3 : void 0;
|
|
9458
9529
|
var generatedUrls = optimizedPods ? [
|
|
9459
9530
|
this.generatePodVastUrl(baseVastUrl, breakDurationMs)
|