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