stormcloud-video-player 0.8.55 → 0.8.56
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 +2 -2
- package/lib/index.cjs +222 -82
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +222 -82
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +27 -29
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +1 -1
- package/lib/player/AdConfigManager.cjs +3 -14
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdConfigManager.d.cts +1 -1
- package/lib/player/AdTimingService.d.cts +1 -1
- package/lib/player/HlsEngine.cjs.map +1 -1
- package/lib/player/HlsEngine.d.cts +1 -1
- package/lib/player/PlaceholderLayer.cjs.map +1 -1
- package/lib/player/PlayerControls.cjs.map +1 -1
- package/lib/player/PlayerControls.d.cts +1 -1
- package/lib/player/Scte35CueManager.cjs.map +1 -1
- package/lib/player/Scte35CueManager.d.cts +1 -1
- package/lib/player/Scte35Parser.cjs.map +1 -1
- package/lib/player/Scte35Parser.d.cts +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +222 -82
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/player/playerTypes.cjs.map +1 -1
- package/lib/player/playerTypes.d.cts +1 -1
- package/lib/players/HlsPlayer.cjs +222 -82
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +222 -82
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +194 -52
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -1
- package/lib/{types-DpbgEvSH.d.cts → types-cTqIKw_D.d.cts} +0 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +222 -82
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/ctvVastSignals.cjs.map +1 -1
- package/lib/utils/devUrl.cjs.map +1 -1
- package/lib/utils/mqttClient.cjs.map +1 -1
- package/lib/utils/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs +7 -19
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/lib/utils/vastEnvironmentSignals.cjs +0 -4
- package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
- package/lib/utils/vastEnvironmentSignals.d.cts +1 -2
- package/lib/utils/vastMacros.cjs.map +1 -1
- package/lib/utils/vastTrackingMacros.cjs +185 -0
- package/lib/utils/vastTrackingMacros.cjs.map +1 -0
- package/lib/utils/vastTrackingMacros.d.cts +19 -0
- package/package.json +1 -1
package/lib/sdk/hlsAdPlayer.cjs
CHANGED
|
@@ -338,15 +338,147 @@ function requiresMediaPipelineResetAfterAds() {
|
|
|
338
338
|
var browser = detectBrowser();
|
|
339
339
|
return browser.name === "Samsung Tizen" && ((_browser_tizenVersion = browser.tizenVersion) !== null && _browser_tizenVersion !== void 0 ? _browser_tizenVersion : 0) >= 5;
|
|
340
340
|
}
|
|
341
|
+
// src/utils/vastTrackingMacros.ts
|
|
342
|
+
var VAST_MACRO_PATTERN = /\[([A-Z][A-Z0-9_]*)\]/g;
|
|
343
|
+
var CACHEBUSTING_ALIASES = /\[CACHEBUSTER\]|\[cachebuster\]|\[timestamp\]|\[random\]|\[INSERT_RANDOM_NUMBER\]|%%CACHEBUSTER%%|%%CACHEBUST%%|\$\{CACHEBUSTER\}|\$\{CACHEBUSTING\}|\{cachebuster\}|\{random\}/g;
|
|
344
|
+
var KNOWN_VAST_MACROS = /* @__PURE__ */ new Set([
|
|
345
|
+
"ADCATEGORIES",
|
|
346
|
+
"ADCOUNT",
|
|
347
|
+
"ADPLAYHEAD",
|
|
348
|
+
"ADSERVINGID",
|
|
349
|
+
"ADTYPE",
|
|
350
|
+
"APIFRAMEWORKS",
|
|
351
|
+
"APPBUNDLE",
|
|
352
|
+
"ASSETURI",
|
|
353
|
+
"BLOCKEDADCATEGORIES",
|
|
354
|
+
"BREAKMAXADLENGTH",
|
|
355
|
+
"BREAKMAXADS",
|
|
356
|
+
"BREAKMAXDURATION",
|
|
357
|
+
"BREAKMINADLENGTH",
|
|
358
|
+
"BREAKPOSITION",
|
|
359
|
+
"CACHEBUSTING",
|
|
360
|
+
"CLICKPOS",
|
|
361
|
+
"CLICKTYPE",
|
|
362
|
+
"CLIENTUA",
|
|
363
|
+
"CONTENTID",
|
|
364
|
+
"CONTENTPLAYHEAD",
|
|
365
|
+
"CONTENTURI",
|
|
366
|
+
"DEVICEIP",
|
|
367
|
+
"DEVICEUA",
|
|
368
|
+
"DOMAIN",
|
|
369
|
+
"ERRORCODE",
|
|
370
|
+
"EXTENSIONS",
|
|
371
|
+
"GDPRCONSENT",
|
|
372
|
+
"IFA",
|
|
373
|
+
"IFATYPE",
|
|
374
|
+
"INVENTORYSTATE",
|
|
375
|
+
"LATLONG",
|
|
376
|
+
"LIMITADTRACKING",
|
|
377
|
+
"MEDIAMIME",
|
|
378
|
+
"MEDIAPLAYHEAD",
|
|
379
|
+
"OMIDPARTNER",
|
|
380
|
+
"PAGEURL",
|
|
381
|
+
"PLACEMENTTYPE",
|
|
382
|
+
"PLAYERCAPABILITIES",
|
|
383
|
+
"PLAYERSIZE",
|
|
384
|
+
"PLAYERSTATE",
|
|
385
|
+
"PODSEQUENCE",
|
|
386
|
+
"REGULATIONS",
|
|
387
|
+
"SERVERSIDE",
|
|
388
|
+
"SERVERUA",
|
|
389
|
+
"TIMESTAMP",
|
|
390
|
+
"TRANSACTIONID",
|
|
391
|
+
"UNIVERSALADID",
|
|
392
|
+
"VASTVERSIONS",
|
|
393
|
+
"VERIFICATIONVENDORS"
|
|
394
|
+
]);
|
|
395
|
+
function generateCachebuster() {
|
|
396
|
+
return String(Math.floor(Math.random() * 9e7) + 1e7);
|
|
397
|
+
}
|
|
398
|
+
function formatPlayhead(seconds) {
|
|
399
|
+
if (seconds == null || !Number.isFinite(seconds) || seconds < 0) {
|
|
400
|
+
return void 0;
|
|
401
|
+
}
|
|
402
|
+
var total = Math.floor(seconds);
|
|
403
|
+
var hh = String(Math.floor(total / 3600)).padStart(2, "0");
|
|
404
|
+
var mm = String(Math.floor(total % 3600 / 60)).padStart(2, "0");
|
|
405
|
+
var ss = String(total % 60).padStart(2, "0");
|
|
406
|
+
var ms = String(Math.floor((seconds - total) * 1e3)).padStart(3, "0");
|
|
407
|
+
return "".concat(hh, ":").concat(mm, ":").concat(ss, ".").concat(ms);
|
|
408
|
+
}
|
|
409
|
+
function resolveMacroValues(ctx) {
|
|
410
|
+
var values = /* @__PURE__ */ new Map();
|
|
411
|
+
var set = function set(key, value) {
|
|
412
|
+
if (value != null && value !== "") values.set(key, value);
|
|
413
|
+
};
|
|
414
|
+
var adPlayhead = formatPlayhead(ctx.adPlayheadSeconds);
|
|
415
|
+
set("ADPLAYHEAD", adPlayhead);
|
|
416
|
+
set("MEDIAPLAYHEAD", adPlayhead);
|
|
417
|
+
set("CONTENTPLAYHEAD", formatPlayhead(ctx.contentPlayheadSeconds));
|
|
418
|
+
set("ASSETURI", ctx.assetUri);
|
|
419
|
+
set("MEDIAMIME", ctx.mediaMime);
|
|
420
|
+
set("TIMESTAMP", (/* @__PURE__ */ new Date()).toISOString());
|
|
421
|
+
set("SERVERSIDE", "0");
|
|
422
|
+
if (ctx.errorCode != null && ctx.errorCode !== "") {
|
|
423
|
+
set("ERRORCODE", String(ctx.errorCode));
|
|
424
|
+
}
|
|
425
|
+
if (ctx.playerWidth != null && ctx.playerHeight != null) {
|
|
426
|
+
set("PLAYERSIZE", "".concat(Math.round(ctx.playerWidth), ",").concat(Math.round(ctx.playerHeight)));
|
|
427
|
+
}
|
|
428
|
+
set("IFA", ctx.deviceId);
|
|
429
|
+
set("IFATYPE", ctx.deviceIdType);
|
|
430
|
+
if (ctx.limitAdTracking != null) {
|
|
431
|
+
set("LIMITADTRACKING", ctx.limitAdTracking ? "1" : "0");
|
|
432
|
+
}
|
|
433
|
+
set("PAGEURL", ctx.pageUrl);
|
|
434
|
+
if (ctx.pageUrl) {
|
|
435
|
+
try {
|
|
436
|
+
set("DOMAIN", new URL(ctx.pageUrl).hostname);
|
|
437
|
+
} catch (unused) {}
|
|
438
|
+
}
|
|
439
|
+
set("CLIENTUA", ctx.clientUa);
|
|
440
|
+
set("DEVICEUA", ctx.clientUa);
|
|
441
|
+
if (ctx.podSequence != null) {
|
|
442
|
+
set("PODSEQUENCE", String(ctx.podSequence));
|
|
443
|
+
}
|
|
444
|
+
return values;
|
|
445
|
+
}
|
|
446
|
+
function substituteVastTrackingMacros(url) {
|
|
447
|
+
var ctx = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
448
|
+
if (!url) return url;
|
|
449
|
+
var values = resolveMacroValues(ctx);
|
|
450
|
+
return url.replace(CACHEBUSTING_ALIASES, function() {
|
|
451
|
+
return generateCachebuster();
|
|
452
|
+
}).replace(VAST_MACRO_PATTERN, function(match, name) {
|
|
453
|
+
if (name === "CACHEBUSTING") return generateCachebuster();
|
|
454
|
+
var value = values.get(name);
|
|
455
|
+
if (value != null) return encodeURIComponent(value);
|
|
456
|
+
return KNOWN_VAST_MACROS.has(name) ? "" : match;
|
|
457
|
+
});
|
|
458
|
+
}
|
|
341
459
|
// src/sdk/hlsAdPlayer.ts
|
|
342
460
|
var MAX_VAST_WRAPPER_DEPTH = 5;
|
|
461
|
+
var BEACON_TIMEOUT_MS = 3e4;
|
|
462
|
+
var inFlightBeacons = /* @__PURE__ */ new Set();
|
|
463
|
+
var VAST_ERROR_MEDIA_DISPLAY = 405;
|
|
464
|
+
function toVastMediaErrorCode(error) {
|
|
465
|
+
switch(error === null || error === void 0 ? void 0 : error.code){
|
|
466
|
+
case 1:
|
|
467
|
+
return 400;
|
|
468
|
+
case 2:
|
|
469
|
+
return 401;
|
|
470
|
+
case 4:
|
|
471
|
+
return 403;
|
|
472
|
+
default:
|
|
473
|
+
return VAST_ERROR_MEDIA_DISPLAY;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
343
476
|
function createHlsAdPlayer(contentVideo, options) {
|
|
344
477
|
var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP;
|
|
345
478
|
var adPlaying = false;
|
|
346
479
|
var originalMutedState = false;
|
|
347
480
|
var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
|
|
348
481
|
var listeners = /* @__PURE__ */ new Map();
|
|
349
|
-
var licenseKey = options === null || options === void 0 ? void 0 : options.licenseKey;
|
|
350
482
|
var mainHlsInstance = options === null || options === void 0 ? void 0 : options.mainHlsInstance;
|
|
351
483
|
var AD_CONTAINER_PROP = "__stormcloudAdContainer";
|
|
352
484
|
var AD_VIDEO_PROP = "__stormcloudAdVideo";
|
|
@@ -357,10 +489,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
357
489
|
var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
|
|
358
490
|
var adEventHandlers = [];
|
|
359
491
|
var currentAd;
|
|
360
|
-
var
|
|
492
|
+
var currentAdMediaFile;
|
|
361
493
|
var podAds = [];
|
|
362
494
|
var podIndex = 0;
|
|
363
|
-
var sessionId;
|
|
364
495
|
var preloadedAds = /* @__PURE__ */ new Map();
|
|
365
496
|
var preloadingAds = /* @__PURE__ */ new Map();
|
|
366
497
|
var destroyed = false;
|
|
@@ -410,21 +541,47 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
410
541
|
}
|
|
411
542
|
}
|
|
412
543
|
}
|
|
413
|
-
function
|
|
414
|
-
|
|
544
|
+
function buildTrackingMacroContext(errorCode) {
|
|
545
|
+
var context = {
|
|
546
|
+
adPlayheadSeconds: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.currentTime,
|
|
547
|
+
contentPlayheadSeconds: contentVideo.currentTime,
|
|
548
|
+
assetUri: currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url,
|
|
549
|
+
mediaMime: currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.type,
|
|
550
|
+
playerWidth: (adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.clientWidth) || (adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.clientWidth),
|
|
551
|
+
playerHeight: (adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.clientHeight) || (adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.clientHeight)
|
|
552
|
+
};
|
|
553
|
+
if (errorCode != null) {
|
|
554
|
+
context.errorCode = errorCode;
|
|
555
|
+
}
|
|
556
|
+
if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
557
|
+
context.clientUa = navigator.userAgent;
|
|
558
|
+
}
|
|
559
|
+
if (typeof location !== "undefined" && location.href) {
|
|
560
|
+
context.pageUrl = location.href;
|
|
561
|
+
}
|
|
562
|
+
if (podAds.length > 0) {
|
|
563
|
+
context.podSequence = podIndex + 1;
|
|
564
|
+
}
|
|
565
|
+
return context;
|
|
415
566
|
}
|
|
416
|
-
function fireTrackingPixels(urls) {
|
|
567
|
+
function fireTrackingPixels(urls, options2) {
|
|
417
568
|
if (!urls || urls.length === 0) return;
|
|
569
|
+
var macroContext = buildTrackingMacroContext(options2 === null || options2 === void 0 ? void 0 : options2.errorCode);
|
|
418
570
|
urls.forEach(function(url) {
|
|
419
571
|
try {
|
|
420
|
-
var trackingUrl = url;
|
|
421
|
-
if (sessionId) {
|
|
422
|
-
trackingUrl = "".concat(trackingUrl).concat(trackingUrl.includes("?") ? "&" : "?", "session_id=").concat(sessionId);
|
|
423
|
-
}
|
|
424
|
-
if (licenseKey) {
|
|
425
|
-
trackingUrl = "".concat(trackingUrl).concat(trackingUrl.includes("?") ? "&" : "?", "license_key=").concat(licenseKey);
|
|
426
|
-
}
|
|
572
|
+
var trackingUrl = substituteVastTrackingMacros(url, macroContext);
|
|
427
573
|
var img = new Image(1, 1);
|
|
574
|
+
inFlightBeacons.add(img);
|
|
575
|
+
var timeoutId;
|
|
576
|
+
var release = function release() {
|
|
577
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
578
|
+
img.onload = null;
|
|
579
|
+
img.onerror = null;
|
|
580
|
+
inFlightBeacons.delete(img);
|
|
581
|
+
};
|
|
582
|
+
img.onload = release;
|
|
583
|
+
img.onerror = release;
|
|
584
|
+
timeoutId = setTimeout(release, BEACON_TIMEOUT_MS);
|
|
428
585
|
img.src = trackingUrl;
|
|
429
586
|
console.log("[HlsAdPlayer] Fired tracking pixel: ".concat(trackingUrl));
|
|
430
587
|
} catch (error) {
|
|
@@ -1063,7 +1220,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1063
1220
|
if (!adPlaying) return;
|
|
1064
1221
|
console.error("[HlsAdPlayer] Ad video error:", e);
|
|
1065
1222
|
if (currentAd) {
|
|
1066
|
-
fireTrackingPixels(currentAd.trackingUrls.error
|
|
1223
|
+
fireTrackingPixels(currentAd.trackingUrls.error, {
|
|
1224
|
+
errorCode: toVastMediaErrorCode(adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.error)
|
|
1225
|
+
});
|
|
1067
1226
|
}
|
|
1068
1227
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
1069
1228
|
return;
|
|
@@ -1175,9 +1334,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1175
1334
|
delete contentVideo.dataset.stormcloudAdPlaying;
|
|
1176
1335
|
}
|
|
1177
1336
|
}
|
|
1178
|
-
function resetQuartileTracking() {
|
|
1337
|
+
function resetQuartileTracking(preserveImpression) {
|
|
1179
1338
|
trackingFired = {
|
|
1180
|
-
impression: false,
|
|
1339
|
+
impression: preserveImpression ? trackingFired.impression : false,
|
|
1181
1340
|
start: false,
|
|
1182
1341
|
firstQuartile: false,
|
|
1183
1342
|
midpoint: false,
|
|
@@ -1185,27 +1344,6 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1185
1344
|
complete: false
|
|
1186
1345
|
};
|
|
1187
1346
|
}
|
|
1188
|
-
function markCreativeRendered(reason) {
|
|
1189
|
-
if (!currentAd || trackingFired.impression) return;
|
|
1190
|
-
trackingFired.impression = true;
|
|
1191
|
-
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1192
|
-
console.log("[HlsAdPlayer] Impression (pod ".concat(podIndex + 1, "/").concat(podAds.length || 1, ", reason: ").concat(reason, "): ").concat(currentAd.title));
|
|
1193
|
-
emit("ad_impression", {
|
|
1194
|
-
adId: currentAd.id,
|
|
1195
|
-
title: currentAd.title,
|
|
1196
|
-
durationSeconds: currentAd.duration,
|
|
1197
|
-
mediaUrl: currentAdMediaUrl,
|
|
1198
|
-
podIndex: podIndex,
|
|
1199
|
-
podSize: podAds.length || 1,
|
|
1200
|
-
reason: reason
|
|
1201
|
-
});
|
|
1202
|
-
}
|
|
1203
|
-
function canDetectBlackFrames() {
|
|
1204
|
-
if (!adVideoElement) return false;
|
|
1205
|
-
if (requiresMediaPipelineResetAfterAds()) return false;
|
|
1206
|
-
if (isRvfcSupported(adVideoElement)) return true;
|
|
1207
|
-
return getDecodedVideoFrameCount(adVideoElement) !== void 0;
|
|
1208
|
-
}
|
|
1209
1347
|
function isRvfcSupported(video) {
|
|
1210
1348
|
return typeof video.requestVideoFrameCallback === "function";
|
|
1211
1349
|
}
|
|
@@ -1268,7 +1406,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1268
1406
|
if (!mediaFile) {
|
|
1269
1407
|
throw new Error("No media file available for ad");
|
|
1270
1408
|
}
|
|
1271
|
-
|
|
1409
|
+
currentAdMediaFile = mediaFile;
|
|
1272
1410
|
var isHlsAd = isHlsMediaFile(mediaFile);
|
|
1273
1411
|
console.log("[HlsAdPlayer] Loading ".concat(isHlsAd ? "HLS" : "progressive", " ad (pod ").concat(podIndex + 1, "/").concat(podAds.length || 1, ") from: ").concat(mediaFile.url));
|
|
1274
1412
|
if (isHlsAd && import_hls.default.isSupported()) {
|
|
@@ -1312,9 +1450,11 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1312
1450
|
}
|
|
1313
1451
|
podIndex++;
|
|
1314
1452
|
currentAd = podAds[podIndex];
|
|
1315
|
-
|
|
1316
|
-
resetQuartileTracking();
|
|
1453
|
+
currentAdMediaFile = void 0;
|
|
1454
|
+
resetQuartileTracking(false);
|
|
1317
1455
|
if (currentAd) {
|
|
1456
|
+
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1457
|
+
trackingFired.impression = true;
|
|
1318
1458
|
console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
|
|
1319
1459
|
}
|
|
1320
1460
|
clearStallWatchdog();
|
|
@@ -1353,7 +1493,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1353
1493
|
console.warn("[HlsAdPlayer] Ad playback stalled (no progress) - recovering to avoid a blank frame");
|
|
1354
1494
|
clearStallWatchdog();
|
|
1355
1495
|
if (currentAd) {
|
|
1356
|
-
fireTrackingPixels(currentAd.trackingUrls.error
|
|
1496
|
+
fireTrackingPixels(currentAd.trackingUrls.error, {
|
|
1497
|
+
errorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
1498
|
+
});
|
|
1357
1499
|
}
|
|
1358
1500
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
1359
1501
|
return;
|
|
@@ -1409,7 +1551,6 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1409
1551
|
if (!adPlaying) return;
|
|
1410
1552
|
sawDecodedVideoFrame = true;
|
|
1411
1553
|
markRvfcReliable();
|
|
1412
|
-
markCreativeRendered("first_presented_frame");
|
|
1413
1554
|
};
|
|
1414
1555
|
try {
|
|
1415
1556
|
videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
|
|
@@ -1422,7 +1563,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1422
1563
|
console.warn("[HlsAdPlayer] Ad audio is advancing but no video frames decoded (black screen) - skipping this creative");
|
|
1423
1564
|
clearStallWatchdog();
|
|
1424
1565
|
if (currentAd) {
|
|
1425
|
-
fireTrackingPixels(currentAd.trackingUrls.error
|
|
1566
|
+
fireTrackingPixels(currentAd.trackingUrls.error, {
|
|
1567
|
+
errorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
1568
|
+
});
|
|
1426
1569
|
}
|
|
1427
1570
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
1428
1571
|
return;
|
|
@@ -1444,7 +1587,6 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1444
1587
|
if (decodedFrames !== void 0 && decodedFrames > 0) {
|
|
1445
1588
|
sawDecodedVideoFrame = true;
|
|
1446
1589
|
markFrameCounterReliable();
|
|
1447
|
-
markCreativeRendered("decoded_frames");
|
|
1448
1590
|
} else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
|
|
1449
1591
|
var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
|
|
1450
1592
|
if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
|
|
@@ -1457,9 +1599,6 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1457
1599
|
}
|
|
1458
1600
|
}
|
|
1459
1601
|
}
|
|
1460
|
-
if (!trackingFired.impression && !adVideoElement.paused && adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S && (sawDecodedVideoFrame || !canDetectBlackFrames())) {
|
|
1461
|
-
markCreativeRendered(sawDecodedVideoFrame ? "decoded_frames" : "sustained_playback");
|
|
1462
|
-
}
|
|
1463
1602
|
if (adVideoElement.currentTime > lastAdProgressPosition + 0.05) {
|
|
1464
1603
|
noteAdProgress();
|
|
1465
1604
|
return;
|
|
@@ -1560,7 +1699,6 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1560
1699
|
,
|
|
1561
1700
|
6
|
|
1562
1701
|
]);
|
|
1563
|
-
sessionId = generateSessionId();
|
|
1564
1702
|
ads = [];
|
|
1565
1703
|
if (!preloadedAds.has(vastTagUrl)) return [
|
|
1566
1704
|
3,
|
|
@@ -1598,9 +1736,12 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1598
1736
|
podAds = ads;
|
|
1599
1737
|
podIndex = 0;
|
|
1600
1738
|
currentAd = ads[0];
|
|
1601
|
-
|
|
1602
|
-
resetQuartileTracking();
|
|
1739
|
+
currentAdMediaFile = void 0;
|
|
1603
1740
|
console.log("[HlsAdPlayer] Pod parsed: ".concat(ads.length, ' ad(s), first="').concat(currentAd === null || currentAd === void 0 ? void 0 : currentAd.title, '", duration=').concat(currentAd === null || currentAd === void 0 ? void 0 : currentAd.duration, "s"));
|
|
1741
|
+
if (currentAd) {
|
|
1742
|
+
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1743
|
+
trackingFired.impression = true;
|
|
1744
|
+
}
|
|
1604
1745
|
return [
|
|
1605
1746
|
2,
|
|
1606
1747
|
Promise.resolve()
|
|
@@ -1640,7 +1781,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1640
1781
|
contentVideo[AD_VIDEO_PROP] = adVideoElement;
|
|
1641
1782
|
}
|
|
1642
1783
|
setupAdEventListeners();
|
|
1643
|
-
resetQuartileTracking();
|
|
1784
|
+
resetQuartileTracking(true);
|
|
1644
1785
|
contentVolume = contentVideo.volume;
|
|
1645
1786
|
originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
|
|
1646
1787
|
if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
@@ -1730,7 +1871,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1730
1871
|
}
|
|
1731
1872
|
}
|
|
1732
1873
|
currentAd = void 0;
|
|
1733
|
-
|
|
1874
|
+
currentAdMediaFile = void 0;
|
|
1734
1875
|
podAds = [];
|
|
1735
1876
|
podIndex = 0;
|
|
1736
1877
|
return [
|
|
@@ -1771,6 +1912,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1771
1912
|
teardownAdEventListeners();
|
|
1772
1913
|
releaseAdDecoder();
|
|
1773
1914
|
currentAd = void 0;
|
|
1915
|
+
currentAdMediaFile = void 0;
|
|
1774
1916
|
podAds = [];
|
|
1775
1917
|
podIndex = 0;
|
|
1776
1918
|
listeners.clear();
|