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/players/index.cjs
CHANGED
|
@@ -467,6 +467,9 @@ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
|
|
|
467
467
|
var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
|
|
468
468
|
var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
|
|
469
469
|
var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
|
|
470
|
+
var STAY_ID_KEY = "stormcloud.ad.stay.v1";
|
|
471
|
+
var HOST_ID_KEY = "stormcloud.ad.host.v1";
|
|
472
|
+
var memoryMarkers = {};
|
|
470
473
|
var ZEROED_IDS = /* @__PURE__ */ new Set([
|
|
471
474
|
"00000000-0000-0000-0000-000000000000",
|
|
472
475
|
"38400000-8cf0-11bd-b23e-10b96e40000d"
|
|
@@ -569,7 +572,7 @@ function setHostAdIdentity(identity) {
|
|
|
569
572
|
return;
|
|
570
573
|
}
|
|
571
574
|
var deviceId = identity.deviceId.trim();
|
|
572
|
-
var changed =
|
|
575
|
+
var changed = writeMarkerIfChanged(HOST_ID_KEY, deviceId);
|
|
573
576
|
hostIdentity = _object_spread({
|
|
574
577
|
deviceId: deviceId,
|
|
575
578
|
deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
@@ -588,6 +591,31 @@ function resetAdIdentity() {
|
|
|
588
591
|
removeStored(SESSION_ID_KEY);
|
|
589
592
|
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
590
593
|
}
|
|
594
|
+
function writeMarkerIfChanged(key, value) {
|
|
595
|
+
var _memoryMarkers_key;
|
|
596
|
+
var previous = (_memoryMarkers_key = memoryMarkers[key]) !== null && _memoryMarkers_key !== void 0 ? _memoryMarkers_key : "";
|
|
597
|
+
try {
|
|
598
|
+
var _window_localStorage;
|
|
599
|
+
var stored = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
|
|
600
|
+
if (typeof stored === "string") previous = stored;
|
|
601
|
+
} catch (unused) {}
|
|
602
|
+
if (value === previous) return false;
|
|
603
|
+
memoryMarkers[key] = value;
|
|
604
|
+
try {
|
|
605
|
+
if (typeof window !== "undefined") {
|
|
606
|
+
var _window_localStorage1, _window_localStorage2;
|
|
607
|
+
if (value) (_window_localStorage1 = window.localStorage) === null || _window_localStorage1 === void 0 ? void 0 : _window_localStorage1.setItem(key, value);
|
|
608
|
+
else (_window_localStorage2 = window.localStorage) === null || _window_localStorage2 === void 0 ? void 0 : _window_localStorage2.removeItem(key);
|
|
609
|
+
}
|
|
610
|
+
} catch (unused) {}
|
|
611
|
+
return true;
|
|
612
|
+
}
|
|
613
|
+
function noteStayId(stayId) {
|
|
614
|
+
if (!writeMarkerIfChanged(STAY_ID_KEY, stayId ? stayId.trim() : "")) return false;
|
|
615
|
+
removeStored(SESSION_ID_KEY);
|
|
616
|
+
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
617
|
+
return true;
|
|
618
|
+
}
|
|
591
619
|
function readSamsungTifa() {
|
|
592
620
|
try {
|
|
593
621
|
var _window_webapis;
|
|
@@ -1627,6 +1655,11 @@ function sanitizePublicIp(value) {
|
|
|
1627
1655
|
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1628
1656
|
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1629
1657
|
}
|
|
1658
|
+
var PPID_PATTERN = /^[0-9a-zA-Z+.=\/_\-$,{}]{22,150}$/;
|
|
1659
|
+
function toPpid(userId, limitAdTracking) {
|
|
1660
|
+
if (!userId || limitAdTracking === true) return void 0;
|
|
1661
|
+
return PPID_PATTERN.test(userId) ? userId : void 0;
|
|
1662
|
+
}
|
|
1630
1663
|
function resolveUserId(configValue) {
|
|
1631
1664
|
var _sanitizeUserId;
|
|
1632
1665
|
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
@@ -2035,6 +2068,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
2035
2068
|
set("UA", ctx.userAgent);
|
|
2036
2069
|
set("IP", ctx.ipAddress);
|
|
2037
2070
|
set("UID", ctx.userId);
|
|
2071
|
+
set("PPID", ctx.ppid);
|
|
2038
2072
|
set("CT-TYPE", ctx.contentType);
|
|
2039
2073
|
set("CT-CATEGORY", ctx.contentCategory);
|
|
2040
2074
|
set("CT-GENRE", ctx.contentGenre);
|
|
@@ -9635,6 +9669,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9635
9669
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9636
9670
|
var _content_contentDurationSeconds;
|
|
9637
9671
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9672
|
+
var stayUserId = resolveUserId(this.config.adUserId);
|
|
9673
|
+
noteStayId(stayUserId);
|
|
9638
9674
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9639
9675
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9640
9676
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
@@ -9645,7 +9681,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9645
9681
|
var playerSize = resolvePlayerSize(this.video);
|
|
9646
9682
|
var videoDuration = this.video.duration;
|
|
9647
9683
|
var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
|
|
9648
|
-
var userId =
|
|
9684
|
+
var userId = envSignals.limitAdTracking === true ? void 0 : stayUserId;
|
|
9685
|
+
var ppid = toPpid(stayUserId, envSignals.limitAdTracking);
|
|
9649
9686
|
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9650
9687
|
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9651
9688
|
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
@@ -9691,6 +9728,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9691
9728
|
ipAddress: ipAddress
|
|
9692
9729
|
} : {}, userId ? {
|
|
9693
9730
|
userId: userId
|
|
9731
|
+
} : {}, ppid ? {
|
|
9732
|
+
ppid: ppid
|
|
9694
9733
|
} : {}, content.contentType ? {
|
|
9695
9734
|
contentType: content.contentType
|
|
9696
9735
|
} : {}, content.contentCategory ? {
|
|
@@ -9738,6 +9777,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9738
9777
|
isLat: envSignals.limitAdTracking,
|
|
9739
9778
|
dth: envSignals.deviceTypeHint,
|
|
9740
9779
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9780
|
+
ppidTail: ppid ? ppid.slice(-4) : void 0,
|
|
9741
9781
|
ct_ch: content.channelName,
|
|
9742
9782
|
ct_ti: content.programTitle,
|
|
9743
9783
|
ct_ne: content.contentNetwork,
|
|
@@ -14205,6 +14245,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14205
14245
|
var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
|
|
14206
14246
|
_this.adConfig.consentSignals = signals;
|
|
14207
14247
|
var muted = _this.video.muted;
|
|
14248
|
+
var palPpid = _this.currentPpid();
|
|
14208
14249
|
var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
|
|
14209
14250
|
var palOptions = _object_spread({
|
|
14210
14251
|
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
@@ -14221,9 +14262,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14221
14262
|
allowStorage: signals.storageAllowed
|
|
14222
14263
|
} : {}, palSessionId ? {
|
|
14223
14264
|
sessionId: palSessionId
|
|
14265
|
+
} : {}, palPpid ? {
|
|
14266
|
+
ppid: palPpid
|
|
14224
14267
|
} : {});
|
|
14225
14268
|
_this.lastPalOptions = palOptions;
|
|
14226
14269
|
_this.palSessionId = palSessionId;
|
|
14270
|
+
_this.palPpid = palPpid;
|
|
14227
14271
|
_this.startPalNonceRefresh();
|
|
14228
14272
|
return _this.palNonce.generateNonce(palOptions);
|
|
14229
14273
|
}).catch(function() {});
|
|
@@ -14282,26 +14326,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14282
14326
|
if (!options) return;
|
|
14283
14327
|
var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
|
|
14284
14328
|
var ageMs = this.palNonce.getNonceAgeMs();
|
|
14329
|
+
var ppid = this.currentPpid();
|
|
14330
|
+
var ppidChanged = ppid !== this.palPpid;
|
|
14285
14331
|
var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
|
|
14286
14332
|
var sessionChanged = sessionId !== this.palSessionId;
|
|
14287
14333
|
var stale = ageMs === void 0 || ageMs >= maxAgeMs;
|
|
14288
|
-
if (!force && !stale && !sessionChanged) return;
|
|
14334
|
+
if (!force && !stale && !sessionChanged && !ppidChanged) return;
|
|
14289
14335
|
var next = _object_spread({}, options);
|
|
14290
14336
|
if (sessionId) next.sessionId = sessionId;
|
|
14291
14337
|
else delete next.sessionId;
|
|
14338
|
+
if (ppid) next.ppid = ppid;
|
|
14339
|
+
else delete next.ppid;
|
|
14292
14340
|
this.lastPalOptions = next;
|
|
14293
14341
|
this.palSessionId = sessionId;
|
|
14342
|
+
this.palPpid = ppid;
|
|
14294
14343
|
if (this.debug) {
|
|
14295
14344
|
console.log("[PAL] Regenerating nonce", {
|
|
14296
14345
|
force: force,
|
|
14297
14346
|
stale: stale,
|
|
14298
14347
|
sessionChanged: sessionChanged,
|
|
14348
|
+
ppidChanged: ppidChanged,
|
|
14299
14349
|
ageMs: ageMs
|
|
14300
14350
|
});
|
|
14301
14351
|
}
|
|
14302
14352
|
this.palNonce.generateNonce(next).catch(function() {});
|
|
14303
14353
|
}
|
|
14304
14354
|
},
|
|
14355
|
+
{
|
|
14356
|
+
key: "currentPpid",
|
|
14357
|
+
value: function currentPpid() {
|
|
14358
|
+
var userId = resolveUserId(this.config.adUserId);
|
|
14359
|
+
noteStayId(userId);
|
|
14360
|
+
var signals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
14361
|
+
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
14362
|
+
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
14363
|
+
});
|
|
14364
|
+
return toPpid(userId, signals.limitAdTracking);
|
|
14365
|
+
}
|
|
14366
|
+
},
|
|
14305
14367
|
{
|
|
14306
14368
|
key: "setAdIdentity",
|
|
14307
14369
|
value: function setAdIdentity(identity) {
|
|
@@ -14333,6 +14395,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14333
14395
|
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14334
14396
|
else delete this.config.clientIpAddress;
|
|
14335
14397
|
}
|
|
14398
|
+
if (signals.userId !== void 0) this.refreshPalNonceIfStale();
|
|
14336
14399
|
}
|
|
14337
14400
|
},
|
|
14338
14401
|
{
|