stormcloud-video-player 0.8.82 → 0.8.83
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/StormcloudPlayer.cjs +66 -3
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/index.cjs +66 -3
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +66 -3
- package/lib/index.js.map +1 -1
- package/lib/player/AdConfigManager.cjs +47 -1
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +66 -3
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +2 -0
- package/lib/players/HlsPlayer.cjs +66 -3
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +66 -3
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +66 -3
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/__tests__/adSignals.test.cjs +24 -1
- package/lib/utils/__tests__/adSignals.test.cjs.map +1 -1
- package/lib/utils/adIdentity.cjs +34 -1
- package/lib/utils/adIdentity.cjs.map +1 -1
- package/lib/utils/adIdentity.d.cts +2 -1
- package/lib/utils/partnerSignals.cjs +10 -1
- package/lib/utils/partnerSignals.cjs.map +1 -1
- package/lib/utils/partnerSignals.d.cts +2 -1
- package/lib/utils/vastMacros.cjs +1 -0
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastMacros.d.cts +1 -0
- package/package.json +1 -1
package/lib/StormcloudPlayer.cjs
CHANGED
|
@@ -434,6 +434,9 @@ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
|
|
|
434
434
|
var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
|
|
435
435
|
var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
|
|
436
436
|
var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
|
|
437
|
+
var STAY_ID_KEY = "stormcloud.ad.stay.v1";
|
|
438
|
+
var HOST_ID_KEY = "stormcloud.ad.host.v1";
|
|
439
|
+
var memoryMarkers = {};
|
|
437
440
|
var ZEROED_IDS = /* @__PURE__ */ new Set([
|
|
438
441
|
"00000000-0000-0000-0000-000000000000",
|
|
439
442
|
"38400000-8cf0-11bd-b23e-10b96e40000d"
|
|
@@ -536,7 +539,7 @@ function setHostAdIdentity(identity) {
|
|
|
536
539
|
return;
|
|
537
540
|
}
|
|
538
541
|
var deviceId = identity.deviceId.trim();
|
|
539
|
-
var changed =
|
|
542
|
+
var changed = writeMarkerIfChanged(HOST_ID_KEY, deviceId);
|
|
540
543
|
hostIdentity = _object_spread({
|
|
541
544
|
deviceId: deviceId,
|
|
542
545
|
deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
@@ -555,6 +558,31 @@ function resetAdIdentity() {
|
|
|
555
558
|
removeStored(SESSION_ID_KEY);
|
|
556
559
|
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
557
560
|
}
|
|
561
|
+
function writeMarkerIfChanged(key, value) {
|
|
562
|
+
var _memoryMarkers_key;
|
|
563
|
+
var previous = (_memoryMarkers_key = memoryMarkers[key]) !== null && _memoryMarkers_key !== void 0 ? _memoryMarkers_key : "";
|
|
564
|
+
try {
|
|
565
|
+
var _window_localStorage;
|
|
566
|
+
var stored = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
|
|
567
|
+
if (typeof stored === "string") previous = stored;
|
|
568
|
+
} catch (unused) {}
|
|
569
|
+
if (value === previous) return false;
|
|
570
|
+
memoryMarkers[key] = value;
|
|
571
|
+
try {
|
|
572
|
+
if (typeof window !== "undefined") {
|
|
573
|
+
var _window_localStorage1, _window_localStorage2;
|
|
574
|
+
if (value) (_window_localStorage1 = window.localStorage) === null || _window_localStorage1 === void 0 ? void 0 : _window_localStorage1.setItem(key, value);
|
|
575
|
+
else (_window_localStorage2 = window.localStorage) === null || _window_localStorage2 === void 0 ? void 0 : _window_localStorage2.removeItem(key);
|
|
576
|
+
}
|
|
577
|
+
} catch (unused) {}
|
|
578
|
+
return true;
|
|
579
|
+
}
|
|
580
|
+
function noteStayId(stayId) {
|
|
581
|
+
if (!writeMarkerIfChanged(STAY_ID_KEY, stayId ? stayId.trim() : "")) return false;
|
|
582
|
+
removeStored(SESSION_ID_KEY);
|
|
583
|
+
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
584
|
+
return true;
|
|
585
|
+
}
|
|
558
586
|
function readSamsungTifa() {
|
|
559
587
|
try {
|
|
560
588
|
var _window_webapis;
|
|
@@ -1594,6 +1622,11 @@ function sanitizePublicIp(value) {
|
|
|
1594
1622
|
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1595
1623
|
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1596
1624
|
}
|
|
1625
|
+
var PPID_PATTERN = /^[0-9a-zA-Z+.=\/_\-$,{}]{22,150}$/;
|
|
1626
|
+
function toPpid(userId, limitAdTracking) {
|
|
1627
|
+
if (!userId || limitAdTracking === true) return void 0;
|
|
1628
|
+
return PPID_PATTERN.test(userId) ? userId : void 0;
|
|
1629
|
+
}
|
|
1597
1630
|
function resolveUserId(configValue) {
|
|
1598
1631
|
var _sanitizeUserId;
|
|
1599
1632
|
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
@@ -2002,6 +2035,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
2002
2035
|
set("UA", ctx.userAgent);
|
|
2003
2036
|
set("IP", ctx.ipAddress);
|
|
2004
2037
|
set("UID", ctx.userId);
|
|
2038
|
+
set("PPID", ctx.ppid);
|
|
2005
2039
|
set("CT-TYPE", ctx.contentType);
|
|
2006
2040
|
set("CT-CATEGORY", ctx.contentCategory);
|
|
2007
2041
|
set("CT-GENRE", ctx.contentGenre);
|
|
@@ -9602,6 +9636,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9602
9636
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9603
9637
|
var _content_contentDurationSeconds;
|
|
9604
9638
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9639
|
+
var stayUserId = resolveUserId(this.config.adUserId);
|
|
9640
|
+
noteStayId(stayUserId);
|
|
9605
9641
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9606
9642
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9607
9643
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
@@ -9612,7 +9648,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9612
9648
|
var playerSize = resolvePlayerSize(this.video);
|
|
9613
9649
|
var videoDuration = this.video.duration;
|
|
9614
9650
|
var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
|
|
9615
|
-
var userId =
|
|
9651
|
+
var userId = envSignals.limitAdTracking === true ? void 0 : stayUserId;
|
|
9652
|
+
var ppid = toPpid(stayUserId, envSignals.limitAdTracking);
|
|
9616
9653
|
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9617
9654
|
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9618
9655
|
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
@@ -9658,6 +9695,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9658
9695
|
ipAddress: ipAddress
|
|
9659
9696
|
} : {}, userId ? {
|
|
9660
9697
|
userId: userId
|
|
9698
|
+
} : {}, ppid ? {
|
|
9699
|
+
ppid: ppid
|
|
9661
9700
|
} : {}, content.contentType ? {
|
|
9662
9701
|
contentType: content.contentType
|
|
9663
9702
|
} : {}, content.contentCategory ? {
|
|
@@ -9705,6 +9744,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9705
9744
|
isLat: envSignals.limitAdTracking,
|
|
9706
9745
|
dth: envSignals.deviceTypeHint,
|
|
9707
9746
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9747
|
+
ppidTail: ppid ? ppid.slice(-4) : void 0,
|
|
9708
9748
|
ct_ch: content.channelName,
|
|
9709
9749
|
ct_ti: content.programTitle,
|
|
9710
9750
|
ct_ne: content.contentNetwork,
|
|
@@ -14172,6 +14212,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14172
14212
|
var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
|
|
14173
14213
|
_this.adConfig.consentSignals = signals;
|
|
14174
14214
|
var muted = _this.video.muted;
|
|
14215
|
+
var palPpid = _this.currentPpid();
|
|
14175
14216
|
var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
|
|
14176
14217
|
var palOptions = _object_spread({
|
|
14177
14218
|
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
@@ -14188,9 +14229,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14188
14229
|
allowStorage: signals.storageAllowed
|
|
14189
14230
|
} : {}, palSessionId ? {
|
|
14190
14231
|
sessionId: palSessionId
|
|
14232
|
+
} : {}, palPpid ? {
|
|
14233
|
+
ppid: palPpid
|
|
14191
14234
|
} : {});
|
|
14192
14235
|
_this.lastPalOptions = palOptions;
|
|
14193
14236
|
_this.palSessionId = palSessionId;
|
|
14237
|
+
_this.palPpid = palPpid;
|
|
14194
14238
|
_this.startPalNonceRefresh();
|
|
14195
14239
|
return _this.palNonce.generateNonce(palOptions);
|
|
14196
14240
|
}).catch(function() {});
|
|
@@ -14249,26 +14293,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14249
14293
|
if (!options) return;
|
|
14250
14294
|
var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
|
|
14251
14295
|
var ageMs = this.palNonce.getNonceAgeMs();
|
|
14296
|
+
var ppid = this.currentPpid();
|
|
14297
|
+
var ppidChanged = ppid !== this.palPpid;
|
|
14252
14298
|
var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
|
|
14253
14299
|
var sessionChanged = sessionId !== this.palSessionId;
|
|
14254
14300
|
var stale = ageMs === void 0 || ageMs >= maxAgeMs;
|
|
14255
|
-
if (!force && !stale && !sessionChanged) return;
|
|
14301
|
+
if (!force && !stale && !sessionChanged && !ppidChanged) return;
|
|
14256
14302
|
var next = _object_spread({}, options);
|
|
14257
14303
|
if (sessionId) next.sessionId = sessionId;
|
|
14258
14304
|
else delete next.sessionId;
|
|
14305
|
+
if (ppid) next.ppid = ppid;
|
|
14306
|
+
else delete next.ppid;
|
|
14259
14307
|
this.lastPalOptions = next;
|
|
14260
14308
|
this.palSessionId = sessionId;
|
|
14309
|
+
this.palPpid = ppid;
|
|
14261
14310
|
if (this.debug) {
|
|
14262
14311
|
console.log("[PAL] Regenerating nonce", {
|
|
14263
14312
|
force: force,
|
|
14264
14313
|
stale: stale,
|
|
14265
14314
|
sessionChanged: sessionChanged,
|
|
14315
|
+
ppidChanged: ppidChanged,
|
|
14266
14316
|
ageMs: ageMs
|
|
14267
14317
|
});
|
|
14268
14318
|
}
|
|
14269
14319
|
this.palNonce.generateNonce(next).catch(function() {});
|
|
14270
14320
|
}
|
|
14271
14321
|
},
|
|
14322
|
+
{
|
|
14323
|
+
key: "currentPpid",
|
|
14324
|
+
value: function currentPpid() {
|
|
14325
|
+
var userId = resolveUserId(this.config.adUserId);
|
|
14326
|
+
noteStayId(userId);
|
|
14327
|
+
var signals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
14328
|
+
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
14329
|
+
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
14330
|
+
});
|
|
14331
|
+
return toPpid(userId, signals.limitAdTracking);
|
|
14332
|
+
}
|
|
14333
|
+
},
|
|
14272
14334
|
{
|
|
14273
14335
|
key: "setAdIdentity",
|
|
14274
14336
|
value: function setAdIdentity(identity) {
|
|
@@ -14300,6 +14362,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14300
14362
|
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14301
14363
|
else delete this.config.clientIpAddress;
|
|
14302
14364
|
}
|
|
14365
|
+
if (signals.userId !== void 0) this.refreshPalNonceIfStale();
|
|
14303
14366
|
}
|
|
14304
14367
|
},
|
|
14305
14368
|
{
|