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
|
@@ -385,6 +385,9 @@ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
|
|
|
385
385
|
var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
|
|
386
386
|
var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
|
|
387
387
|
var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
|
|
388
|
+
var STAY_ID_KEY = "stormcloud.ad.stay.v1";
|
|
389
|
+
var HOST_ID_KEY = "stormcloud.ad.host.v1";
|
|
390
|
+
var memoryMarkers = {};
|
|
388
391
|
var ZEROED_IDS = /* @__PURE__ */ new Set([
|
|
389
392
|
"00000000-0000-0000-0000-000000000000",
|
|
390
393
|
"38400000-8cf0-11bd-b23e-10b96e40000d"
|
|
@@ -487,7 +490,7 @@ function setHostAdIdentity(identity) {
|
|
|
487
490
|
return;
|
|
488
491
|
}
|
|
489
492
|
var deviceId = identity.deviceId.trim();
|
|
490
|
-
var changed =
|
|
493
|
+
var changed = writeMarkerIfChanged(HOST_ID_KEY, deviceId);
|
|
491
494
|
hostIdentity = _object_spread({
|
|
492
495
|
deviceId: deviceId,
|
|
493
496
|
deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
@@ -506,6 +509,31 @@ function resetAdIdentity() {
|
|
|
506
509
|
removeStored(SESSION_ID_KEY);
|
|
507
510
|
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
508
511
|
}
|
|
512
|
+
function writeMarkerIfChanged(key, value) {
|
|
513
|
+
var _memoryMarkers_key;
|
|
514
|
+
var previous = (_memoryMarkers_key = memoryMarkers[key]) !== null && _memoryMarkers_key !== void 0 ? _memoryMarkers_key : "";
|
|
515
|
+
try {
|
|
516
|
+
var _window_localStorage;
|
|
517
|
+
var stored = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
|
|
518
|
+
if (typeof stored === "string") previous = stored;
|
|
519
|
+
} catch (unused) {}
|
|
520
|
+
if (value === previous) return false;
|
|
521
|
+
memoryMarkers[key] = value;
|
|
522
|
+
try {
|
|
523
|
+
if (typeof window !== "undefined") {
|
|
524
|
+
var _window_localStorage1, _window_localStorage2;
|
|
525
|
+
if (value) (_window_localStorage1 = window.localStorage) === null || _window_localStorage1 === void 0 ? void 0 : _window_localStorage1.setItem(key, value);
|
|
526
|
+
else (_window_localStorage2 = window.localStorage) === null || _window_localStorage2 === void 0 ? void 0 : _window_localStorage2.removeItem(key);
|
|
527
|
+
}
|
|
528
|
+
} catch (unused) {}
|
|
529
|
+
return true;
|
|
530
|
+
}
|
|
531
|
+
function noteStayId(stayId) {
|
|
532
|
+
if (!writeMarkerIfChanged(STAY_ID_KEY, stayId ? stayId.trim() : "")) return false;
|
|
533
|
+
removeStored(SESSION_ID_KEY);
|
|
534
|
+
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
535
|
+
return true;
|
|
536
|
+
}
|
|
509
537
|
function readSamsungTifa() {
|
|
510
538
|
try {
|
|
511
539
|
var _window_webapis;
|
|
@@ -1545,6 +1573,11 @@ function sanitizePublicIp(value) {
|
|
|
1545
1573
|
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1546
1574
|
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1547
1575
|
}
|
|
1576
|
+
var PPID_PATTERN = /^[0-9a-zA-Z+.=\/_\-$,{}]{22,150}$/;
|
|
1577
|
+
function toPpid(userId, limitAdTracking) {
|
|
1578
|
+
if (!userId || limitAdTracking === true) return void 0;
|
|
1579
|
+
return PPID_PATTERN.test(userId) ? userId : void 0;
|
|
1580
|
+
}
|
|
1548
1581
|
function resolveUserId(configValue) {
|
|
1549
1582
|
var _sanitizeUserId;
|
|
1550
1583
|
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
@@ -1953,6 +1986,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1953
1986
|
set("UA", ctx.userAgent);
|
|
1954
1987
|
set("IP", ctx.ipAddress);
|
|
1955
1988
|
set("UID", ctx.userId);
|
|
1989
|
+
set("PPID", ctx.ppid);
|
|
1956
1990
|
set("CT-TYPE", ctx.contentType);
|
|
1957
1991
|
set("CT-CATEGORY", ctx.contentCategory);
|
|
1958
1992
|
set("CT-GENRE", ctx.contentGenre);
|
|
@@ -9553,6 +9587,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9553
9587
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9554
9588
|
var _content_contentDurationSeconds;
|
|
9555
9589
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9590
|
+
var stayUserId = resolveUserId(this.config.adUserId);
|
|
9591
|
+
noteStayId(stayUserId);
|
|
9556
9592
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9557
9593
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9558
9594
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
@@ -9563,7 +9599,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9563
9599
|
var playerSize = resolvePlayerSize(this.video);
|
|
9564
9600
|
var videoDuration = this.video.duration;
|
|
9565
9601
|
var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
|
|
9566
|
-
var userId =
|
|
9602
|
+
var userId = envSignals.limitAdTracking === true ? void 0 : stayUserId;
|
|
9603
|
+
var ppid = toPpid(stayUserId, envSignals.limitAdTracking);
|
|
9567
9604
|
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9568
9605
|
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9569
9606
|
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
@@ -9609,6 +9646,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9609
9646
|
ipAddress: ipAddress
|
|
9610
9647
|
} : {}, userId ? {
|
|
9611
9648
|
userId: userId
|
|
9649
|
+
} : {}, ppid ? {
|
|
9650
|
+
ppid: ppid
|
|
9612
9651
|
} : {}, content.contentType ? {
|
|
9613
9652
|
contentType: content.contentType
|
|
9614
9653
|
} : {}, content.contentCategory ? {
|
|
@@ -9656,6 +9695,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9656
9695
|
isLat: envSignals.limitAdTracking,
|
|
9657
9696
|
dth: envSignals.deviceTypeHint,
|
|
9658
9697
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9698
|
+
ppidTail: ppid ? ppid.slice(-4) : void 0,
|
|
9659
9699
|
ct_ch: content.channelName,
|
|
9660
9700
|
ct_ti: content.programTitle,
|
|
9661
9701
|
ct_ne: content.contentNetwork,
|
|
@@ -14123,6 +14163,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14123
14163
|
var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
|
|
14124
14164
|
_this.adConfig.consentSignals = signals;
|
|
14125
14165
|
var muted = _this.video.muted;
|
|
14166
|
+
var palPpid = _this.currentPpid();
|
|
14126
14167
|
var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
|
|
14127
14168
|
var palOptions = _object_spread({
|
|
14128
14169
|
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
@@ -14139,9 +14180,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14139
14180
|
allowStorage: signals.storageAllowed
|
|
14140
14181
|
} : {}, palSessionId ? {
|
|
14141
14182
|
sessionId: palSessionId
|
|
14183
|
+
} : {}, palPpid ? {
|
|
14184
|
+
ppid: palPpid
|
|
14142
14185
|
} : {});
|
|
14143
14186
|
_this.lastPalOptions = palOptions;
|
|
14144
14187
|
_this.palSessionId = palSessionId;
|
|
14188
|
+
_this.palPpid = palPpid;
|
|
14145
14189
|
_this.startPalNonceRefresh();
|
|
14146
14190
|
return _this.palNonce.generateNonce(palOptions);
|
|
14147
14191
|
}).catch(function() {});
|
|
@@ -14200,26 +14244,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14200
14244
|
if (!options) return;
|
|
14201
14245
|
var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
|
|
14202
14246
|
var ageMs = this.palNonce.getNonceAgeMs();
|
|
14247
|
+
var ppid = this.currentPpid();
|
|
14248
|
+
var ppidChanged = ppid !== this.palPpid;
|
|
14203
14249
|
var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
|
|
14204
14250
|
var sessionChanged = sessionId !== this.palSessionId;
|
|
14205
14251
|
var stale = ageMs === void 0 || ageMs >= maxAgeMs;
|
|
14206
|
-
if (!force && !stale && !sessionChanged) return;
|
|
14252
|
+
if (!force && !stale && !sessionChanged && !ppidChanged) return;
|
|
14207
14253
|
var next = _object_spread({}, options);
|
|
14208
14254
|
if (sessionId) next.sessionId = sessionId;
|
|
14209
14255
|
else delete next.sessionId;
|
|
14256
|
+
if (ppid) next.ppid = ppid;
|
|
14257
|
+
else delete next.ppid;
|
|
14210
14258
|
this.lastPalOptions = next;
|
|
14211
14259
|
this.palSessionId = sessionId;
|
|
14260
|
+
this.palPpid = ppid;
|
|
14212
14261
|
if (this.debug) {
|
|
14213
14262
|
console.log("[PAL] Regenerating nonce", {
|
|
14214
14263
|
force: force,
|
|
14215
14264
|
stale: stale,
|
|
14216
14265
|
sessionChanged: sessionChanged,
|
|
14266
|
+
ppidChanged: ppidChanged,
|
|
14217
14267
|
ageMs: ageMs
|
|
14218
14268
|
});
|
|
14219
14269
|
}
|
|
14220
14270
|
this.palNonce.generateNonce(next).catch(function() {});
|
|
14221
14271
|
}
|
|
14222
14272
|
},
|
|
14273
|
+
{
|
|
14274
|
+
key: "currentPpid",
|
|
14275
|
+
value: function currentPpid() {
|
|
14276
|
+
var userId = resolveUserId(this.config.adUserId);
|
|
14277
|
+
noteStayId(userId);
|
|
14278
|
+
var signals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
14279
|
+
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
14280
|
+
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
14281
|
+
});
|
|
14282
|
+
return toPpid(userId, signals.limitAdTracking);
|
|
14283
|
+
}
|
|
14284
|
+
},
|
|
14223
14285
|
{
|
|
14224
14286
|
key: "setAdIdentity",
|
|
14225
14287
|
value: function setAdIdentity(identity) {
|
|
@@ -14251,6 +14313,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14251
14313
|
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14252
14314
|
else delete this.config.clientIpAddress;
|
|
14253
14315
|
}
|
|
14316
|
+
if (signals.userId !== void 0) this.refreshPalNonceIfStale();
|
|
14254
14317
|
}
|
|
14255
14318
|
},
|
|
14256
14319
|
{
|