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
|
@@ -26,6 +26,7 @@ declare class StormcloudVideoPlayer {
|
|
|
26
26
|
private edgePodBaseUrl;
|
|
27
27
|
private lastPalOptions;
|
|
28
28
|
private palSessionId;
|
|
29
|
+
private palPpid;
|
|
29
30
|
private palRefreshTimer;
|
|
30
31
|
constructor(config: StormcloudVideoPlayerConfig);
|
|
31
32
|
private get debug();
|
|
@@ -42,6 +43,7 @@ declare class StormcloudVideoPlayer {
|
|
|
42
43
|
load(): Promise<void>;
|
|
43
44
|
private startPalNonceRefresh;
|
|
44
45
|
private refreshPalNonceIfStale;
|
|
46
|
+
private currentPpid;
|
|
45
47
|
setAdIdentity(identity: HostAdIdentity | null): void;
|
|
46
48
|
resetAdIdentity(): void;
|
|
47
49
|
setContentMetadata(meta: ContentMetadataUpdate): void;
|
|
@@ -431,6 +431,9 @@ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
|
|
|
431
431
|
var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
|
|
432
432
|
var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
|
|
433
433
|
var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
|
|
434
|
+
var STAY_ID_KEY = "stormcloud.ad.stay.v1";
|
|
435
|
+
var HOST_ID_KEY = "stormcloud.ad.host.v1";
|
|
436
|
+
var memoryMarkers = {};
|
|
434
437
|
var ZEROED_IDS = /* @__PURE__ */ new Set([
|
|
435
438
|
"00000000-0000-0000-0000-000000000000",
|
|
436
439
|
"38400000-8cf0-11bd-b23e-10b96e40000d"
|
|
@@ -533,7 +536,7 @@ function setHostAdIdentity(identity) {
|
|
|
533
536
|
return;
|
|
534
537
|
}
|
|
535
538
|
var deviceId = identity.deviceId.trim();
|
|
536
|
-
var changed =
|
|
539
|
+
var changed = writeMarkerIfChanged(HOST_ID_KEY, deviceId);
|
|
537
540
|
hostIdentity = _object_spread({
|
|
538
541
|
deviceId: deviceId,
|
|
539
542
|
deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
@@ -552,6 +555,31 @@ function resetAdIdentity() {
|
|
|
552
555
|
removeStored(SESSION_ID_KEY);
|
|
553
556
|
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
554
557
|
}
|
|
558
|
+
function writeMarkerIfChanged(key, value) {
|
|
559
|
+
var _memoryMarkers_key;
|
|
560
|
+
var previous = (_memoryMarkers_key = memoryMarkers[key]) !== null && _memoryMarkers_key !== void 0 ? _memoryMarkers_key : "";
|
|
561
|
+
try {
|
|
562
|
+
var _window_localStorage;
|
|
563
|
+
var stored = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
|
|
564
|
+
if (typeof stored === "string") previous = stored;
|
|
565
|
+
} catch (unused) {}
|
|
566
|
+
if (value === previous) return false;
|
|
567
|
+
memoryMarkers[key] = value;
|
|
568
|
+
try {
|
|
569
|
+
if (typeof window !== "undefined") {
|
|
570
|
+
var _window_localStorage1, _window_localStorage2;
|
|
571
|
+
if (value) (_window_localStorage1 = window.localStorage) === null || _window_localStorage1 === void 0 ? void 0 : _window_localStorage1.setItem(key, value);
|
|
572
|
+
else (_window_localStorage2 = window.localStorage) === null || _window_localStorage2 === void 0 ? void 0 : _window_localStorage2.removeItem(key);
|
|
573
|
+
}
|
|
574
|
+
} catch (unused) {}
|
|
575
|
+
return true;
|
|
576
|
+
}
|
|
577
|
+
function noteStayId(stayId) {
|
|
578
|
+
if (!writeMarkerIfChanged(STAY_ID_KEY, stayId ? stayId.trim() : "")) return false;
|
|
579
|
+
removeStored(SESSION_ID_KEY);
|
|
580
|
+
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
581
|
+
return true;
|
|
582
|
+
}
|
|
555
583
|
function readSamsungTifa() {
|
|
556
584
|
try {
|
|
557
585
|
var _window_webapis;
|
|
@@ -1591,6 +1619,11 @@ function sanitizePublicIp(value) {
|
|
|
1591
1619
|
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1592
1620
|
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1593
1621
|
}
|
|
1622
|
+
var PPID_PATTERN = /^[0-9a-zA-Z+.=\/_\-$,{}]{22,150}$/;
|
|
1623
|
+
function toPpid(userId, limitAdTracking) {
|
|
1624
|
+
if (!userId || limitAdTracking === true) return void 0;
|
|
1625
|
+
return PPID_PATTERN.test(userId) ? userId : void 0;
|
|
1626
|
+
}
|
|
1594
1627
|
function resolveUserId(configValue) {
|
|
1595
1628
|
var _sanitizeUserId;
|
|
1596
1629
|
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
@@ -1999,6 +2032,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1999
2032
|
set("UA", ctx.userAgent);
|
|
2000
2033
|
set("IP", ctx.ipAddress);
|
|
2001
2034
|
set("UID", ctx.userId);
|
|
2035
|
+
set("PPID", ctx.ppid);
|
|
2002
2036
|
set("CT-TYPE", ctx.contentType);
|
|
2003
2037
|
set("CT-CATEGORY", ctx.contentCategory);
|
|
2004
2038
|
set("CT-GENRE", ctx.contentGenre);
|
|
@@ -9599,6 +9633,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9599
9633
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9600
9634
|
var _content_contentDurationSeconds;
|
|
9601
9635
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9636
|
+
var stayUserId = resolveUserId(this.config.adUserId);
|
|
9637
|
+
noteStayId(stayUserId);
|
|
9602
9638
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9603
9639
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9604
9640
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
@@ -9609,7 +9645,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9609
9645
|
var playerSize = resolvePlayerSize(this.video);
|
|
9610
9646
|
var videoDuration = this.video.duration;
|
|
9611
9647
|
var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
|
|
9612
|
-
var userId =
|
|
9648
|
+
var userId = envSignals.limitAdTracking === true ? void 0 : stayUserId;
|
|
9649
|
+
var ppid = toPpid(stayUserId, envSignals.limitAdTracking);
|
|
9613
9650
|
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9614
9651
|
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9615
9652
|
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
@@ -9655,6 +9692,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9655
9692
|
ipAddress: ipAddress
|
|
9656
9693
|
} : {}, userId ? {
|
|
9657
9694
|
userId: userId
|
|
9695
|
+
} : {}, ppid ? {
|
|
9696
|
+
ppid: ppid
|
|
9658
9697
|
} : {}, content.contentType ? {
|
|
9659
9698
|
contentType: content.contentType
|
|
9660
9699
|
} : {}, content.contentCategory ? {
|
|
@@ -9702,6 +9741,7 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9702
9741
|
isLat: envSignals.limitAdTracking,
|
|
9703
9742
|
dth: envSignals.deviceTypeHint,
|
|
9704
9743
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9744
|
+
ppidTail: ppid ? ppid.slice(-4) : void 0,
|
|
9705
9745
|
ct_ch: content.channelName,
|
|
9706
9746
|
ct_ti: content.programTitle,
|
|
9707
9747
|
ct_ne: content.contentNetwork,
|
|
@@ -14169,6 +14209,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14169
14209
|
var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
|
|
14170
14210
|
_this.adConfig.consentSignals = signals;
|
|
14171
14211
|
var muted = _this.video.muted;
|
|
14212
|
+
var palPpid = _this.currentPpid();
|
|
14172
14213
|
var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
|
|
14173
14214
|
var palOptions = _object_spread({
|
|
14174
14215
|
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
@@ -14185,9 +14226,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14185
14226
|
allowStorage: signals.storageAllowed
|
|
14186
14227
|
} : {}, palSessionId ? {
|
|
14187
14228
|
sessionId: palSessionId
|
|
14229
|
+
} : {}, palPpid ? {
|
|
14230
|
+
ppid: palPpid
|
|
14188
14231
|
} : {});
|
|
14189
14232
|
_this.lastPalOptions = palOptions;
|
|
14190
14233
|
_this.palSessionId = palSessionId;
|
|
14234
|
+
_this.palPpid = palPpid;
|
|
14191
14235
|
_this.startPalNonceRefresh();
|
|
14192
14236
|
return _this.palNonce.generateNonce(palOptions);
|
|
14193
14237
|
}).catch(function() {});
|
|
@@ -14246,26 +14290,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14246
14290
|
if (!options) return;
|
|
14247
14291
|
var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
|
|
14248
14292
|
var ageMs = this.palNonce.getNonceAgeMs();
|
|
14293
|
+
var ppid = this.currentPpid();
|
|
14294
|
+
var ppidChanged = ppid !== this.palPpid;
|
|
14249
14295
|
var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
|
|
14250
14296
|
var sessionChanged = sessionId !== this.palSessionId;
|
|
14251
14297
|
var stale = ageMs === void 0 || ageMs >= maxAgeMs;
|
|
14252
|
-
if (!force && !stale && !sessionChanged) return;
|
|
14298
|
+
if (!force && !stale && !sessionChanged && !ppidChanged) return;
|
|
14253
14299
|
var next = _object_spread({}, options);
|
|
14254
14300
|
if (sessionId) next.sessionId = sessionId;
|
|
14255
14301
|
else delete next.sessionId;
|
|
14302
|
+
if (ppid) next.ppid = ppid;
|
|
14303
|
+
else delete next.ppid;
|
|
14256
14304
|
this.lastPalOptions = next;
|
|
14257
14305
|
this.palSessionId = sessionId;
|
|
14306
|
+
this.palPpid = ppid;
|
|
14258
14307
|
if (this.debug) {
|
|
14259
14308
|
console.log("[PAL] Regenerating nonce", {
|
|
14260
14309
|
force: force,
|
|
14261
14310
|
stale: stale,
|
|
14262
14311
|
sessionChanged: sessionChanged,
|
|
14312
|
+
ppidChanged: ppidChanged,
|
|
14263
14313
|
ageMs: ageMs
|
|
14264
14314
|
});
|
|
14265
14315
|
}
|
|
14266
14316
|
this.palNonce.generateNonce(next).catch(function() {});
|
|
14267
14317
|
}
|
|
14268
14318
|
},
|
|
14319
|
+
{
|
|
14320
|
+
key: "currentPpid",
|
|
14321
|
+
value: function currentPpid() {
|
|
14322
|
+
var userId = resolveUserId(this.config.adUserId);
|
|
14323
|
+
noteStayId(userId);
|
|
14324
|
+
var signals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
14325
|
+
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
14326
|
+
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
14327
|
+
});
|
|
14328
|
+
return toPpid(userId, signals.limitAdTracking);
|
|
14329
|
+
}
|
|
14330
|
+
},
|
|
14269
14331
|
{
|
|
14270
14332
|
key: "setAdIdentity",
|
|
14271
14333
|
value: function setAdIdentity(identity) {
|
|
@@ -14297,6 +14359,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14297
14359
|
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14298
14360
|
else delete this.config.clientIpAddress;
|
|
14299
14361
|
}
|
|
14362
|
+
if (signals.userId !== void 0) this.refreshPalNonceIfStale();
|
|
14300
14363
|
}
|
|
14301
14364
|
},
|
|
14302
14365
|
{
|