stormcloud-video-player 0.8.81 → 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/Player.d.cts +1 -1
- package/lib/StormcloudPlayer.cjs +145 -10
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/index.cjs +145 -10
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +5 -0
- package/lib/index.js +145 -10
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +63 -3
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +1 -0
- package/lib/player/AdConfigManager.cjs +54 -3
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +145 -10
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +2 -0
- package/lib/players/HlsPlayer.cjs +145 -10
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +145 -10
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +13 -0
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/types.d.cts +1 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +145 -10
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/__tests__/adSignals.test.cjs +30 -3
- 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/browserCompat.cjs +33 -0
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/browserCompat.d.cts +3 -1
- package/lib/utils/contentMetadata.cjs +15 -4
- package/lib/utils/contentMetadata.cjs.map +1 -1
- package/lib/utils/contentMetadata.d.cts +2 -0
- package/lib/utils/partnerSignals.cjs +13 -2
- 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/types.d.cts
CHANGED
|
@@ -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;
|
|
@@ -1292,7 +1320,9 @@ var BRIDGE_KEYS = {
|
|
|
1292
1320
|
],
|
|
1293
1321
|
contentRating: [
|
|
1294
1322
|
"contentRating",
|
|
1295
|
-
"ctr"
|
|
1323
|
+
"ctr",
|
|
1324
|
+
"programRating",
|
|
1325
|
+
"rating"
|
|
1296
1326
|
],
|
|
1297
1327
|
contentId: [
|
|
1298
1328
|
"contentId",
|
|
@@ -1304,7 +1334,9 @@ function sanitizeContentValue(value) {
|
|
|
1304
1334
|
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
1305
1335
|
if (!cleaned) return void 0;
|
|
1306
1336
|
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
1307
|
-
if (/^(unknown|null|undefined|none|n\/a
|
|
1337
|
+
if (/^(unknown|null|undefined|none|n\/a|-|tbd|tba|to be (announced|determined))$/i.test(cleaned)) {
|
|
1338
|
+
return void 0;
|
|
1339
|
+
}
|
|
1308
1340
|
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
1309
1341
|
}
|
|
1310
1342
|
function sanitizeContentScalar(value) {
|
|
@@ -1430,6 +1462,7 @@ function resolveContentMetadata(config) {
|
|
|
1430
1462
|
} : {});
|
|
1431
1463
|
}
|
|
1432
1464
|
function applyContentMetadataUpdate(target, meta) {
|
|
1465
|
+
var _target_contentDetails;
|
|
1433
1466
|
var apply = function apply(key, value) {
|
|
1434
1467
|
if (value === void 0) return;
|
|
1435
1468
|
var clean = value === null ? void 0 : sanitizeContentValue(value);
|
|
@@ -1439,9 +1472,15 @@ function applyContentMetadataUpdate(target, meta) {
|
|
|
1439
1472
|
apply("channelName", meta.channelName);
|
|
1440
1473
|
apply("programTitle", meta.programTitle);
|
|
1441
1474
|
apply("contentNetwork", meta.contentNetwork);
|
|
1442
|
-
if (meta.details === void 0) return;
|
|
1443
1475
|
if (meta.details === null) delete target.contentDetails;
|
|
1444
|
-
else target.contentDetails = _object_spread({}, meta.details);
|
|
1476
|
+
else if (meta.details !== void 0) target.contentDetails = _object_spread({}, meta.details);
|
|
1477
|
+
var rating = meta.programRating !== void 0 ? meta.programRating : meta.contentRating;
|
|
1478
|
+
if (rating === void 0) return;
|
|
1479
|
+
var cleanRating = rating === null ? void 0 : sanitizeContentValue(rating);
|
|
1480
|
+
var details = _object_spread({}, (_target_contentDetails = target.contentDetails) !== null && _target_contentDetails !== void 0 ? _target_contentDetails : {});
|
|
1481
|
+
if (cleanRating) details.rating = cleanRating;
|
|
1482
|
+
else delete details.rating;
|
|
1483
|
+
target.contentDetails = details;
|
|
1445
1484
|
}
|
|
1446
1485
|
function appendMissingContentParams(url, meta) {
|
|
1447
1486
|
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
@@ -1534,6 +1573,11 @@ function sanitizePublicIp(value) {
|
|
|
1534
1573
|
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1535
1574
|
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1536
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
|
+
}
|
|
1537
1581
|
function resolveUserId(configValue) {
|
|
1538
1582
|
var _sanitizeUserId;
|
|
1539
1583
|
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
@@ -1942,6 +1986,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1942
1986
|
set("UA", ctx.userAgent);
|
|
1943
1987
|
set("IP", ctx.ipAddress);
|
|
1944
1988
|
set("UID", ctx.userId);
|
|
1989
|
+
set("PPID", ctx.ppid);
|
|
1945
1990
|
set("CT-TYPE", ctx.contentType);
|
|
1946
1991
|
set("CT-CATEGORY", ctx.contentCategory);
|
|
1947
1992
|
set("CT-GENRE", ctx.contentGenre);
|
|
@@ -2837,9 +2882,30 @@ function detectBrowser() {
|
|
|
2837
2882
|
};
|
|
2838
2883
|
}
|
|
2839
2884
|
var singleDecoderOverride;
|
|
2885
|
+
var LEARNED_SINGLE_DECODER_KEY = "stormcloud.singleDecoder.learned.v1";
|
|
2886
|
+
var learnedSingleDecoder;
|
|
2840
2887
|
function setSingleDecoderOverride(value) {
|
|
2841
2888
|
singleDecoderOverride = value;
|
|
2842
2889
|
}
|
|
2890
|
+
function readLearnedSingleDecoder() {
|
|
2891
|
+
if (learnedSingleDecoder !== void 0) return learnedSingleDecoder;
|
|
2892
|
+
try {
|
|
2893
|
+
var _window_localStorage;
|
|
2894
|
+
learnedSingleDecoder = typeof window !== "undefined" && ((_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(LEARNED_SINGLE_DECODER_KEY)) === "1";
|
|
2895
|
+
} catch (unused) {
|
|
2896
|
+
learnedSingleDecoder = false;
|
|
2897
|
+
}
|
|
2898
|
+
return learnedSingleDecoder;
|
|
2899
|
+
}
|
|
2900
|
+
function markSingleDecoderLearned() {
|
|
2901
|
+
if (readLearnedSingleDecoder()) return false;
|
|
2902
|
+
learnedSingleDecoder = true;
|
|
2903
|
+
try {
|
|
2904
|
+
var _window_localStorage;
|
|
2905
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(LEARNED_SINGLE_DECODER_KEY, "1");
|
|
2906
|
+
} catch (unused) {}
|
|
2907
|
+
return true;
|
|
2908
|
+
}
|
|
2843
2909
|
function requiresMediaPipelineResetAfterAds() {
|
|
2844
2910
|
var _browser_tizenVersion;
|
|
2845
2911
|
if (singleDecoderOverride != null) return singleDecoderOverride;
|
|
@@ -2847,6 +2913,7 @@ function requiresMediaPipelineResetAfterAds() {
|
|
|
2847
2913
|
var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
|
|
2848
2914
|
if (typeof globalOverride === "boolean") return globalOverride;
|
|
2849
2915
|
} catch (unused) {}
|
|
2916
|
+
if (readLearnedSingleDecoder()) return true;
|
|
2850
2917
|
var browser = detectBrowser();
|
|
2851
2918
|
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
2852
2919
|
}
|
|
@@ -9520,6 +9587,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9520
9587
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9521
9588
|
var _content_contentDurationSeconds;
|
|
9522
9589
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9590
|
+
var stayUserId = resolveUserId(this.config.adUserId);
|
|
9591
|
+
noteStayId(stayUserId);
|
|
9523
9592
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9524
9593
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9525
9594
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
@@ -9530,7 +9599,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9530
9599
|
var playerSize = resolvePlayerSize(this.video);
|
|
9531
9600
|
var videoDuration = this.video.duration;
|
|
9532
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;
|
|
9533
|
-
var userId =
|
|
9602
|
+
var userId = envSignals.limitAdTracking === true ? void 0 : stayUserId;
|
|
9603
|
+
var ppid = toPpid(stayUserId, envSignals.limitAdTracking);
|
|
9534
9604
|
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9535
9605
|
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9536
9606
|
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
@@ -9576,6 +9646,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9576
9646
|
ipAddress: ipAddress
|
|
9577
9647
|
} : {}, userId ? {
|
|
9578
9648
|
userId: userId
|
|
9649
|
+
} : {}, ppid ? {
|
|
9650
|
+
ppid: ppid
|
|
9579
9651
|
} : {}, content.contentType ? {
|
|
9580
9652
|
contentType: content.contentType
|
|
9581
9653
|
} : {}, content.contentCategory ? {
|
|
@@ -9623,9 +9695,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9623
9695
|
isLat: envSignals.limitAdTracking,
|
|
9624
9696
|
dth: envSignals.deviceTypeHint,
|
|
9625
9697
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9698
|
+
ppidTail: ppid ? ppid.slice(-4) : void 0,
|
|
9626
9699
|
ct_ch: content.channelName,
|
|
9627
9700
|
ct_ti: content.programTitle,
|
|
9628
9701
|
ct_ne: content.contentNetwork,
|
|
9702
|
+
rating: content.contentRating,
|
|
9629
9703
|
ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
|
|
9630
9704
|
live: isLive,
|
|
9631
9705
|
player: playerSize,
|
|
@@ -11309,6 +11383,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11309
11383
|
this.adDetectSentForCurrentBreak = false;
|
|
11310
11384
|
this.slotState = "IDLE";
|
|
11311
11385
|
this.unusableResponsesInBreak = 0;
|
|
11386
|
+
this.playedAdIdsInBreak = /* @__PURE__ */ new Set();
|
|
11312
11387
|
this.controllerGeneration = 0;
|
|
11313
11388
|
this.requestDiagnostics = /* @__PURE__ */ new Map();
|
|
11314
11389
|
this.breakFunnel = {};
|
|
@@ -11405,6 +11480,11 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11405
11480
|
_this.recordRequestDiagnostic(payload);
|
|
11406
11481
|
});
|
|
11407
11482
|
adPlayer.on("ad_impression", function() {
|
|
11483
|
+
var _this_host_getAdPlayer_getLoadedAdId, _this_host_getAdPlayer;
|
|
11484
|
+
var impressionAdId = (_this_host_getAdPlayer_getLoadedAdId = (_this_host_getAdPlayer = _this.host.getAdPlayer()).getLoadedAdId) === null || _this_host_getAdPlayer_getLoadedAdId === void 0 ? void 0 : _this_host_getAdPlayer_getLoadedAdId.call(_this_host_getAdPlayer);
|
|
11485
|
+
if (impressionAdId != null && impressionAdId !== "") {
|
|
11486
|
+
_this.playedAdIdsInBreak.add(String(impressionAdId));
|
|
11487
|
+
}
|
|
11408
11488
|
_this.timing.consecutiveFailures = 0;
|
|
11409
11489
|
_this.setSlotState("PLAYING", "impression");
|
|
11410
11490
|
if (!_this.playbackStartedForCurrentRequest) {
|
|
@@ -11596,6 +11676,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11596
11676
|
this.resetEdgeStateForBreak();
|
|
11597
11677
|
this.followUpBaseVastUrl = void 0;
|
|
11598
11678
|
this.unusableResponsesInBreak = 0;
|
|
11679
|
+
this.playedAdIdsInBreak.clear();
|
|
11599
11680
|
this.timing.totalAdRequestsInBreak = 0;
|
|
11600
11681
|
this.setSlotState("NEEDS_NEXT_AD", "vmap_break_start");
|
|
11601
11682
|
this.noteOpportunity("vmap", breakKey, position);
|
|
@@ -11646,6 +11727,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11646
11727
|
this.breakSource = "scte35";
|
|
11647
11728
|
this.followUpBaseVastUrl = baseVastUrl;
|
|
11648
11729
|
this.unusableResponsesInBreak = 0;
|
|
11730
|
+
this.playedAdIdsInBreak.clear();
|
|
11649
11731
|
this.resetEdgeStateForBreak();
|
|
11650
11732
|
this.setSlotState("NEEDS_NEXT_AD", "scte35_break_start");
|
|
11651
11733
|
if (this.adConfig.podAssignedByPrefetch) {
|
|
@@ -12485,6 +12567,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12485
12567
|
var outcome;
|
|
12486
12568
|
if (message.includes("ad_duration_exceeds_budget")) {
|
|
12487
12569
|
outcome = "discarded_budget";
|
|
12570
|
+
} else if (message.includes("ad_repeated_in_break")) {
|
|
12571
|
+
outcome = "discarded_duplicate";
|
|
12488
12572
|
} else if (message.includes("VAST fill rejected")) {
|
|
12489
12573
|
outcome = "fill_rejected";
|
|
12490
12574
|
} else if (/no ads available|no fill|nofill/i.test(message)) {
|
|
@@ -12499,7 +12583,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12499
12583
|
outcome = "request_failed";
|
|
12500
12584
|
}
|
|
12501
12585
|
this.timing.consecutiveFailures++;
|
|
12502
|
-
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget") {
|
|
12586
|
+
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget" || outcome === "discarded_duplicate") {
|
|
12503
12587
|
this.unusableResponsesInBreak++;
|
|
12504
12588
|
}
|
|
12505
12589
|
if (outcome === "no_fill") {
|
|
@@ -12513,7 +12597,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12513
12597
|
}) ? diag.dispatchedUrl : vastTagUrl;
|
|
12514
12598
|
if (this.timing.isTemporaryAdError(error)) {
|
|
12515
12599
|
this.timing.temporaryFailureUrls.set(failureKey, Date.now());
|
|
12516
|
-
} else if (outcome !== "discarded_budget") {
|
|
12600
|
+
} else if (outcome !== "discarded_budget" && outcome !== "discarded_duplicate") {
|
|
12517
12601
|
this.timing.failedVastUrls.add(failureKey);
|
|
12518
12602
|
}
|
|
12519
12603
|
this.countFunnelStage("request_outcome:".concat(outcome));
|
|
@@ -12885,7 +12969,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12885
12969
|
value: function playSingleAd(vastTagUrl) {
|
|
12886
12970
|
var trigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "vmap";
|
|
12887
12971
|
return _async_to_generator(function() {
|
|
12888
|
-
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, finalizeRequestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
12972
|
+
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, _ref, _ap_getLoadedAdId, _ap_getPodAdCount, finalizeRequestUrl, loadedAdId, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
12889
12973
|
return _ts_generator(this, function(_state) {
|
|
12890
12974
|
switch(_state.label){
|
|
12891
12975
|
case 0:
|
|
@@ -12998,6 +13082,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12998
13082
|
vastUrl: (_this_currentVastUrl = this.currentVastUrl) !== null && _this_currentVastUrl !== void 0 ? _this_currentVastUrl : requestUrl,
|
|
12999
13083
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
13000
13084
|
}, this.analyticsContext).catch(function() {});
|
|
13085
|
+
loadedAdId = (_ap_getLoadedAdId = ap.getLoadedAdId) === null || _ap_getLoadedAdId === void 0 ? void 0 : _ap_getLoadedAdId.call(ap);
|
|
13086
|
+
if (!this.host.config.allowRepeatAdsInBreak && loadedAdId != null && loadedAdId !== "" && ((_ref = (_ap_getPodAdCount = ap.getPodAdCount) === null || _ap_getPodAdCount === void 0 ? void 0 : _ap_getPodAdCount.call(ap)) !== null && _ref !== void 0 ? _ref : 1) <= 1 && this.playedAdIdsInBreak.has(String(loadedAdId))) {
|
|
13087
|
+
if (this.debug) {
|
|
13088
|
+
console.log("[AD-DURATION] Rejected ad id=".concat(loadedAdId, ": already played in this break — requesting another ad"));
|
|
13089
|
+
}
|
|
13090
|
+
this.logOrchestratorFunnel("discarded_duplicate", {
|
|
13091
|
+
adId: String(loadedAdId)
|
|
13092
|
+
});
|
|
13093
|
+
throw new Error("ad_repeated_in_break");
|
|
13094
|
+
}
|
|
13001
13095
|
if (!this.timing.ensureLoadedAdFitsBudget(ap)) {
|
|
13002
13096
|
;
|
|
13003
13097
|
adDurationS = (_ap_getLoadedAdDuration = ap.getLoadedAdDuration) === null || _ap_getLoadedAdDuration === void 0 ? void 0 : _ap_getLoadedAdDuration.call(ap);
|
|
@@ -13051,6 +13145,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13051
13145
|
this.recordRequestFailure(error, vastTagUrl);
|
|
13052
13146
|
if ((error === null || error === void 0 ? void 0 : error.message) === "ad_duration_exceeds_budget") {
|
|
13053
13147
|
this.recreateAdController("discarded_budget");
|
|
13148
|
+
} else if ((error === null || error === void 0 ? void 0 : error.message) === "ad_repeated_in_break") {
|
|
13149
|
+
this.recreateAdController("discarded_duplicate");
|
|
13054
13150
|
}
|
|
13055
13151
|
throw error;
|
|
13056
13152
|
case 10:
|
|
@@ -13124,6 +13220,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13124
13220
|
tagAllowsAudio: count("tag_allows_audio"),
|
|
13125
13221
|
missingImpression: count("vast_missing_impression"),
|
|
13126
13222
|
discardedBudget: count("discarded_budget"),
|
|
13223
|
+
discardedDuplicate: count("discarded_duplicate"),
|
|
13127
13224
|
mediaCandidates: count("media_candidate:accepted") + count("media_candidate:rejected"),
|
|
13128
13225
|
mediaRejected: count("media_candidate:rejected"),
|
|
13129
13226
|
mediaFallbacks: count("media_fallback"),
|
|
@@ -13199,6 +13296,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13199
13296
|
this.breakSource = void 0;
|
|
13200
13297
|
this.followUpBaseVastUrl = void 0;
|
|
13201
13298
|
this.unusableResponsesInBreak = 0;
|
|
13299
|
+
this.playedAdIdsInBreak.clear();
|
|
13202
13300
|
this.resetEdgeStateForBreak();
|
|
13203
13301
|
adPlayer.stop().catch(function() {});
|
|
13204
13302
|
if (!alreadyEnded) this.logBreakFunnel(reason);
|
|
@@ -13299,9 +13397,18 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13299
13397
|
var maxMonitorMs = 45e3;
|
|
13300
13398
|
var startTime = Date.now();
|
|
13301
13399
|
var baseline = resumeBaseline;
|
|
13400
|
+
var lastSeenTime = resumeBaseline;
|
|
13302
13401
|
var recoveries = 0;
|
|
13303
13402
|
var lastRecoveryAt = 0;
|
|
13304
13403
|
var video = this.host.video;
|
|
13404
|
+
var onDecodeError = function onDecodeError() {
|
|
13405
|
+
var _video_error;
|
|
13406
|
+
if (needsReset || ((_video_error = video.error) === null || _video_error === void 0 ? void 0 : _video_error.code) !== 3) return;
|
|
13407
|
+
if (markSingleDecoderLearned() && _this.debug) {
|
|
13408
|
+
console.warn("[StormcloudVideoPlayer] Decoder error while resuming after ads \u2014 using single-decoder mode on this device from the next break");
|
|
13409
|
+
}
|
|
13410
|
+
};
|
|
13411
|
+
video.addEventListener("error", onDecodeError);
|
|
13305
13412
|
var listenersAttached = false;
|
|
13306
13413
|
var onMediaEvent;
|
|
13307
13414
|
var diagEvents = [
|
|
@@ -13351,6 +13458,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13351
13458
|
console.log("[ResumeDiag] +0.0s monitor start — ".concat(this.describeVideoState()));
|
|
13352
13459
|
}
|
|
13353
13460
|
var cleanup = function cleanup() {
|
|
13461
|
+
video.removeEventListener("error", onDecodeError);
|
|
13354
13462
|
if (listenersAttached && onMediaEvent) {
|
|
13355
13463
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
13356
13464
|
try {
|
|
@@ -13381,6 +13489,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13381
13489
|
return;
|
|
13382
13490
|
}
|
|
13383
13491
|
var currentTime = video.currentTime;
|
|
13492
|
+
if (currentTime + 1 < lastSeenTime) {
|
|
13493
|
+
baseline = currentTime;
|
|
13494
|
+
}
|
|
13495
|
+
lastSeenTime = currentTime;
|
|
13384
13496
|
var advanced = currentTime > baseline + 0.5;
|
|
13385
13497
|
var playing = !video.paused && video.readyState >= 3;
|
|
13386
13498
|
if (advanced && playing) {
|
|
@@ -14051,6 +14163,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14051
14163
|
var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
|
|
14052
14164
|
_this.adConfig.consentSignals = signals;
|
|
14053
14165
|
var muted = _this.video.muted;
|
|
14166
|
+
var palPpid = _this.currentPpid();
|
|
14054
14167
|
var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
|
|
14055
14168
|
var palOptions = _object_spread({
|
|
14056
14169
|
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
@@ -14067,9 +14180,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14067
14180
|
allowStorage: signals.storageAllowed
|
|
14068
14181
|
} : {}, palSessionId ? {
|
|
14069
14182
|
sessionId: palSessionId
|
|
14183
|
+
} : {}, palPpid ? {
|
|
14184
|
+
ppid: palPpid
|
|
14070
14185
|
} : {});
|
|
14071
14186
|
_this.lastPalOptions = palOptions;
|
|
14072
14187
|
_this.palSessionId = palSessionId;
|
|
14188
|
+
_this.palPpid = palPpid;
|
|
14073
14189
|
_this.startPalNonceRefresh();
|
|
14074
14190
|
return _this.palNonce.generateNonce(palOptions);
|
|
14075
14191
|
}).catch(function() {});
|
|
@@ -14128,26 +14244,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14128
14244
|
if (!options) return;
|
|
14129
14245
|
var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
|
|
14130
14246
|
var ageMs = this.palNonce.getNonceAgeMs();
|
|
14247
|
+
var ppid = this.currentPpid();
|
|
14248
|
+
var ppidChanged = ppid !== this.palPpid;
|
|
14131
14249
|
var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
|
|
14132
14250
|
var sessionChanged = sessionId !== this.palSessionId;
|
|
14133
14251
|
var stale = ageMs === void 0 || ageMs >= maxAgeMs;
|
|
14134
|
-
if (!force && !stale && !sessionChanged) return;
|
|
14252
|
+
if (!force && !stale && !sessionChanged && !ppidChanged) return;
|
|
14135
14253
|
var next = _object_spread({}, options);
|
|
14136
14254
|
if (sessionId) next.sessionId = sessionId;
|
|
14137
14255
|
else delete next.sessionId;
|
|
14256
|
+
if (ppid) next.ppid = ppid;
|
|
14257
|
+
else delete next.ppid;
|
|
14138
14258
|
this.lastPalOptions = next;
|
|
14139
14259
|
this.palSessionId = sessionId;
|
|
14260
|
+
this.palPpid = ppid;
|
|
14140
14261
|
if (this.debug) {
|
|
14141
14262
|
console.log("[PAL] Regenerating nonce", {
|
|
14142
14263
|
force: force,
|
|
14143
14264
|
stale: stale,
|
|
14144
14265
|
sessionChanged: sessionChanged,
|
|
14266
|
+
ppidChanged: ppidChanged,
|
|
14145
14267
|
ageMs: ageMs
|
|
14146
14268
|
});
|
|
14147
14269
|
}
|
|
14148
14270
|
this.palNonce.generateNonce(next).catch(function() {});
|
|
14149
14271
|
}
|
|
14150
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
|
+
},
|
|
14151
14285
|
{
|
|
14152
14286
|
key: "setAdIdentity",
|
|
14153
14287
|
value: function setAdIdentity(identity) {
|
|
@@ -14179,6 +14313,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14179
14313
|
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14180
14314
|
else delete this.config.clientIpAddress;
|
|
14181
14315
|
}
|
|
14316
|
+
if (signals.userId !== void 0) this.refreshPalNonceIfStale();
|
|
14182
14317
|
}
|
|
14183
14318
|
},
|
|
14184
14319
|
{
|