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