stormcloud-video-player 0.8.55 → 0.8.57
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/README.md +2 -2
- package/dist/stormcloud-vp.min.js +1 -3
- package/lib/index.cjs +377 -359
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +12 -30
- package/lib/index.d.ts +12 -30
- package/lib/index.js +357 -303
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +140 -212
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +1 -1
- package/lib/player/AdConfigManager.cjs +103 -211
- package/lib/player/AdConfigManager.cjs.map +1 -1
- package/lib/player/AdConfigManager.d.cts +1 -2
- package/lib/player/AdTimingService.cjs.map +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 +350 -281
- 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/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +350 -281
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.d.cts +1 -1
- package/lib/players/index.cjs +350 -281
- 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/sdk/pal.cjs.map +1 -1
- package/lib/{types-DpbgEvSH.d.cts → types-cTqIKw_D.d.cts} +0 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +350 -281
- 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/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs +135 -212
- package/lib/utils/tracking.cjs.map +1 -1
- package/lib/utils/tracking.d.cts +1 -1
- package/lib/utils/trackingIngest.cjs +322 -0
- package/lib/utils/trackingIngest.cjs.map +1 -0
- package/lib/utils/trackingIngest.d.cts +14 -0
- 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 -3
- package/lib/utils/mqttClient.cjs +0 -305
- package/lib/utils/mqttClient.cjs.map +0 -1
- package/lib/utils/mqttClient.d.cts +0 -13
- package/lib/utils/mqttConfig.cjs +0 -139
- package/lib/utils/mqttConfig.cjs.map +0 -1
- package/lib/utils/mqttConfig.d.cts +0 -20
- package/src/certs/emqxsl-ca.crt +0 -22
package/lib/index.js
CHANGED
|
@@ -560,15 +560,147 @@ function supportsFeature(feature) {
|
|
|
560
560
|
return false;
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
+
// src/utils/vastTrackingMacros.ts
|
|
564
|
+
var VAST_MACRO_PATTERN = /\[([A-Z][A-Z0-9_]*)\]/g;
|
|
565
|
+
var CACHEBUSTING_ALIASES = /\[CACHEBUSTER\]|\[cachebuster\]|\[timestamp\]|\[random\]|\[INSERT_RANDOM_NUMBER\]|%%CACHEBUSTER%%|%%CACHEBUST%%|\$\{CACHEBUSTER\}|\$\{CACHEBUSTING\}|\{cachebuster\}|\{random\}/g;
|
|
566
|
+
var KNOWN_VAST_MACROS = /* @__PURE__ */ new Set([
|
|
567
|
+
"ADCATEGORIES",
|
|
568
|
+
"ADCOUNT",
|
|
569
|
+
"ADPLAYHEAD",
|
|
570
|
+
"ADSERVINGID",
|
|
571
|
+
"ADTYPE",
|
|
572
|
+
"APIFRAMEWORKS",
|
|
573
|
+
"APPBUNDLE",
|
|
574
|
+
"ASSETURI",
|
|
575
|
+
"BLOCKEDADCATEGORIES",
|
|
576
|
+
"BREAKMAXADLENGTH",
|
|
577
|
+
"BREAKMAXADS",
|
|
578
|
+
"BREAKMAXDURATION",
|
|
579
|
+
"BREAKMINADLENGTH",
|
|
580
|
+
"BREAKPOSITION",
|
|
581
|
+
"CACHEBUSTING",
|
|
582
|
+
"CLICKPOS",
|
|
583
|
+
"CLICKTYPE",
|
|
584
|
+
"CLIENTUA",
|
|
585
|
+
"CONTENTID",
|
|
586
|
+
"CONTENTPLAYHEAD",
|
|
587
|
+
"CONTENTURI",
|
|
588
|
+
"DEVICEIP",
|
|
589
|
+
"DEVICEUA",
|
|
590
|
+
"DOMAIN",
|
|
591
|
+
"ERRORCODE",
|
|
592
|
+
"EXTENSIONS",
|
|
593
|
+
"GDPRCONSENT",
|
|
594
|
+
"IFA",
|
|
595
|
+
"IFATYPE",
|
|
596
|
+
"INVENTORYSTATE",
|
|
597
|
+
"LATLONG",
|
|
598
|
+
"LIMITADTRACKING",
|
|
599
|
+
"MEDIAMIME",
|
|
600
|
+
"MEDIAPLAYHEAD",
|
|
601
|
+
"OMIDPARTNER",
|
|
602
|
+
"PAGEURL",
|
|
603
|
+
"PLACEMENTTYPE",
|
|
604
|
+
"PLAYERCAPABILITIES",
|
|
605
|
+
"PLAYERSIZE",
|
|
606
|
+
"PLAYERSTATE",
|
|
607
|
+
"PODSEQUENCE",
|
|
608
|
+
"REGULATIONS",
|
|
609
|
+
"SERVERSIDE",
|
|
610
|
+
"SERVERUA",
|
|
611
|
+
"TIMESTAMP",
|
|
612
|
+
"TRANSACTIONID",
|
|
613
|
+
"UNIVERSALADID",
|
|
614
|
+
"VASTVERSIONS",
|
|
615
|
+
"VERIFICATIONVENDORS"
|
|
616
|
+
]);
|
|
617
|
+
function generateCachebuster() {
|
|
618
|
+
return String(Math.floor(Math.random() * 9e7) + 1e7);
|
|
619
|
+
}
|
|
620
|
+
function formatPlayhead(seconds) {
|
|
621
|
+
if (seconds == null || !Number.isFinite(seconds) || seconds < 0) {
|
|
622
|
+
return void 0;
|
|
623
|
+
}
|
|
624
|
+
var total = Math.floor(seconds);
|
|
625
|
+
var hh = String(Math.floor(total / 3600)).padStart(2, "0");
|
|
626
|
+
var mm = String(Math.floor(total % 3600 / 60)).padStart(2, "0");
|
|
627
|
+
var ss = String(total % 60).padStart(2, "0");
|
|
628
|
+
var ms = String(Math.floor((seconds - total) * 1e3)).padStart(3, "0");
|
|
629
|
+
return "".concat(hh, ":").concat(mm, ":").concat(ss, ".").concat(ms);
|
|
630
|
+
}
|
|
631
|
+
function resolveMacroValues(ctx) {
|
|
632
|
+
var values = /* @__PURE__ */ new Map();
|
|
633
|
+
var set = function set(key, value) {
|
|
634
|
+
if (value != null && value !== "") values.set(key, value);
|
|
635
|
+
};
|
|
636
|
+
var adPlayhead = formatPlayhead(ctx.adPlayheadSeconds);
|
|
637
|
+
set("ADPLAYHEAD", adPlayhead);
|
|
638
|
+
set("MEDIAPLAYHEAD", adPlayhead);
|
|
639
|
+
set("CONTENTPLAYHEAD", formatPlayhead(ctx.contentPlayheadSeconds));
|
|
640
|
+
set("ASSETURI", ctx.assetUri);
|
|
641
|
+
set("MEDIAMIME", ctx.mediaMime);
|
|
642
|
+
set("TIMESTAMP", (/* @__PURE__ */ new Date()).toISOString());
|
|
643
|
+
set("SERVERSIDE", "0");
|
|
644
|
+
if (ctx.errorCode != null && ctx.errorCode !== "") {
|
|
645
|
+
set("ERRORCODE", String(ctx.errorCode));
|
|
646
|
+
}
|
|
647
|
+
if (ctx.playerWidth != null && ctx.playerHeight != null) {
|
|
648
|
+
set("PLAYERSIZE", "".concat(Math.round(ctx.playerWidth), ",").concat(Math.round(ctx.playerHeight)));
|
|
649
|
+
}
|
|
650
|
+
set("IFA", ctx.deviceId);
|
|
651
|
+
set("IFATYPE", ctx.deviceIdType);
|
|
652
|
+
if (ctx.limitAdTracking != null) {
|
|
653
|
+
set("LIMITADTRACKING", ctx.limitAdTracking ? "1" : "0");
|
|
654
|
+
}
|
|
655
|
+
set("PAGEURL", ctx.pageUrl);
|
|
656
|
+
if (ctx.pageUrl) {
|
|
657
|
+
try {
|
|
658
|
+
set("DOMAIN", new URL(ctx.pageUrl).hostname);
|
|
659
|
+
} catch (unused) {}
|
|
660
|
+
}
|
|
661
|
+
set("CLIENTUA", ctx.clientUa);
|
|
662
|
+
set("DEVICEUA", ctx.clientUa);
|
|
663
|
+
if (ctx.podSequence != null) {
|
|
664
|
+
set("PODSEQUENCE", String(ctx.podSequence));
|
|
665
|
+
}
|
|
666
|
+
return values;
|
|
667
|
+
}
|
|
668
|
+
function substituteVastTrackingMacros(url) {
|
|
669
|
+
var ctx = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
670
|
+
if (!url) return url;
|
|
671
|
+
var values = resolveMacroValues(ctx);
|
|
672
|
+
return url.replace(CACHEBUSTING_ALIASES, function() {
|
|
673
|
+
return generateCachebuster();
|
|
674
|
+
}).replace(VAST_MACRO_PATTERN, function(match, name) {
|
|
675
|
+
if (name === "CACHEBUSTING") return generateCachebuster();
|
|
676
|
+
var value = values.get(name);
|
|
677
|
+
if (value != null) return encodeURIComponent(value);
|
|
678
|
+
return KNOWN_VAST_MACROS.has(name) ? "" : match;
|
|
679
|
+
});
|
|
680
|
+
}
|
|
563
681
|
// src/sdk/hlsAdPlayer.ts
|
|
564
682
|
var MAX_VAST_WRAPPER_DEPTH = 5;
|
|
683
|
+
var BEACON_TIMEOUT_MS = 3e4;
|
|
684
|
+
var inFlightBeacons = /* @__PURE__ */ new Set();
|
|
685
|
+
var VAST_ERROR_MEDIA_DISPLAY = 405;
|
|
686
|
+
function toVastMediaErrorCode(error) {
|
|
687
|
+
switch(error === null || error === void 0 ? void 0 : error.code){
|
|
688
|
+
case 1:
|
|
689
|
+
return 400;
|
|
690
|
+
case 2:
|
|
691
|
+
return 401;
|
|
692
|
+
case 4:
|
|
693
|
+
return 403;
|
|
694
|
+
default:
|
|
695
|
+
return VAST_ERROR_MEDIA_DISPLAY;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
565
698
|
function createHlsAdPlayer(contentVideo, options) {
|
|
566
699
|
var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP;
|
|
567
700
|
var adPlaying = false;
|
|
568
701
|
var originalMutedState = false;
|
|
569
702
|
var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
|
|
570
703
|
var listeners = /* @__PURE__ */ new Map();
|
|
571
|
-
var licenseKey = options === null || options === void 0 ? void 0 : options.licenseKey;
|
|
572
704
|
var mainHlsInstance = options === null || options === void 0 ? void 0 : options.mainHlsInstance;
|
|
573
705
|
var AD_CONTAINER_PROP = "__stormcloudAdContainer";
|
|
574
706
|
var AD_VIDEO_PROP = "__stormcloudAdVideo";
|
|
@@ -579,10 +711,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
579
711
|
var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
|
|
580
712
|
var adEventHandlers = [];
|
|
581
713
|
var currentAd;
|
|
582
|
-
var
|
|
714
|
+
var currentAdMediaFile;
|
|
583
715
|
var podAds = [];
|
|
584
716
|
var podIndex = 0;
|
|
585
|
-
var sessionId;
|
|
586
717
|
var preloadedAds = /* @__PURE__ */ new Map();
|
|
587
718
|
var preloadingAds = /* @__PURE__ */ new Map();
|
|
588
719
|
var destroyed = false;
|
|
@@ -632,21 +763,47 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
632
763
|
}
|
|
633
764
|
}
|
|
634
765
|
}
|
|
635
|
-
function
|
|
636
|
-
|
|
766
|
+
function buildTrackingMacroContext(errorCode) {
|
|
767
|
+
var context = {
|
|
768
|
+
adPlayheadSeconds: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.currentTime,
|
|
769
|
+
contentPlayheadSeconds: contentVideo.currentTime,
|
|
770
|
+
assetUri: currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url,
|
|
771
|
+
mediaMime: currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.type,
|
|
772
|
+
playerWidth: (adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.clientWidth) || (adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.clientWidth),
|
|
773
|
+
playerHeight: (adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.clientHeight) || (adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.clientHeight)
|
|
774
|
+
};
|
|
775
|
+
if (errorCode != null) {
|
|
776
|
+
context.errorCode = errorCode;
|
|
777
|
+
}
|
|
778
|
+
if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
779
|
+
context.clientUa = navigator.userAgent;
|
|
780
|
+
}
|
|
781
|
+
if (typeof location !== "undefined" && location.href) {
|
|
782
|
+
context.pageUrl = location.href;
|
|
783
|
+
}
|
|
784
|
+
if (podAds.length > 0) {
|
|
785
|
+
context.podSequence = podIndex + 1;
|
|
786
|
+
}
|
|
787
|
+
return context;
|
|
637
788
|
}
|
|
638
|
-
function fireTrackingPixels(urls) {
|
|
789
|
+
function fireTrackingPixels(urls, options2) {
|
|
639
790
|
if (!urls || urls.length === 0) return;
|
|
791
|
+
var macroContext = buildTrackingMacroContext(options2 === null || options2 === void 0 ? void 0 : options2.errorCode);
|
|
640
792
|
urls.forEach(function(url) {
|
|
641
793
|
try {
|
|
642
|
-
var trackingUrl = url;
|
|
643
|
-
if (sessionId) {
|
|
644
|
-
trackingUrl = "".concat(trackingUrl).concat(trackingUrl.includes("?") ? "&" : "?", "session_id=").concat(sessionId);
|
|
645
|
-
}
|
|
646
|
-
if (licenseKey) {
|
|
647
|
-
trackingUrl = "".concat(trackingUrl).concat(trackingUrl.includes("?") ? "&" : "?", "license_key=").concat(licenseKey);
|
|
648
|
-
}
|
|
794
|
+
var trackingUrl = substituteVastTrackingMacros(url, macroContext);
|
|
649
795
|
var img = new Image(1, 1);
|
|
796
|
+
inFlightBeacons.add(img);
|
|
797
|
+
var timeoutId;
|
|
798
|
+
var release = function release() {
|
|
799
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
800
|
+
img.onload = null;
|
|
801
|
+
img.onerror = null;
|
|
802
|
+
inFlightBeacons.delete(img);
|
|
803
|
+
};
|
|
804
|
+
img.onload = release;
|
|
805
|
+
img.onerror = release;
|
|
806
|
+
timeoutId = setTimeout(release, BEACON_TIMEOUT_MS);
|
|
650
807
|
img.src = trackingUrl;
|
|
651
808
|
console.log("[HlsAdPlayer] Fired tracking pixel: ".concat(trackingUrl));
|
|
652
809
|
} catch (error) {
|
|
@@ -1285,7 +1442,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1285
1442
|
if (!adPlaying) return;
|
|
1286
1443
|
console.error("[HlsAdPlayer] Ad video error:", e);
|
|
1287
1444
|
if (currentAd) {
|
|
1288
|
-
fireTrackingPixels(currentAd.trackingUrls.error
|
|
1445
|
+
fireTrackingPixels(currentAd.trackingUrls.error, {
|
|
1446
|
+
errorCode: toVastMediaErrorCode(adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.error)
|
|
1447
|
+
});
|
|
1289
1448
|
}
|
|
1290
1449
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
1291
1450
|
return;
|
|
@@ -1397,9 +1556,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1397
1556
|
delete contentVideo.dataset.stormcloudAdPlaying;
|
|
1398
1557
|
}
|
|
1399
1558
|
}
|
|
1400
|
-
function resetQuartileTracking() {
|
|
1559
|
+
function resetQuartileTracking(preserveImpression) {
|
|
1401
1560
|
trackingFired = {
|
|
1402
|
-
impression: false,
|
|
1561
|
+
impression: preserveImpression ? trackingFired.impression : false,
|
|
1403
1562
|
start: false,
|
|
1404
1563
|
firstQuartile: false,
|
|
1405
1564
|
midpoint: false,
|
|
@@ -1407,27 +1566,6 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1407
1566
|
complete: false
|
|
1408
1567
|
};
|
|
1409
1568
|
}
|
|
1410
|
-
function markCreativeRendered(reason) {
|
|
1411
|
-
if (!currentAd || trackingFired.impression) return;
|
|
1412
|
-
trackingFired.impression = true;
|
|
1413
|
-
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1414
|
-
console.log("[HlsAdPlayer] Impression (pod ".concat(podIndex + 1, "/").concat(podAds.length || 1, ", reason: ").concat(reason, "): ").concat(currentAd.title));
|
|
1415
|
-
emit("ad_impression", {
|
|
1416
|
-
adId: currentAd.id,
|
|
1417
|
-
title: currentAd.title,
|
|
1418
|
-
durationSeconds: currentAd.duration,
|
|
1419
|
-
mediaUrl: currentAdMediaUrl,
|
|
1420
|
-
podIndex: podIndex,
|
|
1421
|
-
podSize: podAds.length || 1,
|
|
1422
|
-
reason: reason
|
|
1423
|
-
});
|
|
1424
|
-
}
|
|
1425
|
-
function canDetectBlackFrames() {
|
|
1426
|
-
if (!adVideoElement) return false;
|
|
1427
|
-
if (requiresMediaPipelineResetAfterAds()) return false;
|
|
1428
|
-
if (isRvfcSupported(adVideoElement)) return true;
|
|
1429
|
-
return getDecodedVideoFrameCount(adVideoElement) !== void 0;
|
|
1430
|
-
}
|
|
1431
1569
|
function isRvfcSupported(video) {
|
|
1432
1570
|
return typeof video.requestVideoFrameCallback === "function";
|
|
1433
1571
|
}
|
|
@@ -1490,7 +1628,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1490
1628
|
if (!mediaFile) {
|
|
1491
1629
|
throw new Error("No media file available for ad");
|
|
1492
1630
|
}
|
|
1493
|
-
|
|
1631
|
+
currentAdMediaFile = mediaFile;
|
|
1494
1632
|
var isHlsAd = isHlsMediaFile(mediaFile);
|
|
1495
1633
|
console.log("[HlsAdPlayer] Loading ".concat(isHlsAd ? "HLS" : "progressive", " ad (pod ").concat(podIndex + 1, "/").concat(podAds.length || 1, ") from: ").concat(mediaFile.url));
|
|
1496
1634
|
if (isHlsAd && Hls.isSupported()) {
|
|
@@ -1534,9 +1672,11 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1534
1672
|
}
|
|
1535
1673
|
podIndex++;
|
|
1536
1674
|
currentAd = podAds[podIndex];
|
|
1537
|
-
|
|
1538
|
-
resetQuartileTracking();
|
|
1675
|
+
currentAdMediaFile = void 0;
|
|
1676
|
+
resetQuartileTracking(false);
|
|
1539
1677
|
if (currentAd) {
|
|
1678
|
+
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1679
|
+
trackingFired.impression = true;
|
|
1540
1680
|
console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
|
|
1541
1681
|
}
|
|
1542
1682
|
clearStallWatchdog();
|
|
@@ -1575,7 +1715,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1575
1715
|
console.warn("[HlsAdPlayer] Ad playback stalled (no progress) - recovering to avoid a blank frame");
|
|
1576
1716
|
clearStallWatchdog();
|
|
1577
1717
|
if (currentAd) {
|
|
1578
|
-
fireTrackingPixels(currentAd.trackingUrls.error
|
|
1718
|
+
fireTrackingPixels(currentAd.trackingUrls.error, {
|
|
1719
|
+
errorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
1720
|
+
});
|
|
1579
1721
|
}
|
|
1580
1722
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
1581
1723
|
return;
|
|
@@ -1631,7 +1773,6 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1631
1773
|
if (!adPlaying) return;
|
|
1632
1774
|
sawDecodedVideoFrame = true;
|
|
1633
1775
|
markRvfcReliable();
|
|
1634
|
-
markCreativeRendered("first_presented_frame");
|
|
1635
1776
|
};
|
|
1636
1777
|
try {
|
|
1637
1778
|
videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
|
|
@@ -1644,7 +1785,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1644
1785
|
console.warn("[HlsAdPlayer] Ad audio is advancing but no video frames decoded (black screen) - skipping this creative");
|
|
1645
1786
|
clearStallWatchdog();
|
|
1646
1787
|
if (currentAd) {
|
|
1647
|
-
fireTrackingPixels(currentAd.trackingUrls.error
|
|
1788
|
+
fireTrackingPixels(currentAd.trackingUrls.error, {
|
|
1789
|
+
errorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
1790
|
+
});
|
|
1648
1791
|
}
|
|
1649
1792
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
1650
1793
|
return;
|
|
@@ -1666,7 +1809,6 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1666
1809
|
if (decodedFrames !== void 0 && decodedFrames > 0) {
|
|
1667
1810
|
sawDecodedVideoFrame = true;
|
|
1668
1811
|
markFrameCounterReliable();
|
|
1669
|
-
markCreativeRendered("decoded_frames");
|
|
1670
1812
|
} else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
|
|
1671
1813
|
var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
|
|
1672
1814
|
if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
|
|
@@ -1679,9 +1821,6 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1679
1821
|
}
|
|
1680
1822
|
}
|
|
1681
1823
|
}
|
|
1682
|
-
if (!trackingFired.impression && !adVideoElement.paused && adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S && (sawDecodedVideoFrame || !canDetectBlackFrames())) {
|
|
1683
|
-
markCreativeRendered(sawDecodedVideoFrame ? "decoded_frames" : "sustained_playback");
|
|
1684
|
-
}
|
|
1685
1824
|
if (adVideoElement.currentTime > lastAdProgressPosition + 0.05) {
|
|
1686
1825
|
noteAdProgress();
|
|
1687
1826
|
return;
|
|
@@ -1782,7 +1921,6 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1782
1921
|
,
|
|
1783
1922
|
6
|
|
1784
1923
|
]);
|
|
1785
|
-
sessionId = generateSessionId();
|
|
1786
1924
|
ads = [];
|
|
1787
1925
|
if (!preloadedAds.has(vastTagUrl)) return [
|
|
1788
1926
|
3,
|
|
@@ -1820,9 +1958,12 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1820
1958
|
podAds = ads;
|
|
1821
1959
|
podIndex = 0;
|
|
1822
1960
|
currentAd = ads[0];
|
|
1823
|
-
|
|
1824
|
-
resetQuartileTracking();
|
|
1961
|
+
currentAdMediaFile = void 0;
|
|
1825
1962
|
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"));
|
|
1963
|
+
if (currentAd) {
|
|
1964
|
+
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1965
|
+
trackingFired.impression = true;
|
|
1966
|
+
}
|
|
1826
1967
|
return [
|
|
1827
1968
|
2,
|
|
1828
1969
|
Promise.resolve()
|
|
@@ -1862,7 +2003,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1862
2003
|
contentVideo[AD_VIDEO_PROP] = adVideoElement;
|
|
1863
2004
|
}
|
|
1864
2005
|
setupAdEventListeners();
|
|
1865
|
-
resetQuartileTracking();
|
|
2006
|
+
resetQuartileTracking(true);
|
|
1866
2007
|
contentVolume = contentVideo.volume;
|
|
1867
2008
|
originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
|
|
1868
2009
|
if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
|
|
@@ -1952,7 +2093,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1952
2093
|
}
|
|
1953
2094
|
}
|
|
1954
2095
|
currentAd = void 0;
|
|
1955
|
-
|
|
2096
|
+
currentAdMediaFile = void 0;
|
|
1956
2097
|
podAds = [];
|
|
1957
2098
|
podIndex = 0;
|
|
1958
2099
|
return [
|
|
@@ -1993,6 +2134,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1993
2134
|
teardownAdEventListeners();
|
|
1994
2135
|
releaseAdDecoder();
|
|
1995
2136
|
currentAd = void 0;
|
|
2137
|
+
currentAdMediaFile = void 0;
|
|
1996
2138
|
podAds = [];
|
|
1997
2139
|
podIndex = 0;
|
|
1998
2140
|
listeners.clear();
|
|
@@ -2316,184 +2458,89 @@ function createPalNonceManager() {
|
|
|
2316
2458
|
}
|
|
2317
2459
|
};
|
|
2318
2460
|
}
|
|
2319
|
-
// src/utils/
|
|
2320
|
-
var
|
|
2321
|
-
var DEFAULT_MQTT_CONFIG = {
|
|
2461
|
+
// src/utils/trackingIngest.ts
|
|
2462
|
+
var DEFAULT_TRACKING_INGEST_CONFIG = {
|
|
2322
2463
|
enabled: true,
|
|
2323
|
-
|
|
2324
|
-
brokerPort: 8883,
|
|
2325
|
-
wsPort: 8084,
|
|
2326
|
-
username: "for-sonifi",
|
|
2327
|
-
password: "sonifi-mqtt",
|
|
2328
|
-
topicPrefix: "adstorm/players",
|
|
2329
|
-
qos: 1
|
|
2464
|
+
baseUrl: "https://player-analytics-ingest-api-760490581852.us-central1.run.app/api/adstorm/player-tracking"
|
|
2330
2465
|
};
|
|
2331
|
-
var
|
|
2332
|
-
function
|
|
2333
|
-
Object.assign(
|
|
2334
|
-
}
|
|
2335
|
-
function isMQTTEnabled() {
|
|
2336
|
-
return mqttConfig.enabled;
|
|
2337
|
-
}
|
|
2338
|
-
function buildMQTTBrokerUrl() {
|
|
2339
|
-
if (mqttConfig.brokerUrl) return mqttConfig.brokerUrl;
|
|
2340
|
-
return "wss://".concat(mqttConfig.brokerAddress, ":").concat(mqttConfig.wsPort, "/mqtt");
|
|
2341
|
-
}
|
|
2342
|
-
function buildPlayerTopic(licenseKey, channel) {
|
|
2343
|
-
return "".concat(mqttConfig.topicPrefix, "/").concat(licenseKey, "/").concat(channel);
|
|
2344
|
-
}
|
|
2345
|
-
// src/utils/mqttClient.ts
|
|
2346
|
-
import mqtt from "mqtt";
|
|
2347
|
-
var LOG = "[StormcloudVideoPlayer][MQTT]";
|
|
2348
|
-
var KEEPALIVE_SECONDS = 30;
|
|
2349
|
-
var CONNECT_TIMEOUT_MS = 1e4;
|
|
2350
|
-
var RECONNECT_BASE_MS = 5e3;
|
|
2351
|
-
var RECONNECT_MAX_MS = 6e4;
|
|
2352
|
-
var MAX_RECONNECT_ATTEMPTS = 8;
|
|
2353
|
-
var COOLDOWN_MS = 10 * 6e4;
|
|
2354
|
-
var client = null;
|
|
2355
|
-
var status = "disconnected";
|
|
2356
|
-
var reconnectAttempts = 0;
|
|
2357
|
-
var reconnectTimer = null;
|
|
2358
|
-
var stopped = false;
|
|
2359
|
-
function getMQTTStatus() {
|
|
2360
|
-
return status;
|
|
2361
|
-
}
|
|
2362
|
-
function isMQTTConnected() {
|
|
2363
|
-
return status === "connected" && client !== null && client.connected;
|
|
2364
|
-
}
|
|
2365
|
-
function isMQTTConfigured() {
|
|
2366
|
-
return isMQTTEnabled();
|
|
2367
|
-
}
|
|
2368
|
-
function configureMQTT(overrides) {
|
|
2369
|
-
applyMQTTConfig(overrides);
|
|
2370
|
-
disconnectMQTT();
|
|
2371
|
-
}
|
|
2372
|
-
function clearReconnectTimer() {
|
|
2373
|
-
if (reconnectTimer) {
|
|
2374
|
-
clearTimeout(reconnectTimer);
|
|
2375
|
-
reconnectTimer = null;
|
|
2376
|
-
}
|
|
2377
|
-
}
|
|
2378
|
-
function teardownClient() {
|
|
2379
|
-
if (client) {
|
|
2380
|
-
try {
|
|
2381
|
-
client.removeAllListeners();
|
|
2382
|
-
client.end(true);
|
|
2383
|
-
} catch (unused) {}
|
|
2384
|
-
client = null;
|
|
2385
|
-
}
|
|
2386
|
-
}
|
|
2387
|
-
function scheduleReconnect() {
|
|
2388
|
-
if (stopped || !isMQTTEnabled() || reconnectTimer) return;
|
|
2389
|
-
if (reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) {
|
|
2390
|
-
console.warn("".concat(LOG, " giving up after ").concat(reconnectAttempts, " attempts; cooling down for ").concat(COOLDOWN_MS / 6e4, "m"));
|
|
2391
|
-
teardownClient();
|
|
2392
|
-
status = "disconnected";
|
|
2393
|
-
reconnectTimer = setTimeout(function() {
|
|
2394
|
-
reconnectTimer = null;
|
|
2395
|
-
reconnectAttempts = 0;
|
|
2396
|
-
openConnection();
|
|
2397
|
-
}, COOLDOWN_MS);
|
|
2398
|
-
return;
|
|
2399
|
-
}
|
|
2400
|
-
var delay = Math.min(RECONNECT_MAX_MS, RECONNECT_BASE_MS * Math.pow(2, reconnectAttempts));
|
|
2401
|
-
var jitter = Math.floor(Math.random() * 1e3);
|
|
2402
|
-
reconnectAttempts += 1;
|
|
2403
|
-
reconnectTimer = setTimeout(function() {
|
|
2404
|
-
reconnectTimer = null;
|
|
2405
|
-
openConnection();
|
|
2406
|
-
}, delay + jitter);
|
|
2407
|
-
}
|
|
2408
|
-
function openConnection() {
|
|
2409
|
-
if (stopped || !isMQTTEnabled()) return;
|
|
2410
|
-
teardownClient();
|
|
2411
|
-
var url = buildMQTTBrokerUrl();
|
|
2412
|
-
status = "connecting";
|
|
2413
|
-
var clientId = "stormcloud-vp-".concat(Math.random().toString(36).slice(2, 9));
|
|
2414
|
-
try {
|
|
2415
|
-
client = mqtt.connect(url, {
|
|
2416
|
-
clientId: clientId,
|
|
2417
|
-
username: mqttConfig.username,
|
|
2418
|
-
password: mqttConfig.password,
|
|
2419
|
-
keepalive: KEEPALIVE_SECONDS,
|
|
2420
|
-
clean: true,
|
|
2421
|
-
// Disable MQTT.js internal reconnect; we manage reconnection ourselves.
|
|
2422
|
-
reconnectPeriod: 0,
|
|
2423
|
-
connectTimeout: CONNECT_TIMEOUT_MS,
|
|
2424
|
-
queueQoSZero: false,
|
|
2425
|
-
reschedulePings: true,
|
|
2426
|
-
// Root-cause fix for the Tizen 4.0 "Keepalive timeout" loop: MQTT.js's
|
|
2427
|
-
// default timerVariant "auto" runs the keepalive interval inside a
|
|
2428
|
-
// Blob-URL Web Worker (via worker-timers). On Samsung Tizen 4.0 (old
|
|
2429
|
-
// WebKit) served from a file:// origin that worker can't tick reliably,
|
|
2430
|
-
// so the keepalive counter trips onKeepaliveTimeout almost immediately
|
|
2431
|
-
// after connect. Force the native setInterval timer instead; the main
|
|
2432
|
-
// thread is free because video is decoded by the native AVPlay pipeline.
|
|
2433
|
-
timerVariant: "native"
|
|
2434
|
-
});
|
|
2435
|
-
} catch (err) {
|
|
2436
|
-
status = "error";
|
|
2437
|
-
console.warn("".concat(LOG, " connect() threw:"), err);
|
|
2438
|
-
scheduleReconnect();
|
|
2439
|
-
return;
|
|
2440
|
-
}
|
|
2441
|
-
client.on("connect", function() {
|
|
2442
|
-
status = "connected";
|
|
2443
|
-
reconnectAttempts = 0;
|
|
2444
|
-
clearReconnectTimer();
|
|
2445
|
-
console.info("".concat(LOG, " connected to ").concat(url));
|
|
2446
|
-
});
|
|
2447
|
-
client.on("offline", function() {
|
|
2448
|
-
if (status === "connected") status = "disconnected";
|
|
2449
|
-
console.warn("".concat(LOG, " offline"));
|
|
2450
|
-
scheduleReconnect();
|
|
2451
|
-
});
|
|
2452
|
-
client.on("error", function(err) {
|
|
2453
|
-
status = "error";
|
|
2454
|
-
console.warn("".concat(LOG, " error:"), err.message);
|
|
2455
|
-
scheduleReconnect();
|
|
2456
|
-
});
|
|
2457
|
-
client.on("close", function() {
|
|
2458
|
-
if (status === "connected") status = "disconnected";
|
|
2459
|
-
scheduleReconnect();
|
|
2460
|
-
});
|
|
2466
|
+
var trackingIngestConfig = _object_spread({}, DEFAULT_TRACKING_INGEST_CONFIG);
|
|
2467
|
+
function applyTrackingIngestConfig(overrides) {
|
|
2468
|
+
Object.assign(trackingIngestConfig, overrides);
|
|
2461
2469
|
}
|
|
2462
|
-
function
|
|
2463
|
-
|
|
2464
|
-
stopped = false;
|
|
2465
|
-
reconnectAttempts = 0;
|
|
2466
|
-
openConnection();
|
|
2470
|
+
function configureTrackingIngest(overrides) {
|
|
2471
|
+
applyTrackingIngestConfig(overrides);
|
|
2467
2472
|
}
|
|
2468
|
-
function
|
|
2469
|
-
|
|
2470
|
-
initMQTTClient();
|
|
2471
|
-
}
|
|
2473
|
+
function isTrackingIngestEnabled() {
|
|
2474
|
+
return trackingIngestConfig.enabled === true;
|
|
2472
2475
|
}
|
|
2473
|
-
function
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
if (
|
|
2479
|
-
return
|
|
2480
|
-
}
|
|
2481
|
-
try {
|
|
2482
|
-
client.publish(topic, JSON.stringify(payload), {
|
|
2483
|
-
qos: mqttConfig.qos
|
|
2484
|
-
});
|
|
2485
|
-
return true;
|
|
2486
|
-
} catch (err) {
|
|
2487
|
-
console.warn("".concat(LOG, " publish failed on ").concat(topic, ":"), err);
|
|
2488
|
-
return false;
|
|
2476
|
+
function normalizeIngestBaseUrl(baseUrl) {
|
|
2477
|
+
return baseUrl.replace(/\/+$/, "");
|
|
2478
|
+
}
|
|
2479
|
+
function buildTrackingIngestUrl(channel) {
|
|
2480
|
+
var base = normalizeIngestBaseUrl(trackingIngestConfig.baseUrl);
|
|
2481
|
+
if (channel === "impressions") {
|
|
2482
|
+
return "".concat(base, "/impressions/ingest");
|
|
2489
2483
|
}
|
|
2484
|
+
return "".concat(base, "/metrics/ingest");
|
|
2490
2485
|
}
|
|
2491
|
-
function
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2486
|
+
function ingestPlayerTracking(licenseKey, channel, body) {
|
|
2487
|
+
return _async_to_generator(function() {
|
|
2488
|
+
var response, error;
|
|
2489
|
+
return _ts_generator(this, function(_state) {
|
|
2490
|
+
switch(_state.label){
|
|
2491
|
+
case 0:
|
|
2492
|
+
if (!isTrackingIngestEnabled() || !licenseKey) {
|
|
2493
|
+
return [
|
|
2494
|
+
2,
|
|
2495
|
+
false
|
|
2496
|
+
];
|
|
2497
|
+
}
|
|
2498
|
+
_state.label = 1;
|
|
2499
|
+
case 1:
|
|
2500
|
+
_state.trys.push([
|
|
2501
|
+
1,
|
|
2502
|
+
3,
|
|
2503
|
+
,
|
|
2504
|
+
4
|
|
2505
|
+
]);
|
|
2506
|
+
return [
|
|
2507
|
+
4,
|
|
2508
|
+
fetch(buildTrackingIngestUrl(channel), {
|
|
2509
|
+
method: "POST",
|
|
2510
|
+
headers: {
|
|
2511
|
+
"Content-Type": "application/json",
|
|
2512
|
+
Authorization: "License-Key ".concat(licenseKey)
|
|
2513
|
+
},
|
|
2514
|
+
body: JSON.stringify(body)
|
|
2515
|
+
})
|
|
2516
|
+
];
|
|
2517
|
+
case 2:
|
|
2518
|
+
response = _state.sent();
|
|
2519
|
+
if (!response.ok) {
|
|
2520
|
+
console.warn("[StormcloudVideoPlayer] Tracking ingest failed (".concat(response.status, ") for ").concat(channel));
|
|
2521
|
+
return [
|
|
2522
|
+
2,
|
|
2523
|
+
false
|
|
2524
|
+
];
|
|
2525
|
+
}
|
|
2526
|
+
return [
|
|
2527
|
+
2,
|
|
2528
|
+
true
|
|
2529
|
+
];
|
|
2530
|
+
case 3:
|
|
2531
|
+
error = _state.sent();
|
|
2532
|
+
console.warn("[StormcloudVideoPlayer] Tracking ingest error for ".concat(channel, ":"), error);
|
|
2533
|
+
return [
|
|
2534
|
+
2,
|
|
2535
|
+
false
|
|
2536
|
+
];
|
|
2537
|
+
case 4:
|
|
2538
|
+
return [
|
|
2539
|
+
2
|
|
2540
|
+
];
|
|
2541
|
+
}
|
|
2542
|
+
});
|
|
2543
|
+
})();
|
|
2497
2544
|
}
|
|
2498
2545
|
// src/utils/vastEnvironmentSignals.ts
|
|
2499
2546
|
var AIRY_ANDROID_APP_ID = "com.freeairytv.android";
|
|
@@ -3264,7 +3311,7 @@ function getBrowserID(clientInfo) {
|
|
|
3264
3311
|
})();
|
|
3265
3312
|
}
|
|
3266
3313
|
function canPublish(licenseKey) {
|
|
3267
|
-
return Boolean(
|
|
3314
|
+
return Boolean(isTrackingIngestEnabled() && licenseKey);
|
|
3268
3315
|
}
|
|
3269
3316
|
function buildPlayerMetricEvent() {
|
|
3270
3317
|
return _async_to_generator(function() {
|
|
@@ -3306,21 +3353,6 @@ function buildPlayerMetricEvent() {
|
|
|
3306
3353
|
});
|
|
3307
3354
|
}).apply(this, arguments);
|
|
3308
3355
|
}
|
|
3309
|
-
function publishTracking(licenseKey, channel, body) {
|
|
3310
|
-
var debug = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
|
|
3311
|
-
ensureMQTTClient();
|
|
3312
|
-
var topic = buildPlayerTopic(licenseKey, channel);
|
|
3313
|
-
var published = publishMQTT(topic, body);
|
|
3314
|
-
if (debug) {
|
|
3315
|
-
console.log("[StormcloudVideoPlayer] publishTracking:", JSON.stringify({
|
|
3316
|
-
licenseKey: licenseKey,
|
|
3317
|
-
channel: channel,
|
|
3318
|
-
topic: topic,
|
|
3319
|
-
body: body,
|
|
3320
|
-
published: published
|
|
3321
|
-
}, null, 2));
|
|
3322
|
-
}
|
|
3323
|
-
}
|
|
3324
3356
|
function sendInitialTracking(_0) {
|
|
3325
3357
|
return _async_to_generator(function(licenseKey) {
|
|
3326
3358
|
var context, metricEvent, error;
|
|
@@ -3336,9 +3368,9 @@ function sendInitialTracking(_0) {
|
|
|
3336
3368
|
case 1:
|
|
3337
3369
|
_state.trys.push([
|
|
3338
3370
|
1,
|
|
3339
|
-
|
|
3371
|
+
4,
|
|
3340
3372
|
,
|
|
3341
|
-
|
|
3373
|
+
5
|
|
3342
3374
|
]);
|
|
3343
3375
|
return [
|
|
3344
3376
|
4,
|
|
@@ -3349,23 +3381,28 @@ function sendInitialTracking(_0) {
|
|
|
3349
3381
|
];
|
|
3350
3382
|
case 2:
|
|
3351
3383
|
metricEvent = _state.sent();
|
|
3352
|
-
publishTracking(licenseKey, "metrics", {
|
|
3353
|
-
events: [
|
|
3354
|
-
metricEvent
|
|
3355
|
-
]
|
|
3356
|
-
}, !!context.debugAdTiming);
|
|
3357
3384
|
return [
|
|
3358
|
-
|
|
3359
|
-
|
|
3385
|
+
4,
|
|
3386
|
+
ingestPlayerTracking(licenseKey, "metrics", {
|
|
3387
|
+
events: [
|
|
3388
|
+
metricEvent
|
|
3389
|
+
]
|
|
3390
|
+
})
|
|
3360
3391
|
];
|
|
3361
3392
|
case 3:
|
|
3393
|
+
_state.sent();
|
|
3394
|
+
return [
|
|
3395
|
+
3,
|
|
3396
|
+
5
|
|
3397
|
+
];
|
|
3398
|
+
case 4:
|
|
3362
3399
|
error = _state.sent();
|
|
3363
3400
|
console.error("[StormcloudVideoPlayer] Error sending initial tracking data:", error);
|
|
3364
3401
|
return [
|
|
3365
3402
|
3,
|
|
3366
|
-
|
|
3403
|
+
5
|
|
3367
3404
|
];
|
|
3368
|
-
case
|
|
3405
|
+
case 5:
|
|
3369
3406
|
return [
|
|
3370
3407
|
2
|
|
3371
3408
|
];
|
|
@@ -3463,7 +3500,7 @@ function sendAdLoadedTracking(_0, _1) {
|
|
|
3463
3500
|
}
|
|
3464
3501
|
function sendAdImpressionTracking(_0, _1) {
|
|
3465
3502
|
return _async_to_generator(function(licenseKey, adImpressionInfo) {
|
|
3466
|
-
var context,
|
|
3503
|
+
var context, metricEvent, error;
|
|
3467
3504
|
var _arguments = arguments;
|
|
3468
3505
|
return _ts_generator(this, function(_state) {
|
|
3469
3506
|
switch(_state.label){
|
|
@@ -3476,9 +3513,9 @@ function sendAdImpressionTracking(_0, _1) {
|
|
|
3476
3513
|
case 1:
|
|
3477
3514
|
_state.trys.push([
|
|
3478
3515
|
1,
|
|
3479
|
-
|
|
3516
|
+
5,
|
|
3480
3517
|
,
|
|
3481
|
-
|
|
3518
|
+
6
|
|
3482
3519
|
]);
|
|
3483
3520
|
return [
|
|
3484
3521
|
4,
|
|
@@ -3488,30 +3525,43 @@ function sendAdImpressionTracking(_0, _1) {
|
|
|
3488
3525
|
];
|
|
3489
3526
|
case 2:
|
|
3490
3527
|
metricEvent = _state.sent();
|
|
3491
|
-
publishTracking(licenseKey, "heartbeat", metricEvent, !!context.debugAdTiming);
|
|
3492
|
-
publishTracking(licenseKey, "impressions", {
|
|
3493
|
-
events: [
|
|
3494
|
-
{
|
|
3495
|
-
event_id: createUuid(),
|
|
3496
|
-
player_id: metricEvent.player_id,
|
|
3497
|
-
ad_played_count: 1,
|
|
3498
|
-
ad_url: (_adImpressionInfo_adUrl = adImpressionInfo.adUrl) !== null && _adImpressionInfo_adUrl !== void 0 ? _adImpressionInfo_adUrl : adImpressionInfo.adId,
|
|
3499
|
-
capture_at: adImpressionInfo.timestamp
|
|
3500
|
-
}
|
|
3501
|
-
]
|
|
3502
|
-
}, !!context.debugAdTiming);
|
|
3503
3528
|
return [
|
|
3504
|
-
|
|
3505
|
-
|
|
3529
|
+
4,
|
|
3530
|
+
ingestPlayerTracking(licenseKey, "metrics", {
|
|
3531
|
+
events: [
|
|
3532
|
+
metricEvent
|
|
3533
|
+
]
|
|
3534
|
+
})
|
|
3506
3535
|
];
|
|
3507
3536
|
case 3:
|
|
3537
|
+
_state.sent();
|
|
3538
|
+
return [
|
|
3539
|
+
4,
|
|
3540
|
+
ingestPlayerTracking(licenseKey, "impressions", {
|
|
3541
|
+
events: [
|
|
3542
|
+
{
|
|
3543
|
+
player_id: metricEvent.player_id,
|
|
3544
|
+
ad_played_count: 1,
|
|
3545
|
+
ad_url: adImpressionInfo.adUrl,
|
|
3546
|
+
capture_at: adImpressionInfo.timestamp
|
|
3547
|
+
}
|
|
3548
|
+
]
|
|
3549
|
+
})
|
|
3550
|
+
];
|
|
3551
|
+
case 4:
|
|
3552
|
+
_state.sent();
|
|
3553
|
+
return [
|
|
3554
|
+
3,
|
|
3555
|
+
6
|
|
3556
|
+
];
|
|
3557
|
+
case 5:
|
|
3508
3558
|
error = _state.sent();
|
|
3509
3559
|
console.error("[StormcloudVideoPlayer] Error sending ad impression tracking:", error);
|
|
3510
3560
|
return [
|
|
3511
3561
|
3,
|
|
3512
|
-
|
|
3562
|
+
6
|
|
3513
3563
|
];
|
|
3514
|
-
case
|
|
3564
|
+
case 6:
|
|
3515
3565
|
return [
|
|
3516
3566
|
2
|
|
3517
3567
|
];
|
|
@@ -3534,9 +3584,9 @@ function sendHeartbeat(_0) {
|
|
|
3534
3584
|
case 1:
|
|
3535
3585
|
_state.trys.push([
|
|
3536
3586
|
1,
|
|
3537
|
-
|
|
3587
|
+
4,
|
|
3538
3588
|
,
|
|
3539
|
-
|
|
3589
|
+
5
|
|
3540
3590
|
]);
|
|
3541
3591
|
return [
|
|
3542
3592
|
4,
|
|
@@ -3544,19 +3594,28 @@ function sendHeartbeat(_0) {
|
|
|
3544
3594
|
];
|
|
3545
3595
|
case 2:
|
|
3546
3596
|
heartbeatData = _state.sent();
|
|
3547
|
-
publishTracking(licenseKey, "heartbeat", heartbeatData, !!context.debugAdTiming);
|
|
3548
3597
|
return [
|
|
3549
|
-
|
|
3550
|
-
|
|
3598
|
+
4,
|
|
3599
|
+
ingestPlayerTracking(licenseKey, "metrics", {
|
|
3600
|
+
events: [
|
|
3601
|
+
heartbeatData
|
|
3602
|
+
]
|
|
3603
|
+
})
|
|
3551
3604
|
];
|
|
3552
3605
|
case 3:
|
|
3606
|
+
_state.sent();
|
|
3607
|
+
return [
|
|
3608
|
+
3,
|
|
3609
|
+
5
|
|
3610
|
+
];
|
|
3611
|
+
case 4:
|
|
3553
3612
|
error = _state.sent();
|
|
3554
3613
|
console.error("[StormcloudVideoPlayer] Error sending heartbeat:", error);
|
|
3555
3614
|
return [
|
|
3556
3615
|
3,
|
|
3557
|
-
|
|
3616
|
+
5
|
|
3558
3617
|
];
|
|
3559
|
-
case
|
|
3618
|
+
case 5:
|
|
3560
3619
|
return [
|
|
3561
3620
|
2
|
|
3562
3621
|
];
|
|
@@ -5435,7 +5494,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5435
5494
|
];
|
|
5436
5495
|
case 4:
|
|
5437
5496
|
data = _state.sent();
|
|
5438
|
-
this.applyMqttConfigFromResponse(data);
|
|
5439
5497
|
imaPayload = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : (_data_response_ima = _data_response.ima) === null || _data_response_ima === void 0 ? void 0 : (_data_response_ima_publisherdeskima = _data_response_ima["publisherdesk.ima"]) === null || _data_response_ima_publisherdeskima === void 0 ? void 0 : _data_response_ima_publisherdeskima.payload;
|
|
5440
5498
|
if (imaPayload) {
|
|
5441
5499
|
decodedPayload = imaPayload;
|
|
@@ -5469,20 +5527,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
|
|
|
5469
5527
|
}).call(this);
|
|
5470
5528
|
}
|
|
5471
5529
|
},
|
|
5472
|
-
{
|
|
5473
|
-
key: "applyMqttConfigFromResponse",
|
|
5474
|
-
value: function applyMqttConfigFromResponse(data) {
|
|
5475
|
-
var _data_response;
|
|
5476
|
-
var mqttConfig2 = (_data_response = data.response) === null || _data_response === void 0 ? void 0 : _data_response.mqtt_config;
|
|
5477
|
-
if (!mqttConfig2 || (typeof mqttConfig2 === "undefined" ? "undefined" : _type_of(mqttConfig2)) !== "object") {
|
|
5478
|
-
return;
|
|
5479
|
-
}
|
|
5480
|
-
applyMQTTConfig(mqttConfig2);
|
|
5481
|
-
if (this.debug) {
|
|
5482
|
-
console.log("[StormcloudVideoPlayer] Applied MQTT config from /ads/web:", mqttConfig2);
|
|
5483
|
-
}
|
|
5484
|
-
}
|
|
5485
|
-
},
|
|
5486
5530
|
{
|
|
5487
5531
|
key: "fetchAndParseVmap",
|
|
5488
5532
|
value: function fetchAndParseVmap(vmapUrl) {
|
|
@@ -7347,22 +7391,27 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
7347
7391
|
console.log("[POD] Playing pod ad ".concat((payload === null || payload === void 0 ? void 0 : payload.index) != null ? payload.index + 1 : "?", "/").concat((_ref = payload === null || payload === void 0 ? void 0 : payload.total) !== null && _ref !== void 0 ? _ref : "?"));
|
|
7348
7392
|
}
|
|
7349
7393
|
});
|
|
7350
|
-
adPlayer.on("
|
|
7351
|
-
|
|
7394
|
+
adPlayer.on("all_ads_completed", function() {
|
|
7395
|
+
sendAdImpressionTracking(_this.host.config.licenseKey, {
|
|
7352
7396
|
source: "hls",
|
|
7353
7397
|
adIndex: _this.timing.currentAdIndex,
|
|
7354
7398
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
7355
|
-
};
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7399
|
+
}, _this.analyticsContext).catch(function() {});
|
|
7400
|
+
_this.timing.recordPlayedAdDuration(_this.host.getAdPlayer());
|
|
7401
|
+
var remaining = _this.timing.getRemainingAdMs();
|
|
7402
|
+
_this.timing.consecutiveFailures = 0;
|
|
7403
|
+
if (_this.debug) {
|
|
7404
|
+
console.log("[StormcloudVideoPlayer] all_ads_completed event received - remaining=".concat(remaining, "ms, queued ads=").concat(_this.adRequestQueue.length), _this.adRequestQueue.length > 0 ? {
|
|
7405
|
+
queuedUrls: _to_consumable_array(_this.adRequestQueue)
|
|
7406
|
+
} : {});
|
|
7360
7407
|
}
|
|
7361
|
-
|
|
7362
|
-
if (_this.
|
|
7363
|
-
|
|
7408
|
+
if (_this.inAdBreak) {
|
|
7409
|
+
if (_this.timing.hasTimeToStartAnotherAd()) {
|
|
7410
|
+
_this.tryNextAvailableAdWithRateLimit();
|
|
7411
|
+
} else {
|
|
7412
|
+
_this.handleAdPodComplete();
|
|
7364
7413
|
}
|
|
7365
|
-
}
|
|
7414
|
+
}
|
|
7366
7415
|
});
|
|
7367
7416
|
adPlayer.on("ad_error", function(errorPayload) {
|
|
7368
7417
|
var errorMessage = "Ad playback failed";
|
|
@@ -7405,6 +7454,11 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
7405
7454
|
}
|
|
7406
7455
|
});
|
|
7407
7456
|
adPlayer.on("content_resume", function() {
|
|
7457
|
+
sendAdImpressionTracking(_this.host.config.licenseKey, {
|
|
7458
|
+
source: "hls",
|
|
7459
|
+
adIndex: _this.timing.currentAdIndex,
|
|
7460
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
7461
|
+
}, _this.analyticsContext).catch(function() {});
|
|
7408
7462
|
if (!_this.host.video.muted) {
|
|
7409
7463
|
_this.host.video.muted = true;
|
|
7410
7464
|
if (_this.debug) {
|
|
@@ -12183,5 +12237,5 @@ var createStormcloudPlayer = function createStormcloudPlayer(playerList, fallbac
|
|
|
12183
12237
|
};
|
|
12184
12238
|
var StormcloudPlayer = createStormcloudPlayer(players_default, players_default[players_default.length - 1]);
|
|
12185
12239
|
var StormcloudPlayer_default = StormcloudPlayer;
|
|
12186
|
-
export {
|
|
12240
|
+
export { DEFAULT_TRACKING_INGEST_CONFIG, IS_BROWSER, IS_GLOBAL, IS_IOS, IS_SAFARI, SUPPORTS_DASH, SUPPORTS_HLS, StormcloudPlayer_default as StormcloudPlayer, StormcloudVideoPlayer, StormcloudVideoPlayerComponent, applyTrackingIngestConfig, buildAnalyticsContext, canPlay, configureTrackingIngest, createHlsAdPlayer, createPalNonceManager, createStormcloudPlayer, StormcloudVideoPlayerComponent as default, detectBrowser, getBrowserConfigOverrides, getBrowserID, getClientInfo, ingestPlayerTracking, initializePolyfills, isMediaStream, isTrackingIngestEnabled, lazy, logBrowserInfo, merge, omit, parseQuery, players_default as players, randomString, requiresMediaPipelineResetAfterAds, sendAdDetectTracking, sendAdImpressionTracking, sendAdLoadedTracking, sendHeartbeat, sendInitialTracking, supportsFeature, supportsModernJS, supportsWebKitPresentationMode, trackingIngestConfig };
|
|
12187
12241
|
//# sourceMappingURL=index.js.map
|