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/index.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ interface ContentMetadataUpdate {
|
|
|
48
48
|
channelName?: string | null | undefined;
|
|
49
49
|
programTitle?: string | null | undefined;
|
|
50
50
|
contentNetwork?: string | null | undefined;
|
|
51
|
+
programRating?: string | null | undefined;
|
|
52
|
+
contentRating?: string | null | undefined;
|
|
51
53
|
details?: ContentDetails | null | undefined;
|
|
52
54
|
}
|
|
53
55
|
|
|
@@ -108,6 +110,7 @@ interface StormcloudVideoPlayerConfig {
|
|
|
108
110
|
channelName?: string;
|
|
109
111
|
contentNetwork?: string;
|
|
110
112
|
contentDetails?: ContentDetails;
|
|
113
|
+
allowRepeatAdsInBreak?: boolean;
|
|
111
114
|
adUserId?: string;
|
|
112
115
|
clientIpAddress?: string;
|
|
113
116
|
adDeviceId?: string;
|
|
@@ -359,6 +362,7 @@ declare class StormcloudVideoPlayer {
|
|
|
359
362
|
private edgePodBaseUrl;
|
|
360
363
|
private lastPalOptions;
|
|
361
364
|
private palSessionId;
|
|
365
|
+
private palPpid;
|
|
362
366
|
private palRefreshTimer;
|
|
363
367
|
constructor(config: StormcloudVideoPlayerConfig);
|
|
364
368
|
private get debug();
|
|
@@ -375,6 +379,7 @@ declare class StormcloudVideoPlayer {
|
|
|
375
379
|
load(): Promise<void>;
|
|
376
380
|
private startPalNonceRefresh;
|
|
377
381
|
private refreshPalNonceIfStale;
|
|
382
|
+
private currentPpid;
|
|
378
383
|
setAdIdentity(identity: HostAdIdentity | null): void;
|
|
379
384
|
resetAdIdentity(): void;
|
|
380
385
|
setContentMetadata(meta: ContentMetadataUpdate): void;
|
package/lib/index.js
CHANGED
|
@@ -365,6 +365,9 @@ var DEFAULT_LGUDID_TIMEOUT_MS = 1500;
|
|
|
365
365
|
var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
|
|
366
366
|
var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
|
|
367
367
|
var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
|
|
368
|
+
var STAY_ID_KEY = "stormcloud.ad.stay.v1";
|
|
369
|
+
var HOST_ID_KEY = "stormcloud.ad.host.v1";
|
|
370
|
+
var memoryMarkers = {};
|
|
368
371
|
var ZEROED_IDS = /* @__PURE__ */ new Set([
|
|
369
372
|
"00000000-0000-0000-0000-000000000000",
|
|
370
373
|
"38400000-8cf0-11bd-b23e-10b96e40000d"
|
|
@@ -467,7 +470,7 @@ function setHostAdIdentity(identity) {
|
|
|
467
470
|
return;
|
|
468
471
|
}
|
|
469
472
|
var deviceId = identity.deviceId.trim();
|
|
470
|
-
var changed =
|
|
473
|
+
var changed = writeMarkerIfChanged(HOST_ID_KEY, deviceId);
|
|
471
474
|
hostIdentity = _object_spread({
|
|
472
475
|
deviceId: deviceId,
|
|
473
476
|
deviceIdType: (_normalizeIdType = normalizeIdType(identity.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
|
|
@@ -486,6 +489,31 @@ function resetAdIdentity() {
|
|
|
486
489
|
removeStored(SESSION_ID_KEY);
|
|
487
490
|
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
488
491
|
}
|
|
492
|
+
function writeMarkerIfChanged(key, value) {
|
|
493
|
+
var _memoryMarkers_key;
|
|
494
|
+
var previous = (_memoryMarkers_key = memoryMarkers[key]) !== null && _memoryMarkers_key !== void 0 ? _memoryMarkers_key : "";
|
|
495
|
+
try {
|
|
496
|
+
var _window_localStorage;
|
|
497
|
+
var stored = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
|
|
498
|
+
if (typeof stored === "string") previous = stored;
|
|
499
|
+
} catch (unused) {}
|
|
500
|
+
if (value === previous) return false;
|
|
501
|
+
memoryMarkers[key] = value;
|
|
502
|
+
try {
|
|
503
|
+
if (typeof window !== "undefined") {
|
|
504
|
+
var _window_localStorage1, _window_localStorage2;
|
|
505
|
+
if (value) (_window_localStorage1 = window.localStorage) === null || _window_localStorage1 === void 0 ? void 0 : _window_localStorage1.setItem(key, value);
|
|
506
|
+
else (_window_localStorage2 = window.localStorage) === null || _window_localStorage2 === void 0 ? void 0 : _window_localStorage2.removeItem(key);
|
|
507
|
+
}
|
|
508
|
+
} catch (unused) {}
|
|
509
|
+
return true;
|
|
510
|
+
}
|
|
511
|
+
function noteStayId(stayId) {
|
|
512
|
+
if (!writeMarkerIfChanged(STAY_ID_KEY, stayId ? stayId.trim() : "")) return false;
|
|
513
|
+
removeStored(SESSION_ID_KEY);
|
|
514
|
+
removeStored(FALLBACK_DEVICE_ID_KEY);
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
489
517
|
function readSamsungTifa() {
|
|
490
518
|
try {
|
|
491
519
|
var _window_webapis;
|
|
@@ -1272,7 +1300,9 @@ var BRIDGE_KEYS = {
|
|
|
1272
1300
|
],
|
|
1273
1301
|
contentRating: [
|
|
1274
1302
|
"contentRating",
|
|
1275
|
-
"ctr"
|
|
1303
|
+
"ctr",
|
|
1304
|
+
"programRating",
|
|
1305
|
+
"rating"
|
|
1276
1306
|
],
|
|
1277
1307
|
contentId: [
|
|
1278
1308
|
"contentId",
|
|
@@ -1284,7 +1314,9 @@ function sanitizeContentValue(value) {
|
|
|
1284
1314
|
var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
|
|
1285
1315
|
if (!cleaned) return void 0;
|
|
1286
1316
|
if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
|
|
1287
|
-
if (/^(unknown|null|undefined|none|n\/a
|
|
1317
|
+
if (/^(unknown|null|undefined|none|n\/a|-|tbd|tba|to be (announced|determined))$/i.test(cleaned)) {
|
|
1318
|
+
return void 0;
|
|
1319
|
+
}
|
|
1288
1320
|
return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
|
|
1289
1321
|
}
|
|
1290
1322
|
function sanitizeContentScalar(value) {
|
|
@@ -1410,6 +1442,7 @@ function resolveContentMetadata(config) {
|
|
|
1410
1442
|
} : {});
|
|
1411
1443
|
}
|
|
1412
1444
|
function applyContentMetadataUpdate(target, meta) {
|
|
1445
|
+
var _target_contentDetails;
|
|
1413
1446
|
var apply = function apply(key, value) {
|
|
1414
1447
|
if (value === void 0) return;
|
|
1415
1448
|
var clean = value === null ? void 0 : sanitizeContentValue(value);
|
|
@@ -1419,9 +1452,15 @@ function applyContentMetadataUpdate(target, meta) {
|
|
|
1419
1452
|
apply("channelName", meta.channelName);
|
|
1420
1453
|
apply("programTitle", meta.programTitle);
|
|
1421
1454
|
apply("contentNetwork", meta.contentNetwork);
|
|
1422
|
-
if (meta.details === void 0) return;
|
|
1423
1455
|
if (meta.details === null) delete target.contentDetails;
|
|
1424
|
-
else target.contentDetails = _object_spread({}, meta.details);
|
|
1456
|
+
else if (meta.details !== void 0) target.contentDetails = _object_spread({}, meta.details);
|
|
1457
|
+
var rating = meta.programRating !== void 0 ? meta.programRating : meta.contentRating;
|
|
1458
|
+
if (rating === void 0) return;
|
|
1459
|
+
var cleanRating = rating === null ? void 0 : sanitizeContentValue(rating);
|
|
1460
|
+
var details = _object_spread({}, (_target_contentDetails = target.contentDetails) !== null && _target_contentDetails !== void 0 ? _target_contentDetails : {});
|
|
1461
|
+
if (cleanRating) details.rating = cleanRating;
|
|
1462
|
+
else delete details.rating;
|
|
1463
|
+
target.contentDetails = details;
|
|
1425
1464
|
}
|
|
1426
1465
|
function appendMissingContentParams(url, meta) {
|
|
1427
1466
|
if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
|
|
@@ -1514,6 +1553,11 @@ function sanitizePublicIp(value) {
|
|
|
1514
1553
|
if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
|
|
1515
1554
|
return isPublicIpv6(cleaned) ? cleaned : void 0;
|
|
1516
1555
|
}
|
|
1556
|
+
var PPID_PATTERN = /^[0-9a-zA-Z+.=\/_\-$,{}]{22,150}$/;
|
|
1557
|
+
function toPpid(userId, limitAdTracking) {
|
|
1558
|
+
if (!userId || limitAdTracking === true) return void 0;
|
|
1559
|
+
return PPID_PATTERN.test(userId) ? userId : void 0;
|
|
1560
|
+
}
|
|
1517
1561
|
function resolveUserId(configValue) {
|
|
1518
1562
|
var _sanitizeUserId;
|
|
1519
1563
|
return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
|
|
@@ -1922,6 +1966,7 @@ function resolveScvpMacroValues(ctx) {
|
|
|
1922
1966
|
set("UA", ctx.userAgent);
|
|
1923
1967
|
set("IP", ctx.ipAddress);
|
|
1924
1968
|
set("UID", ctx.userId);
|
|
1969
|
+
set("PPID", ctx.ppid);
|
|
1925
1970
|
set("CT-TYPE", ctx.contentType);
|
|
1926
1971
|
set("CT-CATEGORY", ctx.contentCategory);
|
|
1927
1972
|
set("CT-GENRE", ctx.contentGenre);
|
|
@@ -2827,9 +2872,30 @@ function detectBrowser() {
|
|
|
2827
2872
|
};
|
|
2828
2873
|
}
|
|
2829
2874
|
var singleDecoderOverride;
|
|
2875
|
+
var LEARNED_SINGLE_DECODER_KEY = "stormcloud.singleDecoder.learned.v1";
|
|
2876
|
+
var learnedSingleDecoder;
|
|
2830
2877
|
function setSingleDecoderOverride(value) {
|
|
2831
2878
|
singleDecoderOverride = value;
|
|
2832
2879
|
}
|
|
2880
|
+
function readLearnedSingleDecoder() {
|
|
2881
|
+
if (learnedSingleDecoder !== void 0) return learnedSingleDecoder;
|
|
2882
|
+
try {
|
|
2883
|
+
var _window_localStorage;
|
|
2884
|
+
learnedSingleDecoder = typeof window !== "undefined" && ((_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(LEARNED_SINGLE_DECODER_KEY)) === "1";
|
|
2885
|
+
} catch (unused) {
|
|
2886
|
+
learnedSingleDecoder = false;
|
|
2887
|
+
}
|
|
2888
|
+
return learnedSingleDecoder;
|
|
2889
|
+
}
|
|
2890
|
+
function markSingleDecoderLearned() {
|
|
2891
|
+
if (readLearnedSingleDecoder()) return false;
|
|
2892
|
+
learnedSingleDecoder = true;
|
|
2893
|
+
try {
|
|
2894
|
+
var _window_localStorage;
|
|
2895
|
+
(_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(LEARNED_SINGLE_DECODER_KEY, "1");
|
|
2896
|
+
} catch (unused) {}
|
|
2897
|
+
return true;
|
|
2898
|
+
}
|
|
2833
2899
|
function requiresMediaPipelineResetAfterAds() {
|
|
2834
2900
|
var _browser_tizenVersion;
|
|
2835
2901
|
if (singleDecoderOverride != null) return singleDecoderOverride;
|
|
@@ -2837,6 +2903,7 @@ function requiresMediaPipelineResetAfterAds() {
|
|
|
2837
2903
|
var globalOverride = typeof window !== "undefined" ? window.__STORMCLOUD_SINGLE_DECODER__ : void 0;
|
|
2838
2904
|
if (typeof globalOverride === "boolean") return globalOverride;
|
|
2839
2905
|
} catch (unused) {}
|
|
2906
|
+
if (readLearnedSingleDecoder()) return true;
|
|
2840
2907
|
var browser = detectBrowser();
|
|
2841
2908
|
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
2842
2909
|
}
|
|
@@ -9544,6 +9611,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9544
9611
|
value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
|
|
9545
9612
|
var _content_contentDurationSeconds;
|
|
9546
9613
|
var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
|
|
9614
|
+
var stayUserId = resolveUserId(this.config.adUserId);
|
|
9615
|
+
noteStayId(stayUserId);
|
|
9547
9616
|
var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
9548
9617
|
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
9549
9618
|
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
@@ -9554,7 +9623,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9554
9623
|
var playerSize = resolvePlayerSize(this.video);
|
|
9555
9624
|
var videoDuration = this.video.duration;
|
|
9556
9625
|
var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
|
|
9557
|
-
var userId =
|
|
9626
|
+
var userId = envSignals.limitAdTracking === true ? void 0 : stayUserId;
|
|
9627
|
+
var ppid = toPpid(stayUserId, envSignals.limitAdTracking);
|
|
9558
9628
|
var ipAddress = resolveClientIp(this.config.clientIpAddress);
|
|
9559
9629
|
var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
|
|
9560
9630
|
var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
|
|
@@ -9600,6 +9670,8 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9600
9670
|
ipAddress: ipAddress
|
|
9601
9671
|
} : {}, userId ? {
|
|
9602
9672
|
userId: userId
|
|
9673
|
+
} : {}, ppid ? {
|
|
9674
|
+
ppid: ppid
|
|
9603
9675
|
} : {}, content.contentType ? {
|
|
9604
9676
|
contentType: content.contentType
|
|
9605
9677
|
} : {}, content.contentCategory ? {
|
|
@@ -9647,9 +9719,11 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
9647
9719
|
isLat: envSignals.limitAdTracking,
|
|
9648
9720
|
dth: envSignals.deviceTypeHint,
|
|
9649
9721
|
sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
|
|
9722
|
+
ppidTail: ppid ? ppid.slice(-4) : void 0,
|
|
9650
9723
|
ct_ch: content.channelName,
|
|
9651
9724
|
ct_ti: content.programTitle,
|
|
9652
9725
|
ct_ne: content.contentNetwork,
|
|
9726
|
+
rating: content.contentRating,
|
|
9653
9727
|
ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
|
|
9654
9728
|
live: isLive,
|
|
9655
9729
|
player: playerSize,
|
|
@@ -11337,6 +11411,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11337
11411
|
this.adDetectSentForCurrentBreak = false;
|
|
11338
11412
|
this.slotState = "IDLE";
|
|
11339
11413
|
this.unusableResponsesInBreak = 0;
|
|
11414
|
+
this.playedAdIdsInBreak = /* @__PURE__ */ new Set();
|
|
11340
11415
|
this.controllerGeneration = 0;
|
|
11341
11416
|
this.requestDiagnostics = /* @__PURE__ */ new Map();
|
|
11342
11417
|
this.breakFunnel = {};
|
|
@@ -11433,6 +11508,11 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11433
11508
|
_this.recordRequestDiagnostic(payload);
|
|
11434
11509
|
});
|
|
11435
11510
|
adPlayer.on("ad_impression", function() {
|
|
11511
|
+
var _this_host_getAdPlayer_getLoadedAdId, _this_host_getAdPlayer;
|
|
11512
|
+
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);
|
|
11513
|
+
if (impressionAdId != null && impressionAdId !== "") {
|
|
11514
|
+
_this.playedAdIdsInBreak.add(String(impressionAdId));
|
|
11515
|
+
}
|
|
11436
11516
|
_this.timing.consecutiveFailures = 0;
|
|
11437
11517
|
_this.setSlotState("PLAYING", "impression");
|
|
11438
11518
|
if (!_this.playbackStartedForCurrentRequest) {
|
|
@@ -11624,6 +11704,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11624
11704
|
this.resetEdgeStateForBreak();
|
|
11625
11705
|
this.followUpBaseVastUrl = void 0;
|
|
11626
11706
|
this.unusableResponsesInBreak = 0;
|
|
11707
|
+
this.playedAdIdsInBreak.clear();
|
|
11627
11708
|
this.timing.totalAdRequestsInBreak = 0;
|
|
11628
11709
|
this.setSlotState("NEEDS_NEXT_AD", "vmap_break_start");
|
|
11629
11710
|
this.noteOpportunity("vmap", breakKey, position);
|
|
@@ -11674,6 +11755,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
11674
11755
|
this.breakSource = "scte35";
|
|
11675
11756
|
this.followUpBaseVastUrl = baseVastUrl;
|
|
11676
11757
|
this.unusableResponsesInBreak = 0;
|
|
11758
|
+
this.playedAdIdsInBreak.clear();
|
|
11677
11759
|
this.resetEdgeStateForBreak();
|
|
11678
11760
|
this.setSlotState("NEEDS_NEXT_AD", "scte35_break_start");
|
|
11679
11761
|
if (this.adConfig.podAssignedByPrefetch) {
|
|
@@ -12513,6 +12595,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12513
12595
|
var outcome;
|
|
12514
12596
|
if (message.includes("ad_duration_exceeds_budget")) {
|
|
12515
12597
|
outcome = "discarded_budget";
|
|
12598
|
+
} else if (message.includes("ad_repeated_in_break")) {
|
|
12599
|
+
outcome = "discarded_duplicate";
|
|
12516
12600
|
} else if (message.includes("VAST fill rejected")) {
|
|
12517
12601
|
outcome = "fill_rejected";
|
|
12518
12602
|
} else if (/no ads available|no fill|nofill/i.test(message)) {
|
|
@@ -12527,7 +12611,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12527
12611
|
outcome = "request_failed";
|
|
12528
12612
|
}
|
|
12529
12613
|
this.timing.consecutiveFailures++;
|
|
12530
|
-
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget") {
|
|
12614
|
+
if (outcome === "no_fill" || outcome === "fill_rejected" || outcome === "discarded_budget" || outcome === "discarded_duplicate") {
|
|
12531
12615
|
this.unusableResponsesInBreak++;
|
|
12532
12616
|
}
|
|
12533
12617
|
if (outcome === "no_fill") {
|
|
@@ -12541,7 +12625,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12541
12625
|
}) ? diag.dispatchedUrl : vastTagUrl;
|
|
12542
12626
|
if (this.timing.isTemporaryAdError(error)) {
|
|
12543
12627
|
this.timing.temporaryFailureUrls.set(failureKey, Date.now());
|
|
12544
|
-
} else if (outcome !== "discarded_budget") {
|
|
12628
|
+
} else if (outcome !== "discarded_budget" && outcome !== "discarded_duplicate") {
|
|
12545
12629
|
this.timing.failedVastUrls.add(failureKey);
|
|
12546
12630
|
}
|
|
12547
12631
|
this.countFunnelStage("request_outcome:".concat(outcome));
|
|
@@ -12913,7 +12997,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
12913
12997
|
value: function playSingleAd(vastTagUrl) {
|
|
12914
12998
|
var trigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "vmap";
|
|
12915
12999
|
return _async_to_generator(function() {
|
|
12916
|
-
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, finalizeRequestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
13000
|
+
var epoch, generation, requestToken, ap, requestUrl, _this_currentVastUrl, _ref, _ap_getLoadedAdId, _ap_getPodAdCount, finalizeRequestUrl, loadedAdId, _ap_getLoadedAdDuration, adDurationS, remainingMs, error;
|
|
12917
13001
|
return _ts_generator(this, function(_state) {
|
|
12918
13002
|
switch(_state.label){
|
|
12919
13003
|
case 0:
|
|
@@ -13026,6 +13110,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13026
13110
|
vastUrl: (_this_currentVastUrl = this.currentVastUrl) !== null && _this_currentVastUrl !== void 0 ? _this_currentVastUrl : requestUrl,
|
|
13027
13111
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
13028
13112
|
}, this.analyticsContext).catch(function() {});
|
|
13113
|
+
loadedAdId = (_ap_getLoadedAdId = ap.getLoadedAdId) === null || _ap_getLoadedAdId === void 0 ? void 0 : _ap_getLoadedAdId.call(ap);
|
|
13114
|
+
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))) {
|
|
13115
|
+
if (this.debug) {
|
|
13116
|
+
console.log("[AD-DURATION] Rejected ad id=".concat(loadedAdId, ": already played in this break — requesting another ad"));
|
|
13117
|
+
}
|
|
13118
|
+
this.logOrchestratorFunnel("discarded_duplicate", {
|
|
13119
|
+
adId: String(loadedAdId)
|
|
13120
|
+
});
|
|
13121
|
+
throw new Error("ad_repeated_in_break");
|
|
13122
|
+
}
|
|
13029
13123
|
if (!this.timing.ensureLoadedAdFitsBudget(ap)) {
|
|
13030
13124
|
;
|
|
13031
13125
|
adDurationS = (_ap_getLoadedAdDuration = ap.getLoadedAdDuration) === null || _ap_getLoadedAdDuration === void 0 ? void 0 : _ap_getLoadedAdDuration.call(ap);
|
|
@@ -13079,6 +13173,8 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13079
13173
|
this.recordRequestFailure(error, vastTagUrl);
|
|
13080
13174
|
if ((error === null || error === void 0 ? void 0 : error.message) === "ad_duration_exceeds_budget") {
|
|
13081
13175
|
this.recreateAdController("discarded_budget");
|
|
13176
|
+
} else if ((error === null || error === void 0 ? void 0 : error.message) === "ad_repeated_in_break") {
|
|
13177
|
+
this.recreateAdController("discarded_duplicate");
|
|
13082
13178
|
}
|
|
13083
13179
|
throw error;
|
|
13084
13180
|
case 10:
|
|
@@ -13152,6 +13248,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13152
13248
|
tagAllowsAudio: count("tag_allows_audio"),
|
|
13153
13249
|
missingImpression: count("vast_missing_impression"),
|
|
13154
13250
|
discardedBudget: count("discarded_budget"),
|
|
13251
|
+
discardedDuplicate: count("discarded_duplicate"),
|
|
13155
13252
|
mediaCandidates: count("media_candidate:accepted") + count("media_candidate:rejected"),
|
|
13156
13253
|
mediaRejected: count("media_candidate:rejected"),
|
|
13157
13254
|
mediaFallbacks: count("media_fallback"),
|
|
@@ -13227,6 +13324,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13227
13324
|
this.breakSource = void 0;
|
|
13228
13325
|
this.followUpBaseVastUrl = void 0;
|
|
13229
13326
|
this.unusableResponsesInBreak = 0;
|
|
13327
|
+
this.playedAdIdsInBreak.clear();
|
|
13230
13328
|
this.resetEdgeStateForBreak();
|
|
13231
13329
|
adPlayer.stop().catch(function() {});
|
|
13232
13330
|
if (!alreadyEnded) this.logBreakFunnel(reason);
|
|
@@ -13327,9 +13425,18 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13327
13425
|
var maxMonitorMs = 45e3;
|
|
13328
13426
|
var startTime = Date.now();
|
|
13329
13427
|
var baseline = resumeBaseline;
|
|
13428
|
+
var lastSeenTime = resumeBaseline;
|
|
13330
13429
|
var recoveries = 0;
|
|
13331
13430
|
var lastRecoveryAt = 0;
|
|
13332
13431
|
var video = this.host.video;
|
|
13432
|
+
var onDecodeError = function onDecodeError() {
|
|
13433
|
+
var _video_error;
|
|
13434
|
+
if (needsReset || ((_video_error = video.error) === null || _video_error === void 0 ? void 0 : _video_error.code) !== 3) return;
|
|
13435
|
+
if (markSingleDecoderLearned() && _this.debug) {
|
|
13436
|
+
console.warn("[StormcloudVideoPlayer] Decoder error while resuming after ads \u2014 using single-decoder mode on this device from the next break");
|
|
13437
|
+
}
|
|
13438
|
+
};
|
|
13439
|
+
video.addEventListener("error", onDecodeError);
|
|
13333
13440
|
var listenersAttached = false;
|
|
13334
13441
|
var onMediaEvent;
|
|
13335
13442
|
var diagEvents = [
|
|
@@ -13379,6 +13486,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13379
13486
|
console.log("[ResumeDiag] +0.0s monitor start — ".concat(this.describeVideoState()));
|
|
13380
13487
|
}
|
|
13381
13488
|
var cleanup = function cleanup() {
|
|
13489
|
+
video.removeEventListener("error", onDecodeError);
|
|
13382
13490
|
if (listenersAttached && onMediaEvent) {
|
|
13383
13491
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
13384
13492
|
try {
|
|
@@ -13409,6 +13517,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
13409
13517
|
return;
|
|
13410
13518
|
}
|
|
13411
13519
|
var currentTime = video.currentTime;
|
|
13520
|
+
if (currentTime + 1 < lastSeenTime) {
|
|
13521
|
+
baseline = currentTime;
|
|
13522
|
+
}
|
|
13523
|
+
lastSeenTime = currentTime;
|
|
13412
13524
|
var advanced = currentTime > baseline + 0.5;
|
|
13413
13525
|
var playing = !video.paused && video.readyState >= 3;
|
|
13414
13526
|
if (advanced && playing) {
|
|
@@ -14081,6 +14193,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14081
14193
|
var _this_config_palContinuousPlayback, _this_config_lowLatencyMode, _this_config_palIconsSupported, _this_config_palSupportedApiFrameworks;
|
|
14082
14194
|
_this.adConfig.consentSignals = signals;
|
|
14083
14195
|
var muted = _this.video.muted;
|
|
14196
|
+
var palPpid = _this.currentPpid();
|
|
14084
14197
|
var palSessionId = _this.config.ctvAdRequest ? getOrRotateSessionId(_this.config.sessionIdMaxAgeMs) : void 0;
|
|
14085
14198
|
var palOptions = _object_spread({
|
|
14086
14199
|
videoWidth: _this.video.offsetWidth || _this.video.clientWidth || 640,
|
|
@@ -14097,9 +14210,12 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14097
14210
|
allowStorage: signals.storageAllowed
|
|
14098
14211
|
} : {}, palSessionId ? {
|
|
14099
14212
|
sessionId: palSessionId
|
|
14213
|
+
} : {}, palPpid ? {
|
|
14214
|
+
ppid: palPpid
|
|
14100
14215
|
} : {});
|
|
14101
14216
|
_this.lastPalOptions = palOptions;
|
|
14102
14217
|
_this.palSessionId = palSessionId;
|
|
14218
|
+
_this.palPpid = palPpid;
|
|
14103
14219
|
_this.startPalNonceRefresh();
|
|
14104
14220
|
return _this.palNonce.generateNonce(palOptions);
|
|
14105
14221
|
}).catch(function() {});
|
|
@@ -14158,26 +14274,44 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14158
14274
|
if (!options) return;
|
|
14159
14275
|
var maxAgeMs = (_this_config_palNonceMaxAgeMs = this.config.palNonceMaxAgeMs) !== null && _this_config_palNonceMaxAgeMs !== void 0 ? _this_config_palNonceMaxAgeMs : DEFAULT_PAL_NONCE_MAX_AGE_MS;
|
|
14160
14276
|
var ageMs = this.palNonce.getNonceAgeMs();
|
|
14277
|
+
var ppid = this.currentPpid();
|
|
14278
|
+
var ppidChanged = ppid !== this.palPpid;
|
|
14161
14279
|
var sessionId = this.config.ctvAdRequest ? getOrRotateSessionId(this.config.sessionIdMaxAgeMs) : void 0;
|
|
14162
14280
|
var sessionChanged = sessionId !== this.palSessionId;
|
|
14163
14281
|
var stale = ageMs === void 0 || ageMs >= maxAgeMs;
|
|
14164
|
-
if (!force && !stale && !sessionChanged) return;
|
|
14282
|
+
if (!force && !stale && !sessionChanged && !ppidChanged) return;
|
|
14165
14283
|
var next = _object_spread({}, options);
|
|
14166
14284
|
if (sessionId) next.sessionId = sessionId;
|
|
14167
14285
|
else delete next.sessionId;
|
|
14286
|
+
if (ppid) next.ppid = ppid;
|
|
14287
|
+
else delete next.ppid;
|
|
14168
14288
|
this.lastPalOptions = next;
|
|
14169
14289
|
this.palSessionId = sessionId;
|
|
14290
|
+
this.palPpid = ppid;
|
|
14170
14291
|
if (this.debug) {
|
|
14171
14292
|
console.log("[PAL] Regenerating nonce", {
|
|
14172
14293
|
force: force,
|
|
14173
14294
|
stale: stale,
|
|
14174
14295
|
sessionChanged: sessionChanged,
|
|
14296
|
+
ppidChanged: ppidChanged,
|
|
14175
14297
|
ageMs: ageMs
|
|
14176
14298
|
});
|
|
14177
14299
|
}
|
|
14178
14300
|
this.palNonce.generateNonce(next).catch(function() {});
|
|
14179
14301
|
}
|
|
14180
14302
|
},
|
|
14303
|
+
{
|
|
14304
|
+
key: "currentPpid",
|
|
14305
|
+
value: function currentPpid() {
|
|
14306
|
+
var userId = resolveUserId(this.config.adUserId);
|
|
14307
|
+
noteStayId(userId);
|
|
14308
|
+
var signals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
|
|
14309
|
+
fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
|
|
14310
|
+
sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
|
|
14311
|
+
});
|
|
14312
|
+
return toPpid(userId, signals.limitAdTracking);
|
|
14313
|
+
}
|
|
14314
|
+
},
|
|
14181
14315
|
{
|
|
14182
14316
|
key: "setAdIdentity",
|
|
14183
14317
|
value: function setAdIdentity(identity) {
|
|
@@ -14209,6 +14343,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
14209
14343
|
if (signals.ipAddress) this.config.clientIpAddress = signals.ipAddress;
|
|
14210
14344
|
else delete this.config.clientIpAddress;
|
|
14211
14345
|
}
|
|
14346
|
+
if (signals.userId !== void 0) this.refreshPalNonceIfStale();
|
|
14212
14347
|
}
|
|
14213
14348
|
},
|
|
14214
14349
|
{
|