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/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;
|
|
@@ -1374,7 +1402,9 @@ var BRIDGE_KEYS = {
|
|
|
1374
1402
|
],
|
|
1375
1403
|
contentRating: [
|
|
1376
1404
|
"contentRating",
|
|
1377
|
-
"ctr"
|
|
1405
|
+
"ctr",
|
|
1406
|
+
"programRating",
|
|
1407
|
+
"rating"
|
|
1378
1408
|
],
|
|
1379
1409
|
contentId: [
|
|
1380
1410
|
"contentId",
|
|
@@ -1386,7 +1416,9 @@ function sanitizeContentValue(value) {
|
|
|
1386
1416
|
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
1387
1417
|
if (!cleaned) return void 0;
|
|
1388
1418
|
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
1389
|
-
if (/^(unknown|null|undefined|none|n\/a
|
|
1419
|
+
if (/^(unknown|null|undefined|none|n\/a|-|tbd|tba|to be (announced|determined))$/i.test(cleaned)) {
|
|
1420
|
+
return void 0;
|
|
1421
|
+
}
|
|
1390
1422
|
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
1391
1423
|
}
|
|
1392
1424
|
function sanitizeContentScalar(value) {
|
|
@@ -1512,6 +1544,7 @@ function resolveContentMetadata(config) {
|
|
|
1512
1544
|
} : {});
|
|
1513
1545
|
}
|
|
1514
1546
|
function applyContentMetadataUpdate(target, meta) {
|
|
1547
|
+
var _target_contentDetails;
|
|
1515
1548
|
var apply = function apply(key, value) {
|
|
1516
1549
|
if (value === void 0) return;
|
|
1517
1550
|
var clean = value === null ? void 0 : sanitizeContentValue(value);
|
|
@@ -1521,9 +1554,15 @@ function applyContentMetadataUpdate(target, meta) {
|
|
|
1521
1554
|
apply("channelName", meta.channelName);
|
|
1522
1555
|
apply("programTitle", meta.programTitle);
|
|
1523
1556
|
apply("contentNetwork", meta.contentNetwork);
|
|
1524
|
-
if (meta.details === void 0) return;
|
|
1525
1557
|
if (meta.details === null) delete target.contentDetails;
|
|
1526
|
-
else target.contentDetails = _object_spread({}, meta.details);
|
|
1558
|
+
else if (meta.details !== void 0) target.contentDetails = _object_spread({}, meta.details);
|
|
1559
|
+
var rating = meta.programRating !== void 0 ? meta.programRating : meta.contentRating;
|
|
1560
|
+
if (rating === void 0) return;
|
|
1561
|
+
var cleanRating = rating === null ? void 0 : sanitizeContentValue(rating);
|
|
1562
|
+
var details = _object_spread({}, (_target_contentDetails = target.contentDetails) !== null && _target_contentDetails !== void 0 ? _target_contentDetails : {});
|
|
1563
|
+
if (cleanRating) details.rating = cleanRating;
|
|
1564
|
+
else delete details.rating;
|
|
1565
|
+
target.contentDetails = details;
|
|
1527
1566
|
}
|
|
1528
1567
|
function appendMissingContentParams(url, meta) {
|
|
1529
1568
|
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
@@ -1616,6 +1655,11 @@ function sanitizePublicIp(value) {
|
|
|
1616
1655
|
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1617
1656
|
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1618
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
|
+
}
|
|
1619
1663
|
function resolveUserId(configValue) {
|
|
1620
1664
|
var _sanitizeUserId;
|
|
1621
1665
|
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
@@ -2024,6 +2068,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
2024
2068
|
set("UA", ctx.userAgent);
|
|
2025
2069
|
set("IP", ctx.ipAddress);
|
|
2026
2070
|
set("UID", ctx.userId);
|
|
2071
|
+
set("PPID", ctx.ppid);
|
|
2027
2072
|
set("CT-TYPE", ctx.contentType);
|
|
2028
2073
|
set("CT-CATEGORY", ctx.contentCategory);
|
|
2029
2074
|
set("CT-GENRE", ctx.contentGenre);
|
|
@@ -2919,9 +2964,30 @@ function detectBrowser() {
|
|
|
2919
2964
|
};
|
|
2920
2965
|
}
|
|
2921
2966
|
var singleDecoderOverride;
|
|
2967
|
+
var LEARNED_SINGLE_DECODER_KEY = "stormcloud.singleDecoder.learned.v1";
|
|
2968
|
+
var learnedSingleDecoder;
|
|
2922
2969
|
function setSingleDecoderOverride(value) {
|
|
2923
2970
|
singleDecoderOverride = value;
|
|
2924
2971
|
}
|
|
2972
|
+
function readLearnedSingleDecoder() {
|
|
2973
|
+
if (learnedSingleDecoder !== void 0) return learnedSingleDecoder;
|
|
2974
|
+
try {
|
|
2975
|
+
var _window_localStorage;
|
|
2976
|
+
learnedSingleDecoder = typeof window !== "undefined" && ((_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(LEARNED_SINGLE_DECODER_KEY)) === "1";
|
|
2977
|
+
} catch (unused) {
|
|
2978
|
+
learnedSingleDecoder = false;
|
|
2979
|
+
}
|
|
2980
|
+
return learnedSingleDecoder;
|
|
2981
|
+
}
|
|
2982
|
+
function markSingleDecoderLearned() {
|
|
2983
|
+
if (readLearnedSingleDecoder()) return false;
|
|
2984
|
+
learnedSingleDecoder = true;
|
|
2985
|
+
try {
|
|
2986
|
+
var _window_localStorage;
|
|
2987
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(LEARNED_SINGLE_DECODER_KEY, "1");
|
|
2988
|
+
} catch (unused) {}
|
|
2989
|
+
return true;
|
|
2990
|
+
}
|
|
2925
2991
|
function requiresMediaPipelineResetAfterAds() {
|
|
2926
2992
|
var _browser_tizenVersion;
|
|
2927
2993
|
if (singleDecoderOverride != null) return singleDecoderOverride;
|
|
@@ -2929,6 +2995,7 @@ function requiresMediaPipelineResetAfterAds() {
|
|
|
2929
2995
|
var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
|
|
2930
2996
|
if (typeof globalOverride === "boolean") return globalOverride;
|
|
2931
2997
|
} catch (unused) {}
|
|
2998
|
+
if (readLearnedSingleDecoder()) return true;
|
|
2932
2999
|
var browser = detectBrowser();
|
|
2933
3000
|
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
2934
3001
|
}
|
|
@@ -9602,6 +9669,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9602
9669
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9603
9670
|
var _content_contentDurationSeconds;
|
|
9604
9671
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9672
|
+
var stayUserId = resolveUserId(this.config.adUserId);
|
|
9673
|
+
noteStayId(stayUserId);
|
|
9605
9674
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9606
9675
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9607
9676
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
@@ -9612,7 +9681,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9612
9681
|
var playerSize = resolvePlayerSize(this.video);
|
|
9613
9682
|
var videoDuration = this.video.duration;
|
|
9614
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;
|
|
9615
|
-
var userId =
|
|
9684
|
+
var userId = envSignals.limitAdTracking === true ? void 0 : stayUserId;
|
|
9685
|
+
var ppid = toPpid(stayUserId, envSignals.limitAdTracking);
|
|
9616
9686
|
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9617
9687
|
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9618
9688
|
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
@@ -9658,6 +9728,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9658
9728
|
ipAddress: ipAddress
|
|
9659
9729
|
} : {}, userId ? {
|
|
9660
9730
|
userId: userId
|
|
9731
|
+
} : {}, ppid ? {
|
|
9732
|
+
ppid: ppid
|
|
9661
9733
|
} : {}, content.contentType ? {
|
|
9662
9734
|
contentType: content.contentType
|
|
9663
9735
|
} : {}, content.contentCategory ? {
|
|
@@ -9705,9 +9777,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9705
9777
|
isLat: envSignals.limitAdTracking,
|
|
9706
9778
|
dth: envSignals.deviceTypeHint,
|
|
9707
9779
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9780
|
+
ppidTail: ppid ? ppid.slice(-4) : void 0,
|
|
9708
9781
|
ct_ch: content.channelName,
|
|
9709
9782
|
ct_ti: content.programTitle,
|
|
9710
9783
|
ct_ne: content.contentNetwork,
|
|
9784
|
+
rating: content.contentRating,
|
|
9711
9785
|
ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
|
|
9712
9786
|
live: isLive,
|
|
9713
9787
|
player: playerSize,
|
|
@@ -11391,6 +11465,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11391
11465
|
this.adDetectSentForCurrentBreak = false;
|
|
11392
11466
|
this.slotState = "IDLE";
|
|
11393
11467
|
this.unusableResponsesInBreak = 0;
|
|
11468
|
+
this.playedAdIdsInBreak = /* @__PURE__ */ new Set();
|
|
11394
11469
|
this.controllerGeneration = 0;
|
|
11395
11470
|
this.requestDiagnostics = /* @__PURE__ */ new Map();
|
|
11396
11471
|
this.breakFunnel = {};
|
|
@@ -11487,6 +11562,11 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11487
11562
|
_this.recordRequestDiagnostic(payload);
|
|
11488
11563
|
});
|
|
11489
11564
|
adPlayer.on("ad_impression", function() {
|
|
11565
|
+
var _this_host_getAdPlayer_getLoadedAdId, _this_host_getAdPlayer;
|
|
11566
|
+
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);
|
|
11567
|
+
if (impressionAdId != null && impressionAdId !== "") {
|
|
11568
|
+
_this.playedAdIdsInBreak.add(String(impressionAdId));
|
|
11569
|
+
}
|
|
11490
11570
|
_this.timing.consecutiveFailures = 0;
|
|
11491
11571
|
_this.setSlotState("PLAYING", "impression");
|
|
11492
11572
|
if (!_this.playbackStartedForCurrentRequest) {
|
|
@@ -11678,6 +11758,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11678
11758
|
this.resetEdgeStateForBreak();
|
|
11679
11759
|
this.followUpBaseVastUrl = void 0;
|
|
11680
11760
|
this.unusableResponsesInBreak = 0;
|
|
11761
|
+
this.playedAdIdsInBreak.clear();
|
|
11681
11762
|
this.timing.totalAdRequestsInBreak = 0;
|
|
11682
11763
|
this.setSlotState("NEEDS_NEXT_AD", "vmap_break_start");
|
|
11683
11764
|
this.noteOpportunity("vmap", breakKey, position);
|
|
@@ -11728,6 +11809,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11728
11809
|
this.breakSource = "scte35";
|
|
11729
11810
|
this.followUpBaseVastUrl = baseVastUrl;
|
|
11730
11811
|
this.unusableResponsesInBreak = 0;
|
|
11812
|
+
this.playedAdIdsInBreak.clear();
|
|
11731
11813
|
this.resetEdgeStateForBreak();
|
|
11732
11814
|
this.setSlotState("NEEDS_NEXT_AD", "scte35_break_start");
|
|
11733
11815
|
if (this.adConfig.podAssignedByPrefetch) {
|
|
@@ -12567,6 +12649,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12567
12649
|
var outcome;
|
|
12568
12650
|
if (message.includes("ad_duration_exceeds_budget")) {
|
|
12569
12651
|
outcome = "discarded_budget";
|
|
12652
|
+
} else if (message.includes("ad_repeated_in_break")) {
|
|
12653
|
+
outcome = "discarded_duplicate";
|
|
12570
12654
|
} else if (message.includes("VAST fill rejected")) {
|
|
12571
12655
|
outcome = "fill_rejected";
|
|
12572
12656
|
} else if (/no ads available|no fill|nofill/i.test(message)) {
|
|
@@ -12581,7 +12665,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12581
12665
|
outcome = "request_failed";
|
|
12582
12666
|
}
|
|
12583
12667
|
this.timing.consecutiveFailures++;
|
|
12584
|
-
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget") {
|
|
12668
|
+
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget" || outcome === "discarded_duplicate") {
|
|
12585
12669
|
this.unusableResponsesInBreak++;
|
|
12586
12670
|
}
|
|
12587
12671
|
if (outcome === "no_fill") {
|
|
@@ -12595,7 +12679,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12595
12679
|
}) ? diag.dispatchedUrl : vastTagUrl;
|
|
12596
12680
|
if (this.timing.isTemporaryAdError(error)) {
|
|
12597
12681
|
this.timing.temporaryFailureUrls.set(failureKey, Date.now());
|
|
12598
|
-
} else if (outcome !== "discarded_budget") {
|
|
12682
|
+
} else if (outcome !== "discarded_budget" && outcome !== "discarded_duplicate") {
|
|
12599
12683
|
this.timing.failedVastUrls.add(failureKey);
|
|
12600
12684
|
}
|
|
12601
12685
|
this.countFunnelStage("request_outcome:".concat(outcome));
|
|
@@ -12967,7 +13051,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12967
13051
|
value: function playSingleAd(vastTagUrl) {
|
|
12968
13052
|
var trigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "vmap";
|
|
12969
13053
|
return _async_to_generator(function() {
|
|
12970
|
-
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, finalizeRequestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
13054
|
+
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, _ref, _ap_getLoadedAdId, _ap_getPodAdCount, finalizeRequestUrl, loadedAdId, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
12971
13055
|
return _ts_generator(this, function(_state) {
|
|
12972
13056
|
switch(_state.label){
|
|
12973
13057
|
case 0:
|
|
@@ -13080,6 +13164,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13080
13164
|
vastUrl: (_this_currentVastUrl = this.currentVastUrl) !== null && _this_currentVastUrl !== void 0 ? _this_currentVastUrl : requestUrl,
|
|
13081
13165
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
13082
13166
|
}, this.analyticsContext).catch(function() {});
|
|
13167
|
+
loadedAdId = (_ap_getLoadedAdId = ap.getLoadedAdId) === null || _ap_getLoadedAdId === void 0 ? void 0 : _ap_getLoadedAdId.call(ap);
|
|
13168
|
+
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))) {
|
|
13169
|
+
if (this.debug) {
|
|
13170
|
+
console.log("[AD-DURATION] Rejected ad id=".concat(loadedAdId, ": already played in this break — requesting another ad"));
|
|
13171
|
+
}
|
|
13172
|
+
this.logOrchestratorFunnel("discarded_duplicate", {
|
|
13173
|
+
adId: String(loadedAdId)
|
|
13174
|
+
});
|
|
13175
|
+
throw new Error("ad_repeated_in_break");
|
|
13176
|
+
}
|
|
13083
13177
|
if (!this.timing.ensureLoadedAdFitsBudget(ap)) {
|
|
13084
13178
|
;
|
|
13085
13179
|
adDurationS = (_ap_getLoadedAdDuration = ap.getLoadedAdDuration) === null || _ap_getLoadedAdDuration === void 0 ? void 0 : _ap_getLoadedAdDuration.call(ap);
|
|
@@ -13133,6 +13227,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13133
13227
|
this.recordRequestFailure(error, vastTagUrl);
|
|
13134
13228
|
if ((error === null || error === void 0 ? void 0 : error.message) === "ad_duration_exceeds_budget") {
|
|
13135
13229
|
this.recreateAdController("discarded_budget");
|
|
13230
|
+
} else if ((error === null || error === void 0 ? void 0 : error.message) === "ad_repeated_in_break") {
|
|
13231
|
+
this.recreateAdController("discarded_duplicate");
|
|
13136
13232
|
}
|
|
13137
13233
|
throw error;
|
|
13138
13234
|
case 10:
|
|
@@ -13206,6 +13302,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13206
13302
|
tagAllowsAudio: count("tag_allows_audio"),
|
|
13207
13303
|
missingImpression: count("vast_missing_impression"),
|
|
13208
13304
|
discardedBudget: count("discarded_budget"),
|
|
13305
|
+
discardedDuplicate: count("discarded_duplicate"),
|
|
13209
13306
|
mediaCandidates: count("media_candidate:accepted") + count("media_candidate:rejected"),
|
|
13210
13307
|
mediaRejected: count("media_candidate:rejected"),
|
|
13211
13308
|
mediaFallbacks: count("media_fallback"),
|
|
@@ -13281,6 +13378,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13281
13378
|
this.breakSource = void 0;
|
|
13282
13379
|
this.followUpBaseVastUrl = void 0;
|
|
13283
13380
|
this.unusableResponsesInBreak = 0;
|
|
13381
|
+
this.playedAdIdsInBreak.clear();
|
|
13284
13382
|
this.resetEdgeStateForBreak();
|
|
13285
13383
|
adPlayer.stop().catch(function() {});
|
|
13286
13384
|
if (!alreadyEnded) this.logBreakFunnel(reason);
|
|
@@ -13381,9 +13479,18 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13381
13479
|
var maxMonitorMs = 45e3;
|
|
13382
13480
|
var startTime = Date.now();
|
|
13383
13481
|
var baseline = resumeBaseline;
|
|
13482
|
+
var lastSeenTime = resumeBaseline;
|
|
13384
13483
|
var recoveries = 0;
|
|
13385
13484
|
var lastRecoveryAt = 0;
|
|
13386
13485
|
var video = this.host.video;
|
|
13486
|
+
var onDecodeError = function onDecodeError() {
|
|
13487
|
+
var _video_error;
|
|
13488
|
+
if (needsReset || ((_video_error = video.error) === null || _video_error === void 0 ? void 0 : _video_error.code) !== 3) return;
|
|
13489
|
+
if (markSingleDecoderLearned() && _this.debug) {
|
|
13490
|
+
console.warn("[StormcloudVideoPlayer] Decoder error while resuming after ads \u2014 using single-decoder mode on this device from the next break");
|
|
13491
|
+
}
|
|
13492
|
+
};
|
|
13493
|
+
video.addEventListener("error", onDecodeError);
|
|
13387
13494
|
var listenersAttached = false;
|
|
13388
13495
|
var onMediaEvent;
|
|
13389
13496
|
var diagEvents = [
|
|
@@ -13433,6 +13540,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13433
13540
|
console.log("[ResumeDiag] +0.0s monitor start — ".concat(this.describeVideoState()));
|
|
13434
13541
|
}
|
|
13435
13542
|
var cleanup = function cleanup() {
|
|
13543
|
+
video.removeEventListener("error", onDecodeError);
|
|
13436
13544
|
if (listenersAttached && onMediaEvent) {
|
|
13437
13545
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
13438
13546
|
try {
|
|
@@ -13463,6 +13571,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13463
13571
|
return;
|
|
13464
13572
|
}
|
|
13465
13573
|
var currentTime = video.currentTime;
|
|
13574
|
+
if (currentTime + 1 < lastSeenTime) {
|
|
13575
|
+
baseline = currentTime;
|
|
13576
|
+
}
|
|
13577
|
+
lastSeenTime = currentTime;
|
|
13466
13578
|
var advanced = currentTime > baseline + 0.5;
|
|
13467
13579
|
var playing = !video.paused && video.readyState >= 3;
|
|
13468
13580
|
if (advanced && playing) {
|
|
@@ -14133,6 +14245,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14133
14245
|
var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
|
|
14134
14246
|
_this.adConfig.consentSignals = signals;
|
|
14135
14247
|
var muted = _this.video.muted;
|
|
14248
|
+
var palPpid = _this.currentPpid();
|
|
14136
14249
|
var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
|
|
14137
14250
|
var palOptions = _object_spread({
|
|
14138
14251
|
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
@@ -14149,9 +14262,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14149
14262
|
allowStorage: signals.storageAllowed
|
|
14150
14263
|
} : {}, palSessionId ? {
|
|
14151
14264
|
sessionId: palSessionId
|
|
14265
|
+
} : {}, palPpid ? {
|
|
14266
|
+
ppid: palPpid
|
|
14152
14267
|
} : {});
|
|
14153
14268
|
_this.lastPalOptions = palOptions;
|
|
14154
14269
|
_this.palSessionId = palSessionId;
|
|
14270
|
+
_this.palPpid = palPpid;
|
|
14155
14271
|
_this.startPalNonceRefresh();
|
|
14156
14272
|
return _this.palNonce.generateNonce(palOptions);
|
|
14157
14273
|
}).catch(function() {});
|
|
@@ -14210,26 +14326,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14210
14326
|
if (!options) return;
|
|
14211
14327
|
var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
|
|
14212
14328
|
var ageMs = this.palNonce.getNonceAgeMs();
|
|
14329
|
+
var ppid = this.currentPpid();
|
|
14330
|
+
var ppidChanged = ppid !== this.palPpid;
|
|
14213
14331
|
var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
|
|
14214
14332
|
var sessionChanged = sessionId !== this.palSessionId;
|
|
14215
14333
|
var stale = ageMs === void 0 || ageMs >= maxAgeMs;
|
|
14216
|
-
if (!force && !stale && !sessionChanged) return;
|
|
14334
|
+
if (!force && !stale && !sessionChanged && !ppidChanged) return;
|
|
14217
14335
|
var next = _object_spread({}, options);
|
|
14218
14336
|
if (sessionId) next.sessionId = sessionId;
|
|
14219
14337
|
else delete next.sessionId;
|
|
14338
|
+
if (ppid) next.ppid = ppid;
|
|
14339
|
+
else delete next.ppid;
|
|
14220
14340
|
this.lastPalOptions = next;
|
|
14221
14341
|
this.palSessionId = sessionId;
|
|
14342
|
+
this.palPpid = ppid;
|
|
14222
14343
|
if (this.debug) {
|
|
14223
14344
|
console.log("[PAL] Regenerating nonce", {
|
|
14224
14345
|
force: force,
|
|
14225
14346
|
stale: stale,
|
|
14226
14347
|
sessionChanged: sessionChanged,
|
|
14348
|
+
ppidChanged: ppidChanged,
|
|
14227
14349
|
ageMs: ageMs
|
|
14228
14350
|
});
|
|
14229
14351
|
}
|
|
14230
14352
|
this.palNonce.generateNonce(next).catch(function() {});
|
|
14231
14353
|
}
|
|
14232
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
|
+
},
|
|
14233
14367
|
{
|
|
14234
14368
|
key: "setAdIdentity",
|
|
14235
14369
|
value: function setAdIdentity(identity) {
|
|
@@ -14261,6 +14395,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14261
14395
|
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14262
14396
|
else delete this.config.clientIpAddress;
|
|
14263
14397
|
}
|
|
14398
|
+
if (signals.userId !== void 0) this.refreshPalNonceIfStale();
|
|
14264
14399
|
}
|
|
14265
14400
|
},
|
|
14266
14401
|
{
|