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/index.cjs
CHANGED
|
@@ -588,6 +588,9 @@ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
|
|
|
588
588
|
var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
|
|
589
589
|
var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
|
|
590
590
|
var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
|
|
591
|
+
var STAY_ID_KEY = "stormcloud.ad.stay.v1";
|
|
592
|
+
var HOST_ID_KEY = "stormcloud.ad.host.v1";
|
|
593
|
+
var memoryMarkers = {};
|
|
591
594
|
var ZEROED_IDS = /* @__PURE__ */ new Set([
|
|
592
595
|
"00000000-0000-0000-0000-000000000000",
|
|
593
596
|
"38400000-8cf0-11bd-b23e-10b96e40000d"
|
|
@@ -690,7 +693,7 @@ function setHostAdIdentity(identity) {
|
|
|
690
693
|
return;
|
|
691
694
|
}
|
|
692
695
|
var deviceId = identity.deviceId.trim();
|
|
693
|
-
var changed =
|
|
696
|
+
var changed = writeMarkerIfChanged(HOST_ID_KEY, deviceId);
|
|
694
697
|
hostIdentity = _object_spread({
|
|
695
698
|
deviceId: deviceId,
|
|
696
699
|
deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
@@ -709,6 +712,31 @@ function resetAdIdentity() {
|
|
|
709
712
|
removeStored(SESSION_ID_KEY);
|
|
710
713
|
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
711
714
|
}
|
|
715
|
+
function writeMarkerIfChanged(key, value) {
|
|
716
|
+
var _memoryMarkers_key;
|
|
717
|
+
var previous = (_memoryMarkers_key = memoryMarkers[key]) !== null && _memoryMarkers_key !== void 0 ? _memoryMarkers_key : "";
|
|
718
|
+
try {
|
|
719
|
+
var _window_localStorage;
|
|
720
|
+
var stored = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
|
|
721
|
+
if (typeof stored === "string") previous = stored;
|
|
722
|
+
} catch (unused) {}
|
|
723
|
+
if (value === previous) return false;
|
|
724
|
+
memoryMarkers[key] = value;
|
|
725
|
+
try {
|
|
726
|
+
if (typeof window !== "undefined") {
|
|
727
|
+
var _window_localStorage1, _window_localStorage2;
|
|
728
|
+
if (value) (_window_localStorage1 = window.localStorage) === null || _window_localStorage1 === void 0 ? void 0 : _window_localStorage1.setItem(key, value);
|
|
729
|
+
else (_window_localStorage2 = window.localStorage) === null || _window_localStorage2 === void 0 ? void 0 : _window_localStorage2.removeItem(key);
|
|
730
|
+
}
|
|
731
|
+
} catch (unused) {}
|
|
732
|
+
return true;
|
|
733
|
+
}
|
|
734
|
+
function noteStayId(stayId) {
|
|
735
|
+
if (!writeMarkerIfChanged(STAY_ID_KEY, stayId ? stayId.trim() : "")) return false;
|
|
736
|
+
removeStored(SESSION_ID_KEY);
|
|
737
|
+
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
738
|
+
return true;
|
|
739
|
+
}
|
|
712
740
|
function readSamsungTifa() {
|
|
713
741
|
try {
|
|
714
742
|
var _window_webapis;
|
|
@@ -1748,6 +1776,11 @@ function sanitizePublicIp(value) {
|
|
|
1748
1776
|
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1749
1777
|
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1750
1778
|
}
|
|
1779
|
+
var PPID_PATTERN = /^[0-9a-zA-Z+.=\/_\-$,{}]{22,150}$/;
|
|
1780
|
+
function toPpid(userId, limitAdTracking) {
|
|
1781
|
+
if (!userId || limitAdTracking === true) return void 0;
|
|
1782
|
+
return PPID_PATTERN.test(userId) ? userId : void 0;
|
|
1783
|
+
}
|
|
1751
1784
|
function resolveUserId(configValue) {
|
|
1752
1785
|
var _sanitizeUserId;
|
|
1753
1786
|
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
@@ -2156,6 +2189,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
2156
2189
|
set("UA", ctx.userAgent);
|
|
2157
2190
|
set("IP", ctx.ipAddress);
|
|
2158
2191
|
set("UID", ctx.userId);
|
|
2192
|
+
set("PPID", ctx.ppid);
|
|
2159
2193
|
set("CT-TYPE", ctx.contentType);
|
|
2160
2194
|
set("CT-CATEGORY", ctx.contentCategory);
|
|
2161
2195
|
set("CT-GENRE", ctx.contentGenre);
|
|
@@ -9794,6 +9828,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9794
9828
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9795
9829
|
var _content_contentDurationSeconds;
|
|
9796
9830
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9831
|
+
var stayUserId = resolveUserId(this.config.adUserId);
|
|
9832
|
+
noteStayId(stayUserId);
|
|
9797
9833
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9798
9834
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9799
9835
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
@@ -9804,7 +9840,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9804
9840
|
var playerSize = resolvePlayerSize(this.video);
|
|
9805
9841
|
var videoDuration = this.video.duration;
|
|
9806
9842
|
var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
|
|
9807
|
-
var userId =
|
|
9843
|
+
var userId = envSignals.limitAdTracking === true ? void 0 : stayUserId;
|
|
9844
|
+
var ppid = toPpid(stayUserId, envSignals.limitAdTracking);
|
|
9808
9845
|
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9809
9846
|
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9810
9847
|
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
@@ -9850,6 +9887,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9850
9887
|
ipAddress: ipAddress
|
|
9851
9888
|
} : {}, userId ? {
|
|
9852
9889
|
userId: userId
|
|
9890
|
+
} : {}, ppid ? {
|
|
9891
|
+
ppid: ppid
|
|
9853
9892
|
} : {}, content.contentType ? {
|
|
9854
9893
|
contentType: content.contentType
|
|
9855
9894
|
} : {}, content.contentCategory ? {
|
|
@@ -9897,6 +9936,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9897
9936
|
isLat: envSignals.limitAdTracking,
|
|
9898
9937
|
dth: envSignals.deviceTypeHint,
|
|
9899
9938
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9939
|
+
ppidTail: ppid ? ppid.slice(-4) : void 0,
|
|
9900
9940
|
ct_ch: content.channelName,
|
|
9901
9941
|
ct_ti: content.programTitle,
|
|
9902
9942
|
ct_ne: content.contentNetwork,
|
|
@@ -14364,6 +14404,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14364
14404
|
var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
|
|
14365
14405
|
_this.adConfig.consentSignals = signals;
|
|
14366
14406
|
var muted = _this.video.muted;
|
|
14407
|
+
var palPpid = _this.currentPpid();
|
|
14367
14408
|
var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
|
|
14368
14409
|
var palOptions = _object_spread({
|
|
14369
14410
|
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
@@ -14380,9 +14421,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14380
14421
|
allowStorage: signals.storageAllowed
|
|
14381
14422
|
} : {}, palSessionId ? {
|
|
14382
14423
|
sessionId: palSessionId
|
|
14424
|
+
} : {}, palPpid ? {
|
|
14425
|
+
ppid: palPpid
|
|
14383
14426
|
} : {});
|
|
14384
14427
|
_this.lastPalOptions = palOptions;
|
|
14385
14428
|
_this.palSessionId = palSessionId;
|
|
14429
|
+
_this.palPpid = palPpid;
|
|
14386
14430
|
_this.startPalNonceRefresh();
|
|
14387
14431
|
return _this.palNonce.generateNonce(palOptions);
|
|
14388
14432
|
}).catch(function() {});
|
|
@@ -14441,26 +14485,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14441
14485
|
if (!options) return;
|
|
14442
14486
|
var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
|
|
14443
14487
|
var ageMs = this.palNonce.getNonceAgeMs();
|
|
14488
|
+
var ppid = this.currentPpid();
|
|
14489
|
+
var ppidChanged = ppid !== this.palPpid;
|
|
14444
14490
|
var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
|
|
14445
14491
|
var sessionChanged = sessionId !== this.palSessionId;
|
|
14446
14492
|
var stale = ageMs === void 0 || ageMs >= maxAgeMs;
|
|
14447
|
-
if (!force && !stale && !sessionChanged) return;
|
|
14493
|
+
if (!force && !stale && !sessionChanged && !ppidChanged) return;
|
|
14448
14494
|
var next = _object_spread({}, options);
|
|
14449
14495
|
if (sessionId) next.sessionId = sessionId;
|
|
14450
14496
|
else delete next.sessionId;
|
|
14497
|
+
if (ppid) next.ppid = ppid;
|
|
14498
|
+
else delete next.ppid;
|
|
14451
14499
|
this.lastPalOptions = next;
|
|
14452
14500
|
this.palSessionId = sessionId;
|
|
14501
|
+
this.palPpid = ppid;
|
|
14453
14502
|
if (this.debug) {
|
|
14454
14503
|
console.log("[PAL] Regenerating nonce", {
|
|
14455
14504
|
force: force,
|
|
14456
14505
|
stale: stale,
|
|
14457
14506
|
sessionChanged: sessionChanged,
|
|
14507
|
+
ppidChanged: ppidChanged,
|
|
14458
14508
|
ageMs: ageMs
|
|
14459
14509
|
});
|
|
14460
14510
|
}
|
|
14461
14511
|
this.palNonce.generateNonce(next).catch(function() {});
|
|
14462
14512
|
}
|
|
14463
14513
|
},
|
|
14514
|
+
{
|
|
14515
|
+
key: "currentPpid",
|
|
14516
|
+
value: function currentPpid() {
|
|
14517
|
+
var userId = resolveUserId(this.config.adUserId);
|
|
14518
|
+
noteStayId(userId);
|
|
14519
|
+
var signals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
14520
|
+
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
14521
|
+
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
14522
|
+
});
|
|
14523
|
+
return toPpid(userId, signals.limitAdTracking);
|
|
14524
|
+
}
|
|
14525
|
+
},
|
|
14464
14526
|
{
|
|
14465
14527
|
key: "setAdIdentity",
|
|
14466
14528
|
value: function setAdIdentity(identity) {
|
|
@@ -14492,6 +14554,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14492
14554
|
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14493
14555
|
else delete this.config.clientIpAddress;
|
|
14494
14556
|
}
|
|
14557
|
+
if (signals.userId !== void 0) this.refreshPalNonceIfStale();
|
|
14495
14558
|
}
|
|
14496
14559
|
},
|
|
14497
14560
|
{
|