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/Player.d.cts
CHANGED
|
@@ -14,7 +14,7 @@ interface PlayerProps extends BaseStormcloudPlayerProps {
|
|
|
14
14
|
}
|
|
15
15
|
declare class Player extends Component<PlayerProps> {
|
|
16
16
|
static displayName: string;
|
|
17
|
-
static defaultProps: Required<Omit<BaseStormcloudPlayerProps, "
|
|
17
|
+
static defaultProps: Required<Omit<BaseStormcloudPlayerProps, "maxAdBreakExtensionMs" | "minRemainingMsToRequestAd" | "maxNoFillsPerBreak" | "vastTagUrl" | "ctvAdRequest" | keyof React.VideoHTMLAttributes<HTMLVideoElement> | "onReady">>;
|
|
18
18
|
private mounted;
|
|
19
19
|
private isReady;
|
|
20
20
|
private isPlaying;
|
package/lib/StormcloudPlayer.cjs
CHANGED
|
@@ -434,6 +434,9 @@ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
|
|
|
434
434
|
var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
|
|
435
435
|
var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
|
|
436
436
|
var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
|
|
437
|
+
var STAY_ID_KEY = "stormcloud.ad.stay.v1";
|
|
438
|
+
var HOST_ID_KEY = "stormcloud.ad.host.v1";
|
|
439
|
+
var memoryMarkers = {};
|
|
437
440
|
var ZEROED_IDS = /* @__PURE__ */ new Set([
|
|
438
441
|
"00000000-0000-0000-0000-000000000000",
|
|
439
442
|
"38400000-8cf0-11bd-b23e-10b96e40000d"
|
|
@@ -536,7 +539,7 @@ function setHostAdIdentity(identity) {
|
|
|
536
539
|
return;
|
|
537
540
|
}
|
|
538
541
|
var deviceId = identity.deviceId.trim();
|
|
539
|
-
var changed =
|
|
542
|
+
var changed = writeMarkerIfChanged(HOST_ID_KEY, deviceId);
|
|
540
543
|
hostIdentity = _object_spread({
|
|
541
544
|
deviceId: deviceId,
|
|
542
545
|
deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
@@ -555,6 +558,31 @@ function resetAdIdentity() {
|
|
|
555
558
|
removeStored(SESSION_ID_KEY);
|
|
556
559
|
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
557
560
|
}
|
|
561
|
+
function writeMarkerIfChanged(key, value) {
|
|
562
|
+
var _memoryMarkers_key;
|
|
563
|
+
var previous = (_memoryMarkers_key = memoryMarkers[key]) !== null && _memoryMarkers_key !== void 0 ? _memoryMarkers_key : "";
|
|
564
|
+
try {
|
|
565
|
+
var _window_localStorage;
|
|
566
|
+
var stored = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
|
|
567
|
+
if (typeof stored === "string") previous = stored;
|
|
568
|
+
} catch (unused) {}
|
|
569
|
+
if (value === previous) return false;
|
|
570
|
+
memoryMarkers[key] = value;
|
|
571
|
+
try {
|
|
572
|
+
if (typeof window !== "undefined") {
|
|
573
|
+
var _window_localStorage1, _window_localStorage2;
|
|
574
|
+
if (value) (_window_localStorage1 = window.localStorage) === null || _window_localStorage1 === void 0 ? void 0 : _window_localStorage1.setItem(key, value);
|
|
575
|
+
else (_window_localStorage2 = window.localStorage) === null || _window_localStorage2 === void 0 ? void 0 : _window_localStorage2.removeItem(key);
|
|
576
|
+
}
|
|
577
|
+
} catch (unused) {}
|
|
578
|
+
return true;
|
|
579
|
+
}
|
|
580
|
+
function noteStayId(stayId) {
|
|
581
|
+
if (!writeMarkerIfChanged(STAY_ID_KEY, stayId ? stayId.trim() : "")) return false;
|
|
582
|
+
removeStored(SESSION_ID_KEY);
|
|
583
|
+
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
584
|
+
return true;
|
|
585
|
+
}
|
|
558
586
|
function readSamsungTifa() {
|
|
559
587
|
try {
|
|
560
588
|
var _window_webapis;
|
|
@@ -1341,7 +1369,9 @@ var BRIDGE_KEYS = {
|
|
|
1341
1369
|
],
|
|
1342
1370
|
contentRating: [
|
|
1343
1371
|
"contentRating",
|
|
1344
|
-
"ctr"
|
|
1372
|
+
"ctr",
|
|
1373
|
+
"programRating",
|
|
1374
|
+
"rating"
|
|
1345
1375
|
],
|
|
1346
1376
|
contentId: [
|
|
1347
1377
|
"contentId",
|
|
@@ -1353,7 +1383,9 @@ function sanitizeContentValue(value) {
|
|
|
1353
1383
|
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
1354
1384
|
if (!cleaned) return void 0;
|
|
1355
1385
|
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
1356
|
-
if (/^(unknown|null|undefined|none|n\/a
|
|
1386
|
+
if (/^(unknown|null|undefined|none|n\/a|-|tbd|tba|to be (announced|determined))$/i.test(cleaned)) {
|
|
1387
|
+
return void 0;
|
|
1388
|
+
}
|
|
1357
1389
|
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
1358
1390
|
}
|
|
1359
1391
|
function sanitizeContentScalar(value) {
|
|
@@ -1479,6 +1511,7 @@ function resolveContentMetadata(config) {
|
|
|
1479
1511
|
} : {});
|
|
1480
1512
|
}
|
|
1481
1513
|
function applyContentMetadataUpdate(target, meta) {
|
|
1514
|
+
var _target_contentDetails;
|
|
1482
1515
|
var apply = function apply(key, value) {
|
|
1483
1516
|
if (value === void 0) return;
|
|
1484
1517
|
var clean = value === null ? void 0 : sanitizeContentValue(value);
|
|
@@ -1488,9 +1521,15 @@ function applyContentMetadataUpdate(target, meta) {
|
|
|
1488
1521
|
apply("channelName", meta.channelName);
|
|
1489
1522
|
apply("programTitle", meta.programTitle);
|
|
1490
1523
|
apply("contentNetwork", meta.contentNetwork);
|
|
1491
|
-
if (meta.details === void 0) return;
|
|
1492
1524
|
if (meta.details === null) delete target.contentDetails;
|
|
1493
|
-
else target.contentDetails = _object_spread({}, meta.details);
|
|
1525
|
+
else if (meta.details !== void 0) target.contentDetails = _object_spread({}, meta.details);
|
|
1526
|
+
var rating = meta.programRating !== void 0 ? meta.programRating : meta.contentRating;
|
|
1527
|
+
if (rating === void 0) return;
|
|
1528
|
+
var cleanRating = rating === null ? void 0 : sanitizeContentValue(rating);
|
|
1529
|
+
var details = _object_spread({}, (_target_contentDetails = target.contentDetails) !== null && _target_contentDetails !== void 0 ? _target_contentDetails : {});
|
|
1530
|
+
if (cleanRating) details.rating = cleanRating;
|
|
1531
|
+
else delete details.rating;
|
|
1532
|
+
target.contentDetails = details;
|
|
1494
1533
|
}
|
|
1495
1534
|
function appendMissingContentParams(url, meta) {
|
|
1496
1535
|
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
@@ -1583,6 +1622,11 @@ function sanitizePublicIp(value) {
|
|
|
1583
1622
|
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1584
1623
|
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1585
1624
|
}
|
|
1625
|
+
var PPID_PATTERN = /^[0-9a-zA-Z+.=\/_\-$,{}]{22,150}$/;
|
|
1626
|
+
function toPpid(userId, limitAdTracking) {
|
|
1627
|
+
if (!userId || limitAdTracking === true) return void 0;
|
|
1628
|
+
return PPID_PATTERN.test(userId) ? userId : void 0;
|
|
1629
|
+
}
|
|
1586
1630
|
function resolveUserId(configValue) {
|
|
1587
1631
|
var _sanitizeUserId;
|
|
1588
1632
|
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
@@ -1991,6 +2035,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1991
2035
|
set("UA", ctx.userAgent);
|
|
1992
2036
|
set("IP", ctx.ipAddress);
|
|
1993
2037
|
set("UID", ctx.userId);
|
|
2038
|
+
set("PPID", ctx.ppid);
|
|
1994
2039
|
set("CT-TYPE", ctx.contentType);
|
|
1995
2040
|
set("CT-CATEGORY", ctx.contentCategory);
|
|
1996
2041
|
set("CT-GENRE", ctx.contentGenre);
|
|
@@ -2886,9 +2931,30 @@ function detectBrowser() {
|
|
|
2886
2931
|
};
|
|
2887
2932
|
}
|
|
2888
2933
|
var singleDecoderOverride;
|
|
2934
|
+
var LEARNED_SINGLE_DECODER_KEY = "stormcloud.singleDecoder.learned.v1";
|
|
2935
|
+
var learnedSingleDecoder;
|
|
2889
2936
|
function setSingleDecoderOverride(value) {
|
|
2890
2937
|
singleDecoderOverride = value;
|
|
2891
2938
|
}
|
|
2939
|
+
function readLearnedSingleDecoder() {
|
|
2940
|
+
if (learnedSingleDecoder !== void 0) return learnedSingleDecoder;
|
|
2941
|
+
try {
|
|
2942
|
+
var _window_localStorage;
|
|
2943
|
+
learnedSingleDecoder = typeof window !== "undefined" && ((_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(LEARNED_SINGLE_DECODER_KEY)) === "1";
|
|
2944
|
+
} catch (unused) {
|
|
2945
|
+
learnedSingleDecoder = false;
|
|
2946
|
+
}
|
|
2947
|
+
return learnedSingleDecoder;
|
|
2948
|
+
}
|
|
2949
|
+
function markSingleDecoderLearned() {
|
|
2950
|
+
if (readLearnedSingleDecoder()) return false;
|
|
2951
|
+
learnedSingleDecoder = true;
|
|
2952
|
+
try {
|
|
2953
|
+
var _window_localStorage;
|
|
2954
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(LEARNED_SINGLE_DECODER_KEY, "1");
|
|
2955
|
+
} catch (unused) {}
|
|
2956
|
+
return true;
|
|
2957
|
+
}
|
|
2892
2958
|
function requiresMediaPipelineResetAfterAds() {
|
|
2893
2959
|
var _browser_tizenVersion;
|
|
2894
2960
|
if (singleDecoderOverride != null) return singleDecoderOverride;
|
|
@@ -2896,6 +2962,7 @@ function requiresMediaPipelineResetAfterAds() {
|
|
|
2896
2962
|
var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
|
|
2897
2963
|
if (typeof globalOverride === "boolean") return globalOverride;
|
|
2898
2964
|
} catch (unused) {}
|
|
2965
|
+
if (readLearnedSingleDecoder()) return true;
|
|
2899
2966
|
var browser = detectBrowser();
|
|
2900
2967
|
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
2901
2968
|
}
|
|
@@ -9569,6 +9636,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9569
9636
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9570
9637
|
var _content_contentDurationSeconds;
|
|
9571
9638
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9639
|
+
var stayUserId = resolveUserId(this.config.adUserId);
|
|
9640
|
+
noteStayId(stayUserId);
|
|
9572
9641
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9573
9642
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9574
9643
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
@@ -9579,7 +9648,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9579
9648
|
var playerSize = resolvePlayerSize(this.video);
|
|
9580
9649
|
var videoDuration = this.video.duration;
|
|
9581
9650
|
var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
|
|
9582
|
-
var userId =
|
|
9651
|
+
var userId = envSignals.limitAdTracking === true ? void 0 : stayUserId;
|
|
9652
|
+
var ppid = toPpid(stayUserId, envSignals.limitAdTracking);
|
|
9583
9653
|
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9584
9654
|
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9585
9655
|
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
@@ -9625,6 +9695,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9625
9695
|
ipAddress: ipAddress
|
|
9626
9696
|
} : {}, userId ? {
|
|
9627
9697
|
userId: userId
|
|
9698
|
+
} : {}, ppid ? {
|
|
9699
|
+
ppid: ppid
|
|
9628
9700
|
} : {}, content.contentType ? {
|
|
9629
9701
|
contentType: content.contentType
|
|
9630
9702
|
} : {}, content.contentCategory ? {
|
|
@@ -9672,9 +9744,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9672
9744
|
isLat: envSignals.limitAdTracking,
|
|
9673
9745
|
dth: envSignals.deviceTypeHint,
|
|
9674
9746
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9747
|
+
ppidTail: ppid ? ppid.slice(-4) : void 0,
|
|
9675
9748
|
ct_ch: content.channelName,
|
|
9676
9749
|
ct_ti: content.programTitle,
|
|
9677
9750
|
ct_ne: content.contentNetwork,
|
|
9751
|
+
rating: content.contentRating,
|
|
9678
9752
|
ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
|
|
9679
9753
|
live: isLive,
|
|
9680
9754
|
player: playerSize,
|
|
@@ -11358,6 +11432,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11358
11432
|
this.adDetectSentForCurrentBreak = false;
|
|
11359
11433
|
this.slotState = "IDLE";
|
|
11360
11434
|
this.unusableResponsesInBreak = 0;
|
|
11435
|
+
this.playedAdIdsInBreak = /* @__PURE__ */ new Set();
|
|
11361
11436
|
this.controllerGeneration = 0;
|
|
11362
11437
|
this.requestDiagnostics = /* @__PURE__ */ new Map();
|
|
11363
11438
|
this.breakFunnel = {};
|
|
@@ -11454,6 +11529,11 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11454
11529
|
_this.recordRequestDiagnostic(payload);
|
|
11455
11530
|
});
|
|
11456
11531
|
adPlayer.on("ad_impression", function() {
|
|
11532
|
+
var _this_host_getAdPlayer_getLoadedAdId, _this_host_getAdPlayer;
|
|
11533
|
+
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);
|
|
11534
|
+
if (impressionAdId != null && impressionAdId !== "") {
|
|
11535
|
+
_this.playedAdIdsInBreak.add(String(impressionAdId));
|
|
11536
|
+
}
|
|
11457
11537
|
_this.timing.consecutiveFailures = 0;
|
|
11458
11538
|
_this.setSlotState("PLAYING", "impression");
|
|
11459
11539
|
if (!_this.playbackStartedForCurrentRequest) {
|
|
@@ -11645,6 +11725,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11645
11725
|
this.resetEdgeStateForBreak();
|
|
11646
11726
|
this.followUpBaseVastUrl = void 0;
|
|
11647
11727
|
this.unusableResponsesInBreak = 0;
|
|
11728
|
+
this.playedAdIdsInBreak.clear();
|
|
11648
11729
|
this.timing.totalAdRequestsInBreak = 0;
|
|
11649
11730
|
this.setSlotState("NEEDS_NEXT_AD", "vmap_break_start");
|
|
11650
11731
|
this.noteOpportunity("vmap", breakKey, position);
|
|
@@ -11695,6 +11776,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11695
11776
|
this.breakSource = "scte35";
|
|
11696
11777
|
this.followUpBaseVastUrl = baseVastUrl;
|
|
11697
11778
|
this.unusableResponsesInBreak = 0;
|
|
11779
|
+
this.playedAdIdsInBreak.clear();
|
|
11698
11780
|
this.resetEdgeStateForBreak();
|
|
11699
11781
|
this.setSlotState("NEEDS_NEXT_AD", "scte35_break_start");
|
|
11700
11782
|
if (this.adConfig.podAssignedByPrefetch) {
|
|
@@ -12534,6 +12616,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12534
12616
|
var outcome;
|
|
12535
12617
|
if (message.includes("ad_duration_exceeds_budget")) {
|
|
12536
12618
|
outcome = "discarded_budget";
|
|
12619
|
+
} else if (message.includes("ad_repeated_in_break")) {
|
|
12620
|
+
outcome = "discarded_duplicate";
|
|
12537
12621
|
} else if (message.includes("VAST fill rejected")) {
|
|
12538
12622
|
outcome = "fill_rejected";
|
|
12539
12623
|
} else if (/no ads available|no fill|nofill/i.test(message)) {
|
|
@@ -12548,7 +12632,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12548
12632
|
outcome = "request_failed";
|
|
12549
12633
|
}
|
|
12550
12634
|
this.timing.consecutiveFailures++;
|
|
12551
|
-
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget") {
|
|
12635
|
+
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget" || outcome === "discarded_duplicate") {
|
|
12552
12636
|
this.unusableResponsesInBreak++;
|
|
12553
12637
|
}
|
|
12554
12638
|
if (outcome === "no_fill") {
|
|
@@ -12562,7 +12646,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12562
12646
|
}) ? diag.dispatchedUrl : vastTagUrl;
|
|
12563
12647
|
if (this.timing.isTemporaryAdError(error)) {
|
|
12564
12648
|
this.timing.temporaryFailureUrls.set(failureKey, Date.now());
|
|
12565
|
-
} else if (outcome !== "discarded_budget") {
|
|
12649
|
+
} else if (outcome !== "discarded_budget" && outcome !== "discarded_duplicate") {
|
|
12566
12650
|
this.timing.failedVastUrls.add(failureKey);
|
|
12567
12651
|
}
|
|
12568
12652
|
this.countFunnelStage("request_outcome:".concat(outcome));
|
|
@@ -12934,7 +13018,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12934
13018
|
value: function playSingleAd(vastTagUrl) {
|
|
12935
13019
|
var trigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "vmap";
|
|
12936
13020
|
return _async_to_generator(function() {
|
|
12937
|
-
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, finalizeRequestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
13021
|
+
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, _ref, _ap_getLoadedAdId, _ap_getPodAdCount, finalizeRequestUrl, loadedAdId, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
12938
13022
|
return _ts_generator(this, function(_state) {
|
|
12939
13023
|
switch(_state.label){
|
|
12940
13024
|
case 0:
|
|
@@ -13047,6 +13131,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13047
13131
|
vastUrl: (_this_currentVastUrl = this.currentVastUrl) !== null && _this_currentVastUrl !== void 0 ? _this_currentVastUrl : requestUrl,
|
|
13048
13132
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
13049
13133
|
}, this.analyticsContext).catch(function() {});
|
|
13134
|
+
loadedAdId = (_ap_getLoadedAdId = ap.getLoadedAdId) === null || _ap_getLoadedAdId === void 0 ? void 0 : _ap_getLoadedAdId.call(ap);
|
|
13135
|
+
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))) {
|
|
13136
|
+
if (this.debug) {
|
|
13137
|
+
console.log("[AD-DURATION] Rejected ad id=".concat(loadedAdId, ": already played in this break — requesting another ad"));
|
|
13138
|
+
}
|
|
13139
|
+
this.logOrchestratorFunnel("discarded_duplicate", {
|
|
13140
|
+
adId: String(loadedAdId)
|
|
13141
|
+
});
|
|
13142
|
+
throw new Error("ad_repeated_in_break");
|
|
13143
|
+
}
|
|
13050
13144
|
if (!this.timing.ensureLoadedAdFitsBudget(ap)) {
|
|
13051
13145
|
;
|
|
13052
13146
|
adDurationS = (_ap_getLoadedAdDuration = ap.getLoadedAdDuration) === null || _ap_getLoadedAdDuration === void 0 ? void 0 : _ap_getLoadedAdDuration.call(ap);
|
|
@@ -13100,6 +13194,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13100
13194
|
this.recordRequestFailure(error, vastTagUrl);
|
|
13101
13195
|
if ((error === null || error === void 0 ? void 0 : error.message) === "ad_duration_exceeds_budget") {
|
|
13102
13196
|
this.recreateAdController("discarded_budget");
|
|
13197
|
+
} else if ((error === null || error === void 0 ? void 0 : error.message) === "ad_repeated_in_break") {
|
|
13198
|
+
this.recreateAdController("discarded_duplicate");
|
|
13103
13199
|
}
|
|
13104
13200
|
throw error;
|
|
13105
13201
|
case 10:
|
|
@@ -13173,6 +13269,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13173
13269
|
tagAllowsAudio: count("tag_allows_audio"),
|
|
13174
13270
|
missingImpression: count("vast_missing_impression"),
|
|
13175
13271
|
discardedBudget: count("discarded_budget"),
|
|
13272
|
+
discardedDuplicate: count("discarded_duplicate"),
|
|
13176
13273
|
mediaCandidates: count("media_candidate:accepted") + count("media_candidate:rejected"),
|
|
13177
13274
|
mediaRejected: count("media_candidate:rejected"),
|
|
13178
13275
|
mediaFallbacks: count("media_fallback"),
|
|
@@ -13248,6 +13345,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13248
13345
|
this.breakSource = void 0;
|
|
13249
13346
|
this.followUpBaseVastUrl = void 0;
|
|
13250
13347
|
this.unusableResponsesInBreak = 0;
|
|
13348
|
+
this.playedAdIdsInBreak.clear();
|
|
13251
13349
|
this.resetEdgeStateForBreak();
|
|
13252
13350
|
adPlayer.stop().catch(function() {});
|
|
13253
13351
|
if (!alreadyEnded) this.logBreakFunnel(reason);
|
|
@@ -13348,9 +13446,18 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13348
13446
|
var maxMonitorMs = 45e3;
|
|
13349
13447
|
var startTime = Date.now();
|
|
13350
13448
|
var baseline = resumeBaseline;
|
|
13449
|
+
var lastSeenTime = resumeBaseline;
|
|
13351
13450
|
var recoveries = 0;
|
|
13352
13451
|
var lastRecoveryAt = 0;
|
|
13353
13452
|
var video = this.host.video;
|
|
13453
|
+
var onDecodeError = function onDecodeError() {
|
|
13454
|
+
var _video_error;
|
|
13455
|
+
if (needsReset || ((_video_error = video.error) === null || _video_error === void 0 ? void 0 : _video_error.code) !== 3) return;
|
|
13456
|
+
if (markSingleDecoderLearned() && _this.debug) {
|
|
13457
|
+
console.warn("[StormcloudVideoPlayer] Decoder error while resuming after ads \u2014 using single-decoder mode on this device from the next break");
|
|
13458
|
+
}
|
|
13459
|
+
};
|
|
13460
|
+
video.addEventListener("error", onDecodeError);
|
|
13354
13461
|
var listenersAttached = false;
|
|
13355
13462
|
var onMediaEvent;
|
|
13356
13463
|
var diagEvents = [
|
|
@@ -13400,6 +13507,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13400
13507
|
console.log("[ResumeDiag] +0.0s monitor start — ".concat(this.describeVideoState()));
|
|
13401
13508
|
}
|
|
13402
13509
|
var cleanup = function cleanup() {
|
|
13510
|
+
video.removeEventListener("error", onDecodeError);
|
|
13403
13511
|
if (listenersAttached && onMediaEvent) {
|
|
13404
13512
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
13405
13513
|
try {
|
|
@@ -13430,6 +13538,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13430
13538
|
return;
|
|
13431
13539
|
}
|
|
13432
13540
|
var currentTime = video.currentTime;
|
|
13541
|
+
if (currentTime + 1 < lastSeenTime) {
|
|
13542
|
+
baseline = currentTime;
|
|
13543
|
+
}
|
|
13544
|
+
lastSeenTime = currentTime;
|
|
13433
13545
|
var advanced = currentTime > baseline + 0.5;
|
|
13434
13546
|
var playing = !video.paused && video.readyState >= 3;
|
|
13435
13547
|
if (advanced && playing) {
|
|
@@ -14100,6 +14212,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14100
14212
|
var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
|
|
14101
14213
|
_this.adConfig.consentSignals = signals;
|
|
14102
14214
|
var muted = _this.video.muted;
|
|
14215
|
+
var palPpid = _this.currentPpid();
|
|
14103
14216
|
var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
|
|
14104
14217
|
var palOptions = _object_spread({
|
|
14105
14218
|
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
@@ -14116,9 +14229,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14116
14229
|
allowStorage: signals.storageAllowed
|
|
14117
14230
|
} : {}, palSessionId ? {
|
|
14118
14231
|
sessionId: palSessionId
|
|
14232
|
+
} : {}, palPpid ? {
|
|
14233
|
+
ppid: palPpid
|
|
14119
14234
|
} : {});
|
|
14120
14235
|
_this.lastPalOptions = palOptions;
|
|
14121
14236
|
_this.palSessionId = palSessionId;
|
|
14237
|
+
_this.palPpid = palPpid;
|
|
14122
14238
|
_this.startPalNonceRefresh();
|
|
14123
14239
|
return _this.palNonce.generateNonce(palOptions);
|
|
14124
14240
|
}).catch(function() {});
|
|
@@ -14177,26 +14293,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14177
14293
|
if (!options) return;
|
|
14178
14294
|
var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
|
|
14179
14295
|
var ageMs = this.palNonce.getNonceAgeMs();
|
|
14296
|
+
var ppid = this.currentPpid();
|
|
14297
|
+
var ppidChanged = ppid !== this.palPpid;
|
|
14180
14298
|
var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
|
|
14181
14299
|
var sessionChanged = sessionId !== this.palSessionId;
|
|
14182
14300
|
var stale = ageMs === void 0 || ageMs >= maxAgeMs;
|
|
14183
|
-
if (!force && !stale && !sessionChanged) return;
|
|
14301
|
+
if (!force && !stale && !sessionChanged && !ppidChanged) return;
|
|
14184
14302
|
var next = _object_spread({}, options);
|
|
14185
14303
|
if (sessionId) next.sessionId = sessionId;
|
|
14186
14304
|
else delete next.sessionId;
|
|
14305
|
+
if (ppid) next.ppid = ppid;
|
|
14306
|
+
else delete next.ppid;
|
|
14187
14307
|
this.lastPalOptions = next;
|
|
14188
14308
|
this.palSessionId = sessionId;
|
|
14309
|
+
this.palPpid = ppid;
|
|
14189
14310
|
if (this.debug) {
|
|
14190
14311
|
console.log("[PAL] Regenerating nonce", {
|
|
14191
14312
|
force: force,
|
|
14192
14313
|
stale: stale,
|
|
14193
14314
|
sessionChanged: sessionChanged,
|
|
14315
|
+
ppidChanged: ppidChanged,
|
|
14194
14316
|
ageMs: ageMs
|
|
14195
14317
|
});
|
|
14196
14318
|
}
|
|
14197
14319
|
this.palNonce.generateNonce(next).catch(function() {});
|
|
14198
14320
|
}
|
|
14199
14321
|
},
|
|
14322
|
+
{
|
|
14323
|
+
key: "currentPpid",
|
|
14324
|
+
value: function currentPpid() {
|
|
14325
|
+
var userId = resolveUserId(this.config.adUserId);
|
|
14326
|
+
noteStayId(userId);
|
|
14327
|
+
var signals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
14328
|
+
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
14329
|
+
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
14330
|
+
});
|
|
14331
|
+
return toPpid(userId, signals.limitAdTracking);
|
|
14332
|
+
}
|
|
14333
|
+
},
|
|
14200
14334
|
{
|
|
14201
14335
|
key: "setAdIdentity",
|
|
14202
14336
|
value: function setAdIdentity(identity) {
|
|
@@ -14228,6 +14362,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14228
14362
|
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14229
14363
|
else delete this.config.clientIpAddress;
|
|
14230
14364
|
}
|
|
14365
|
+
if (signals.userId !== void 0) this.refreshPalNonceIfStale();
|
|
14231
14366
|
}
|
|
14232
14367
|
},
|
|
14233
14368
|
{
|