stormcloud-video-player 0.8.63 → 0.8.65
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/StormcloudPlayer.cjs +1046 -187
- package/lib/StormcloudPlayer.cjs.map +1 -1
- package/lib/index.cjs +1046 -187
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +7 -0
- package/lib/index.js +1046 -187
- package/lib/index.js.map +1 -1
- package/lib/player/AdBreakOrchestrator.cjs +307 -31
- package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
- package/lib/player/AdBreakOrchestrator.d.cts +18 -0
- package/lib/player/AdTimingService.cjs +9 -1
- package/lib/player/AdTimingService.cjs.map +1 -1
- package/lib/player/AdTimingService.d.cts +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +1046 -187
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +1046 -187
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +1046 -187
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs +781 -154
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.d.cts +1 -0
- package/lib/types.d.cts +6 -0
- package/lib/ui/StormcloudVideoPlayer.cjs +1046 -187
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -747,6 +747,7 @@ function parseProgressOffset(offset) {
|
|
|
747
747
|
} : void 0;
|
|
748
748
|
}
|
|
749
749
|
var MAX_VAST_WRAPPER_DEPTH = 5;
|
|
750
|
+
var VAST_REQUEST_TIMEOUT_MS = 5e3;
|
|
750
751
|
var BEACON_TIMEOUT_MS = 3e4;
|
|
751
752
|
var inFlightBeacons = /* @__PURE__ */ new Set();
|
|
752
753
|
var VAST_ERROR_MEDIA_DISPLAY = 405;
|
|
@@ -770,7 +771,7 @@ function toVastMediaErrorCode(error) {
|
|
|
770
771
|
}
|
|
771
772
|
}
|
|
772
773
|
function createHlsAdPlayer(contentVideo, options) {
|
|
773
|
-
var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP;
|
|
774
|
+
var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP, _ref;
|
|
774
775
|
var adPlaying = false;
|
|
775
776
|
var originalMutedState = false;
|
|
776
777
|
var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
|
|
@@ -802,6 +803,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
802
803
|
var sawDecodedVideoFrame = false;
|
|
803
804
|
var videoFrameCallbackHandle;
|
|
804
805
|
var pendingPlayPromise;
|
|
806
|
+
var currentVastTagUrl;
|
|
807
|
+
var funnelContext = {};
|
|
808
|
+
var mediaCandidates = [];
|
|
809
|
+
var mediaCandidateIndex = 0;
|
|
810
|
+
var mediaStartTimerId;
|
|
811
|
+
var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
|
|
812
|
+
var VAST_ERROR_MEDIA_TIMEOUT = 402;
|
|
813
|
+
var pendingVastRequests = /* @__PURE__ */ new Set();
|
|
814
|
+
var pendingRequestAbortReason;
|
|
815
|
+
var forcedMuteByAutoplay = false;
|
|
805
816
|
function createTrackingState() {
|
|
806
817
|
return {
|
|
807
818
|
impression: false,
|
|
@@ -852,6 +863,77 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
852
863
|
}
|
|
853
864
|
}
|
|
854
865
|
}
|
|
866
|
+
var SENSITIVE_URL_PARAMS = /* @__PURE__ */ new Set([
|
|
867
|
+
"ppid",
|
|
868
|
+
"rdid",
|
|
869
|
+
"idtype",
|
|
870
|
+
"is_lat",
|
|
871
|
+
"ifa",
|
|
872
|
+
"idfa",
|
|
873
|
+
"aaid",
|
|
874
|
+
"uid",
|
|
875
|
+
"user_id",
|
|
876
|
+
"userid",
|
|
877
|
+
"device_id",
|
|
878
|
+
"deviceid",
|
|
879
|
+
"ip",
|
|
880
|
+
"ua",
|
|
881
|
+
"gdpr_consent",
|
|
882
|
+
"us_privacy",
|
|
883
|
+
"gpp",
|
|
884
|
+
"addtl_consent",
|
|
885
|
+
"cust_params",
|
|
886
|
+
"email"
|
|
887
|
+
]);
|
|
888
|
+
function redactUrl(url) {
|
|
889
|
+
if (!url) return url;
|
|
890
|
+
try {
|
|
891
|
+
var parsed = new URL(url);
|
|
892
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
893
|
+
try {
|
|
894
|
+
for(var _iterator = Array.from(parsed.searchParams.keys())[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
895
|
+
var key = _step.value;
|
|
896
|
+
if (SENSITIVE_URL_PARAMS.has(key.toLowerCase())) {
|
|
897
|
+
parsed.searchParams.set(key, "REDACTED");
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
} catch (err) {
|
|
901
|
+
_didIteratorError = true;
|
|
902
|
+
_iteratorError = err;
|
|
903
|
+
} finally{
|
|
904
|
+
try {
|
|
905
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
906
|
+
_iterator.return();
|
|
907
|
+
}
|
|
908
|
+
} finally{
|
|
909
|
+
if (_didIteratorError) {
|
|
910
|
+
throw _iteratorError;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
return parsed.toString();
|
|
915
|
+
} catch (unused) {
|
|
916
|
+
return url.split("?")[0];
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
function logFunnel(stage) {
|
|
920
|
+
var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
921
|
+
var payload = _object_spread({
|
|
922
|
+
stage: stage,
|
|
923
|
+
breakId: funnelContext.breakId,
|
|
924
|
+
requestId: funnelContext.requestId,
|
|
925
|
+
visibilityState: typeof document !== "undefined" ? document.visibilityState : void 0,
|
|
926
|
+
adId: currentAd === null || currentAd === void 0 ? void 0 : currentAd.id,
|
|
927
|
+
podIndex: podIndex,
|
|
928
|
+
podSize: podAds.length,
|
|
929
|
+
vastUrl: redactUrl(currentVastTagUrl),
|
|
930
|
+
mediaUrl: currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url,
|
|
931
|
+
mediaType: currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.type,
|
|
932
|
+
muted: adVideoElement ? adVideoElement.muted : void 0
|
|
933
|
+
}, extra);
|
|
934
|
+
console.log("[HlsAdPlayer][FUNNEL] ".concat(stage), payload);
|
|
935
|
+
emit("ad_funnel", payload);
|
|
936
|
+
}
|
|
855
937
|
function buildTrackingMacroContext() {
|
|
856
938
|
var options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
857
939
|
var _options2_ad;
|
|
@@ -891,20 +973,53 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
891
973
|
urls.forEach(function(url) {
|
|
892
974
|
try {
|
|
893
975
|
var trackingUrl = substituteVastTrackingMacros(url, macroContext);
|
|
976
|
+
var trackingHost;
|
|
977
|
+
try {
|
|
978
|
+
trackingHost = new URL(trackingUrl).host;
|
|
979
|
+
} catch (unused) {
|
|
980
|
+
logFunnel("tracking_url_invalid", {
|
|
981
|
+
trackingUrl: redactUrl(trackingUrl)
|
|
982
|
+
});
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
var unexpanded = trackingUrl.match(/\[[A-Z_]+\]/g);
|
|
986
|
+
if (unexpanded) {
|
|
987
|
+
logFunnel("tracking_url_unexpanded_macro", {
|
|
988
|
+
trackingHost: trackingHost,
|
|
989
|
+
macros: Array.from(new Set(unexpanded))
|
|
990
|
+
});
|
|
991
|
+
}
|
|
894
992
|
var img = new Image(1, 1);
|
|
895
993
|
inFlightBeacons.add(img);
|
|
896
994
|
var timeoutId;
|
|
897
|
-
var release = function release() {
|
|
995
|
+
var release = function release(outcome) {
|
|
898
996
|
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
899
997
|
img.onload = null;
|
|
900
998
|
img.onerror = null;
|
|
901
999
|
inFlightBeacons.delete(img);
|
|
1000
|
+
console.log("[HlsAdPlayer] Tracking pixel settled (".concat(outcome, "): ").concat(trackingUrl));
|
|
1001
|
+
if (outcome !== "load") {
|
|
1002
|
+
logFunnel("tracking_request_settled", {
|
|
1003
|
+
reason: outcome,
|
|
1004
|
+
trackingHost: trackingHost
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
img.onload = function() {
|
|
1009
|
+
return release("load");
|
|
1010
|
+
};
|
|
1011
|
+
img.onerror = function() {
|
|
1012
|
+
return release("error");
|
|
902
1013
|
};
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
1014
|
+
timeoutId = setTimeout(function() {
|
|
1015
|
+
return release("timeout");
|
|
1016
|
+
}, BEACON_TIMEOUT_MS);
|
|
906
1017
|
img.src = trackingUrl;
|
|
907
1018
|
console.log("[HlsAdPlayer] Fired tracking pixel: ".concat(trackingUrl));
|
|
1019
|
+
logFunnel("tracking_request_created", {
|
|
1020
|
+
trackingHost: trackingHost,
|
|
1021
|
+
errorCode: options2 === null || options2 === void 0 ? void 0 : options2.errorCode
|
|
1022
|
+
});
|
|
908
1023
|
} catch (error) {
|
|
909
1024
|
console.warn("[HlsAdPlayer] Error firing tracking pixel:", error);
|
|
910
1025
|
}
|
|
@@ -934,54 +1049,80 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
934
1049
|
bitrate: level.bitrate || 5e6
|
|
935
1050
|
};
|
|
936
1051
|
}
|
|
937
|
-
function
|
|
938
|
-
if (mediaFiles.length === 0) {
|
|
939
|
-
throw new Error("No media files available");
|
|
940
|
-
}
|
|
941
|
-
var firstFile = mediaFiles[0];
|
|
942
|
-
if (!firstFile) {
|
|
943
|
-
throw new Error("No media files available");
|
|
944
|
-
}
|
|
945
|
-
if (mediaFiles.length === 1) {
|
|
946
|
-
return firstFile;
|
|
947
|
-
}
|
|
1052
|
+
function getMediaTargetQuality() {
|
|
948
1053
|
var mainQuality = getMainStreamQuality();
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
1054
|
+
var dpr = typeof window !== "undefined" && window.devicePixelRatio > 0 ? window.devicePixelRatio : 1;
|
|
1055
|
+
var containerWidth = ((adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.clientWidth) || contentVideo.clientWidth) * dpr;
|
|
1056
|
+
var containerHeight = ((adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.clientHeight) || contentVideo.clientHeight) * dpr;
|
|
1057
|
+
if (!mainQuality && !(containerWidth > 0 && containerHeight > 0)) {
|
|
1058
|
+
return null;
|
|
1059
|
+
}
|
|
1060
|
+
var base = mainQuality !== null && mainQuality !== void 0 ? mainQuality : {
|
|
1061
|
+
width: containerWidth,
|
|
1062
|
+
height: containerHeight,
|
|
1063
|
+
bitrate: 5e6
|
|
1064
|
+
};
|
|
1065
|
+
var width = containerWidth > 0 ? Math.min(base.width, containerWidth) : base.width;
|
|
1066
|
+
var height = containerHeight > 0 ? Math.min(base.height, containerHeight) : base.height;
|
|
1067
|
+
return {
|
|
1068
|
+
width: width,
|
|
1069
|
+
height: height,
|
|
1070
|
+
bitrate: base.bitrate
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
function rankMediaCandidates(mediaFiles) {
|
|
1074
|
+
var probe = adVideoElement !== null && adVideoElement !== void 0 ? adVideoElement : document.createElement("video");
|
|
1075
|
+
var pageIsHttps = typeof location !== "undefined" && location.protocol === "https:";
|
|
1076
|
+
var target = getMediaTargetQuality();
|
|
1077
|
+
var accepted = [];
|
|
1078
|
+
mediaFiles.forEach(function(file, index) {
|
|
1079
|
+
var isHls = isHlsMediaFile(file);
|
|
1080
|
+
var mimeForProbe = isHls ? "application/vnd.apple.mpegurl" : file.type || "video/mp4";
|
|
1081
|
+
var canPlay2 = probe.canPlayType(mimeForProbe);
|
|
1082
|
+
var playable = isHls ? import_hls.default.isSupported() || canPlay2 !== "" : canPlay2 !== "";
|
|
1083
|
+
var insecure = pageIsHttps && /^http:/i.test(file.url);
|
|
1084
|
+
var details = {
|
|
1085
|
+
index: index,
|
|
1086
|
+
candidateUrl: file.url,
|
|
1087
|
+
candidateType: file.type,
|
|
1088
|
+
width: file.width,
|
|
1089
|
+
height: file.height,
|
|
1090
|
+
bitrate: file.bitrate,
|
|
1091
|
+
canPlayType: canPlay2,
|
|
1092
|
+
hlsJs: isHls ? import_hls.default.isSupported() : void 0
|
|
1093
|
+
};
|
|
1094
|
+
if (!playable) {
|
|
1095
|
+
logFunnel("media_candidate", _object_spread_props(_object_spread({}, details), {
|
|
1096
|
+
reason: "rejected",
|
|
1097
|
+
why: "cannot_play_type"
|
|
1098
|
+
}));
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
var score = 0;
|
|
1102
|
+
if (target) {
|
|
1103
|
+
var resolutionDiff = Math.abs(file.width - target.width) + Math.abs(file.height - target.height);
|
|
1104
|
+
var bitrateDiff = Math.abs((file.bitrate || 5e3) * 1e3 - target.bitrate);
|
|
1105
|
+
score = resolutionDiff * 2 + bitrateDiff / 1e3;
|
|
1106
|
+
}
|
|
1107
|
+
accepted.push({
|
|
962
1108
|
file: file,
|
|
963
1109
|
score: score,
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
}
|
|
1110
|
+
insecure: insecure
|
|
1111
|
+
});
|
|
1112
|
+
logFunnel("media_candidate", _object_spread_props(_object_spread({}, details), {
|
|
1113
|
+
reason: "accepted",
|
|
1114
|
+
// Mixed-content media is often auto-upgraded, so it is kept as a last resort.
|
|
1115
|
+
why: insecure ? "insecure_http_deprioritized" : "playable",
|
|
1116
|
+
score: score
|
|
1117
|
+
}));
|
|
967
1118
|
});
|
|
968
|
-
|
|
1119
|
+
accepted.sort(function(a, b) {
|
|
1120
|
+
if (a.insecure !== b.insecure) return a.insecure ? 1 : -1;
|
|
969
1121
|
return a.score - b.score;
|
|
970
1122
|
});
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
console.log("[HlsAdPlayer] No best match found, using first media file");
|
|
974
|
-
return firstFile;
|
|
975
|
-
}
|
|
976
|
-
console.log("[HlsAdPlayer] Selected media file:", {
|
|
977
|
-
url: bestMatch.file.url,
|
|
978
|
-
resolution: "".concat(bestMatch.file.width, "x").concat(bestMatch.file.height),
|
|
979
|
-
bitrate: bestMatch.file.bitrate,
|
|
980
|
-
score: bestMatch.score,
|
|
981
|
-
resolutionDiff: bestMatch.resolutionDiff,
|
|
982
|
-
bitrateDiff: bestMatch.bitrateDiff
|
|
1123
|
+
return accepted.map(function(entry) {
|
|
1124
|
+
return entry.file;
|
|
983
1125
|
});
|
|
984
|
-
return bestMatch.file;
|
|
985
1126
|
}
|
|
986
1127
|
function isHlsMediaFile(mediaFile) {
|
|
987
1128
|
var type = mediaFile.type.toLowerCase();
|
|
@@ -998,9 +1139,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
998
1139
|
var url = (mediaFile.url.toLowerCase().split("?")[0] || "").trim();
|
|
999
1140
|
return type.startsWith("audio/") || url.endsWith(".mp3") || url.endsWith(".aac") || url.endsWith(".m4a") || url.endsWith(".ogg") || url.endsWith(".oga") || url.endsWith(".opus") || url.endsWith(".wav") || url.endsWith(".weba");
|
|
1000
1141
|
}
|
|
1001
|
-
function collectVideoMediaFiles(linear, verbose) {
|
|
1142
|
+
function collectVideoMediaFiles(linear, verbose, stats) {
|
|
1002
1143
|
var mediaFileElements = linear.querySelectorAll(":scope > MediaFiles > MediaFile");
|
|
1003
1144
|
var mediaFiles = [];
|
|
1145
|
+
if (stats) stats.total += mediaFileElements.length;
|
|
1004
1146
|
if (verbose) {
|
|
1005
1147
|
console.log("[HlsAdPlayer] Found ".concat(mediaFileElements.length, " MediaFile element(s) in VAST XML"));
|
|
1006
1148
|
}
|
|
@@ -1021,6 +1163,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1021
1163
|
}
|
|
1022
1164
|
var apiFramework = (mf.getAttribute("apiFramework") || "").toUpperCase();
|
|
1023
1165
|
if (apiFramework === "VPAID") {
|
|
1166
|
+
if (stats) stats.vpaid++;
|
|
1024
1167
|
if (verbose) {
|
|
1025
1168
|
console.log("[HlsAdPlayer] MediaFile ".concat(index, " ignored (VPAID creatives are not supported)"));
|
|
1026
1169
|
}
|
|
@@ -1036,11 +1179,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1036
1179
|
bitrate: bitrateValue && bitrateValue > 0 ? bitrateValue : void 0
|
|
1037
1180
|
};
|
|
1038
1181
|
if (isAudioMediaFile(mediaFile)) {
|
|
1182
|
+
if (stats) stats.audio++;
|
|
1039
1183
|
console.warn("[HlsAdPlayer] MediaFile ".concat(index, ' skipped (audio-only, type="').concat(type, '") — audio ads are not played to avoid a black screen'));
|
|
1040
1184
|
return;
|
|
1041
1185
|
}
|
|
1042
1186
|
var hasExplicitDimensions = mf.getAttribute("width") != null && mf.getAttribute("height") != null;
|
|
1043
1187
|
if (!isHlsMediaFile(mediaFile) && hasExplicitDimensions && (mediaFile.width <= 1 || mediaFile.height <= 1)) {
|
|
1188
|
+
if (stats) stats.audio++;
|
|
1044
1189
|
console.warn("[HlsAdPlayer] MediaFile ".concat(index, " skipped (degenerate dimensions ").concat(mediaFile.width, "x").concat(mediaFile.height, ', type="').concat(type, '") — likely an audio-only placeholder rendition'));
|
|
1045
1190
|
return;
|
|
1046
1191
|
}
|
|
@@ -1049,8 +1194,11 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1049
1194
|
if (verbose) {
|
|
1050
1195
|
console.log("[HlsAdPlayer] Added ".concat(isHlsMediaFile(mediaFile) ? "HLS" : "progressive", " MediaFile: ").concat(url));
|
|
1051
1196
|
}
|
|
1052
|
-
} else
|
|
1053
|
-
|
|
1197
|
+
} else {
|
|
1198
|
+
if (stats) stats.unsupported++;
|
|
1199
|
+
if (verbose) {
|
|
1200
|
+
console.log("[HlsAdPlayer] MediaFile ".concat(index, ' ignored (type="').concat(type, '" is not supported)'));
|
|
1201
|
+
}
|
|
1054
1202
|
}
|
|
1055
1203
|
});
|
|
1056
1204
|
return mediaFiles;
|
|
@@ -1174,26 +1322,58 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1174
1322
|
}
|
|
1175
1323
|
function parseVastXml(xmlString) {
|
|
1176
1324
|
try {
|
|
1177
|
-
var _adElements_find;
|
|
1178
1325
|
var xmlDoc = parseXml(xmlString);
|
|
1179
1326
|
if (!xmlDoc) return {
|
|
1180
1327
|
type: "empty"
|
|
1181
1328
|
};
|
|
1182
1329
|
var root = xmlDoc.documentElement;
|
|
1183
1330
|
var adElements = Array.from(root.querySelectorAll(":scope > Ad"));
|
|
1184
|
-
|
|
1185
|
-
return getAdSequence(el) === void 0;
|
|
1186
|
-
})) !== null && _adElements_find !== void 0 ? _adElements_find : adElements[0];
|
|
1187
|
-
if (!adElement) {
|
|
1331
|
+
if (adElements.length === 0) {
|
|
1188
1332
|
var _root_getAttribute;
|
|
1189
1333
|
console.warn("[HlsAdPlayer] No Ad element found in VAST ".concat((_root_getAttribute = root.getAttribute("version")) !== null && _root_getAttribute !== void 0 ? _root_getAttribute : "", " response"));
|
|
1190
1334
|
return emptyVastResult(root);
|
|
1191
1335
|
}
|
|
1192
|
-
var
|
|
1193
|
-
|
|
1194
|
-
|
|
1336
|
+
var ordered = _to_consumable_array(adElements.filter(function(el) {
|
|
1337
|
+
return getAdSequence(el) === void 0;
|
|
1338
|
+
})).concat(_to_consumable_array(adElements.filter(function(el) {
|
|
1339
|
+
return getAdSequence(el) !== void 0;
|
|
1340
|
+
})));
|
|
1341
|
+
var firstEmpty;
|
|
1342
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1343
|
+
try {
|
|
1344
|
+
for(var _iterator = ordered.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1345
|
+
var _step_value = _sliced_to_array(_step.value, 2), index = _step_value[0], adElement = _step_value[1];
|
|
1346
|
+
var parsed = parseAdElement(adElement, true);
|
|
1347
|
+
if (parsed.type === "empty") {
|
|
1348
|
+
firstEmpty !== null && firstEmpty !== void 0 ? firstEmpty : firstEmpty = parsed;
|
|
1349
|
+
continue;
|
|
1350
|
+
}
|
|
1351
|
+
if (index > 0) {
|
|
1352
|
+
logFunnel("vast_ad_fallback", {
|
|
1353
|
+
usedAdIndex: index,
|
|
1354
|
+
adCount: ordered.length
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
if (parsed.type === "wrapper") {
|
|
1358
|
+
console.log("[HlsAdPlayer] VAST wrapper detected, following VASTAdTagURI: ".concat(parsed.vastAdTagUri));
|
|
1359
|
+
}
|
|
1360
|
+
return parsed;
|
|
1361
|
+
}
|
|
1362
|
+
} catch (err) {
|
|
1363
|
+
_didIteratorError = true;
|
|
1364
|
+
_iteratorError = err;
|
|
1365
|
+
} finally{
|
|
1366
|
+
try {
|
|
1367
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1368
|
+
_iterator.return();
|
|
1369
|
+
}
|
|
1370
|
+
} finally{
|
|
1371
|
+
if (_didIteratorError) {
|
|
1372
|
+
throw _iteratorError;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1195
1375
|
}
|
|
1196
|
-
return
|
|
1376
|
+
return firstEmpty !== null && firstEmpty !== void 0 ? firstEmpty : emptyVastResult(root);
|
|
1197
1377
|
} catch (error) {
|
|
1198
1378
|
console.error("[HlsAdPlayer] Error parsing VAST XML:", error);
|
|
1199
1379
|
return {
|
|
@@ -1239,6 +1419,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1239
1419
|
pushUrls(errorUrls, inLine.querySelectorAll(":scope > Error"));
|
|
1240
1420
|
if (adElement.getAttribute("conditionalAd") === "true") {
|
|
1241
1421
|
console.warn("[HlsAdPlayer] Skipping conditional <Ad> (VPAID-only)");
|
|
1422
|
+
logFunnel("vast_no_supported_media", {
|
|
1423
|
+
reason: "vpaid_only",
|
|
1424
|
+
conditionalAd: true
|
|
1425
|
+
});
|
|
1242
1426
|
return {
|
|
1243
1427
|
type: "empty",
|
|
1244
1428
|
errorUrls: errorUrls,
|
|
@@ -1247,11 +1431,17 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1247
1431
|
}
|
|
1248
1432
|
var linear;
|
|
1249
1433
|
var mediaFiles = [];
|
|
1434
|
+
var rejectStats = {
|
|
1435
|
+
total: 0,
|
|
1436
|
+
vpaid: 0,
|
|
1437
|
+
audio: 0,
|
|
1438
|
+
unsupported: 0
|
|
1439
|
+
};
|
|
1250
1440
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1251
1441
|
try {
|
|
1252
1442
|
for(var _iterator = Array.from(inLine.querySelectorAll(":scope > Creatives > Creative > Linear"))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1253
1443
|
var candidate = _step.value;
|
|
1254
|
-
var files = collectVideoMediaFiles(candidate, verbose);
|
|
1444
|
+
var files = collectVideoMediaFiles(candidate, verbose, rejectStats);
|
|
1255
1445
|
if (files.length > 0) {
|
|
1256
1446
|
linear = candidate;
|
|
1257
1447
|
mediaFiles = files;
|
|
@@ -1274,6 +1464,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1274
1464
|
}
|
|
1275
1465
|
if (!linear) {
|
|
1276
1466
|
console.warn("[HlsAdPlayer] No supported linear media files in <Ad>");
|
|
1467
|
+
var reason = rejectStats.total === 0 ? "no_mediafiles" : rejectStats.vpaid > 0 ? "vpaid_only" : rejectStats.audio > 0 ? "audio_only" : "unsupported_type";
|
|
1468
|
+
logFunnel("vast_no_supported_media", _object_spread({
|
|
1469
|
+
reason: reason
|
|
1470
|
+
}, rejectStats));
|
|
1277
1471
|
return {
|
|
1278
1472
|
type: "empty",
|
|
1279
1473
|
errorUrls: errorUrls,
|
|
@@ -1305,77 +1499,122 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1305
1499
|
function fetchVastXml(vastTagUrl) {
|
|
1306
1500
|
var credentials = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "include";
|
|
1307
1501
|
return _async_to_generator(function() {
|
|
1308
|
-
var requestVast, response, error;
|
|
1502
|
+
var controller, timeoutId, requestVast, response, error, error1;
|
|
1309
1503
|
return _ts_generator(this, function(_state) {
|
|
1310
1504
|
switch(_state.label){
|
|
1311
1505
|
case 0:
|
|
1506
|
+
if (destroyed) {
|
|
1507
|
+
throw new Error("VAST request skipped: ad player destroyed");
|
|
1508
|
+
}
|
|
1509
|
+
controller = typeof AbortController !== "undefined" ? new AbortController() : void 0;
|
|
1510
|
+
if (controller) pendingVastRequests.add(controller);
|
|
1511
|
+
timeoutId = controller ? setTimeout(function() {
|
|
1512
|
+
return controller.abort();
|
|
1513
|
+
}, VAST_REQUEST_TIMEOUT_MS) : void 0;
|
|
1312
1514
|
requestVast = function requestVast(creds) {
|
|
1313
|
-
return fetch(vastTagUrl, {
|
|
1515
|
+
return fetch(vastTagUrl, _object_spread({
|
|
1314
1516
|
mode: "cors",
|
|
1315
1517
|
credentials: creds,
|
|
1316
1518
|
headers: {
|
|
1317
1519
|
"Accept": "application/xml, text/xml, */*"
|
|
1318
1520
|
},
|
|
1319
1521
|
referrerPolicy: "no-referrer-when-downgrade"
|
|
1320
|
-
}
|
|
1522
|
+
}, controller ? {
|
|
1523
|
+
signal: controller.signal
|
|
1524
|
+
} : {}));
|
|
1321
1525
|
};
|
|
1322
1526
|
_state.label = 1;
|
|
1323
1527
|
case 1:
|
|
1324
1528
|
_state.trys.push([
|
|
1325
1529
|
1,
|
|
1326
|
-
|
|
1530
|
+
10,
|
|
1531
|
+
11,
|
|
1532
|
+
12
|
|
1533
|
+
]);
|
|
1534
|
+
_state.label = 2;
|
|
1535
|
+
case 2:
|
|
1536
|
+
_state.trys.push([
|
|
1537
|
+
2,
|
|
1538
|
+
4,
|
|
1327
1539
|
,
|
|
1328
|
-
|
|
1540
|
+
8
|
|
1329
1541
|
]);
|
|
1330
1542
|
return [
|
|
1331
1543
|
4,
|
|
1332
1544
|
requestVast(credentials)
|
|
1333
1545
|
];
|
|
1334
|
-
case
|
|
1546
|
+
case 3:
|
|
1335
1547
|
response = _state.sent();
|
|
1336
1548
|
return [
|
|
1337
1549
|
3,
|
|
1338
|
-
|
|
1550
|
+
8
|
|
1339
1551
|
];
|
|
1340
|
-
case
|
|
1552
|
+
case 4:
|
|
1341
1553
|
error = _state.sent();
|
|
1342
|
-
if (!(credentials !== "omit")) return [
|
|
1554
|
+
if (!(credentials !== "omit" && !(controller === null || controller === void 0 ? void 0 : controller.signal.aborted))) return [
|
|
1343
1555
|
3,
|
|
1344
|
-
|
|
1556
|
+
6
|
|
1345
1557
|
];
|
|
1346
1558
|
console.warn('[HlsAdPlayer] VAST fetch failed with credentials="'.concat(credentials, '", retrying without credentials:'), error);
|
|
1559
|
+
logFunnel("vast_credentials_retry", {
|
|
1560
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
1561
|
+
});
|
|
1347
1562
|
return [
|
|
1348
1563
|
4,
|
|
1349
1564
|
requestVast("omit")
|
|
1350
1565
|
];
|
|
1351
|
-
case
|
|
1566
|
+
case 5:
|
|
1352
1567
|
response = _state.sent();
|
|
1353
1568
|
return [
|
|
1354
1569
|
3,
|
|
1355
|
-
|
|
1570
|
+
7
|
|
1356
1571
|
];
|
|
1357
|
-
case 5:
|
|
1358
|
-
throw error;
|
|
1359
1572
|
case 6:
|
|
1573
|
+
throw error;
|
|
1574
|
+
case 7:
|
|
1360
1575
|
return [
|
|
1361
1576
|
3,
|
|
1362
|
-
|
|
1577
|
+
8
|
|
1363
1578
|
];
|
|
1364
|
-
case
|
|
1579
|
+
case 8:
|
|
1365
1580
|
if (!response.ok) {
|
|
1366
1581
|
throw new Error("Failed to fetch VAST: ".concat(response.statusText));
|
|
1367
1582
|
}
|
|
1368
1583
|
return [
|
|
1369
|
-
|
|
1584
|
+
4,
|
|
1370
1585
|
response.text()
|
|
1371
1586
|
];
|
|
1587
|
+
case 9:
|
|
1588
|
+
return [
|
|
1589
|
+
2,
|
|
1590
|
+
_state.sent()
|
|
1591
|
+
];
|
|
1592
|
+
case 10:
|
|
1593
|
+
error1 = _state.sent();
|
|
1594
|
+
if (controller === null || controller === void 0 ? void 0 : controller.signal.aborted) {
|
|
1595
|
+
if (pendingRequestAbortReason) {
|
|
1596
|
+
throw new Error("".concat(pendingRequestAbortReason, " (timeout): ").concat(vastTagUrl));
|
|
1597
|
+
}
|
|
1598
|
+
throw new Error("VAST request timeout after ".concat(VAST_REQUEST_TIMEOUT_MS, "ms: ").concat(vastTagUrl));
|
|
1599
|
+
}
|
|
1600
|
+
throw error1;
|
|
1601
|
+
case 11:
|
|
1602
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
1603
|
+
if (controller) pendingVastRequests.delete(controller);
|
|
1604
|
+
return [
|
|
1605
|
+
7
|
|
1606
|
+
];
|
|
1607
|
+
case 12:
|
|
1608
|
+
return [
|
|
1609
|
+
2
|
|
1610
|
+
];
|
|
1372
1611
|
}
|
|
1373
1612
|
});
|
|
1374
1613
|
})();
|
|
1375
1614
|
}
|
|
1376
1615
|
function fetchAndParseVastAd(_0) {
|
|
1377
1616
|
return _async_to_generator(function(vastTagUrl) {
|
|
1378
|
-
var depth, accumulatedTracking, rules, vastXml, error, parsed, _parsed_errorUrls, _parsed_errorCode;
|
|
1617
|
+
var depth, accumulatedTracking, rules, vastXml, fetchStartedAt, error, parsed, _parsed_errorUrls, _parsed_errorCode;
|
|
1379
1618
|
var _arguments = arguments;
|
|
1380
1619
|
return _ts_generator(this, function(_state) {
|
|
1381
1620
|
switch(_state.label){
|
|
@@ -1383,6 +1622,11 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1383
1622
|
depth = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : 0, accumulatedTracking = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : createEmptyTrackingUrls(), rules = _arguments.length > 3 && _arguments[3] !== void 0 ? _arguments[3] : {
|
|
1384
1623
|
followAdditionalWrappers: true
|
|
1385
1624
|
};
|
|
1625
|
+
if (destroyed) return [
|
|
1626
|
+
2,
|
|
1627
|
+
null
|
|
1628
|
+
];
|
|
1629
|
+
fetchStartedAt = Date.now();
|
|
1386
1630
|
_state.label = 1;
|
|
1387
1631
|
case 1:
|
|
1388
1632
|
_state.trys.push([
|
|
@@ -1405,14 +1649,35 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1405
1649
|
error = _state.sent();
|
|
1406
1650
|
if (depth === 0) throw error;
|
|
1407
1651
|
console.warn("[HlsAdPlayer] Wrapped VAST request failed:", error);
|
|
1408
|
-
|
|
1409
|
-
|
|
1652
|
+
logFunnel("wrapper_fetch", {
|
|
1653
|
+
reason: "failure",
|
|
1654
|
+
depth: depth,
|
|
1655
|
+
wrapperUrl: redactUrl(vastTagUrl),
|
|
1656
|
+
elapsedMs: Date.now() - fetchStartedAt,
|
|
1657
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
1410
1658
|
});
|
|
1659
|
+
if (!destroyed) {
|
|
1660
|
+
fireTrackingPixels(accumulatedTracking.error, {
|
|
1661
|
+
errorCode: VAST_ERROR_WRAPPER_TIMEOUT
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1411
1664
|
return [
|
|
1412
1665
|
2,
|
|
1413
1666
|
null
|
|
1414
1667
|
];
|
|
1415
1668
|
case 4:
|
|
1669
|
+
if (destroyed) return [
|
|
1670
|
+
2,
|
|
1671
|
+
null
|
|
1672
|
+
];
|
|
1673
|
+
if (depth > 0) {
|
|
1674
|
+
logFunnel("wrapper_fetch", {
|
|
1675
|
+
reason: "success",
|
|
1676
|
+
depth: depth,
|
|
1677
|
+
wrapperUrl: redactUrl(vastTagUrl),
|
|
1678
|
+
elapsedMs: Date.now() - fetchStartedAt
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1416
1681
|
console.log("[HlsAdPlayer] VAST XML received");
|
|
1417
1682
|
console.log("[HlsAdPlayer] VAST XML content (first 2000 chars):", vastXml.substring(0, 2e3));
|
|
1418
1683
|
parsed = parseVastXml(vastXml);
|
|
@@ -1444,6 +1709,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1444
1709
|
];
|
|
1445
1710
|
}
|
|
1446
1711
|
mergeTrackingUrls(parsed.ad.trackingUrls, accumulatedTracking);
|
|
1712
|
+
logFunnel("inline_resolved", {
|
|
1713
|
+
depth: depth
|
|
1714
|
+
});
|
|
1447
1715
|
return [
|
|
1448
1716
|
2,
|
|
1449
1717
|
parsed.ad
|
|
@@ -1454,7 +1722,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1454
1722
|
}
|
|
1455
1723
|
function fetchAndParsePod(vastTagUrl) {
|
|
1456
1724
|
return _async_to_generator(function() {
|
|
1457
|
-
var _root_getAttribute, vastXml, trimmedXml, xmlDoc, root, adElements, _root_getAttribute1, _empty_errorUrls, empty, _empty_errorCode, resolveAd, podElements, buffet, ads, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step,
|
|
1725
|
+
var _root_getAttribute, vastXml, trimmedXml, xmlDoc, root, adElements, _root_getAttribute1, _empty_errorUrls, empty, _empty_errorCode, resolveAd, podElements, buffet, resolveAll, ads, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, ad, err, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, ad1, err;
|
|
1458
1726
|
return _ts_generator(this, function(_state) {
|
|
1459
1727
|
switch(_state.label){
|
|
1460
1728
|
case 0:
|
|
@@ -1464,6 +1732,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1464
1732
|
];
|
|
1465
1733
|
case 1:
|
|
1466
1734
|
vastXml = _state.sent();
|
|
1735
|
+
if (destroyed) return [
|
|
1736
|
+
2,
|
|
1737
|
+
[]
|
|
1738
|
+
];
|
|
1467
1739
|
console.log("[HlsAdPlayer] Pod VAST XML received (length=".concat(vastXml.length, ")"));
|
|
1468
1740
|
trimmedXml = vastXml.trim();
|
|
1469
1741
|
if (trimmedXml.length === 0) {
|
|
@@ -1535,6 +1807,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1535
1807
|
buffet = adElements.filter(function(el) {
|
|
1536
1808
|
return getAdSequence(el) === void 0;
|
|
1537
1809
|
});
|
|
1810
|
+
resolveAll = function resolveAll(elements) {
|
|
1811
|
+
return Promise.all(elements.map(function(el) {
|
|
1812
|
+
return resolveAd(el).catch(function() {
|
|
1813
|
+
return null;
|
|
1814
|
+
});
|
|
1815
|
+
}));
|
|
1816
|
+
};
|
|
1538
1817
|
ads = [];
|
|
1539
1818
|
if (!(podElements.length === 0)) return [
|
|
1540
1819
|
3,
|
|
@@ -1549,27 +1828,26 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1549
1828
|
8,
|
|
1550
1829
|
9
|
|
1551
1830
|
]);
|
|
1552
|
-
|
|
1553
|
-
|
|
1831
|
+
return [
|
|
1832
|
+
4,
|
|
1833
|
+
resolveAll(buffet)
|
|
1834
|
+
];
|
|
1554
1835
|
case 3:
|
|
1836
|
+
_iterator = _state.sent()[Symbol.iterator]();
|
|
1837
|
+
_state.label = 4;
|
|
1838
|
+
case 4:
|
|
1555
1839
|
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
1556
1840
|
3,
|
|
1557
1841
|
6
|
|
1558
1842
|
];
|
|
1559
|
-
|
|
1560
|
-
return [
|
|
1561
|
-
4,
|
|
1562
|
-
resolveAd(adElement)
|
|
1563
|
-
];
|
|
1564
|
-
case 4:
|
|
1565
|
-
ad = _state.sent();
|
|
1843
|
+
ad = _step.value;
|
|
1566
1844
|
if (ad) ads.push(ad);
|
|
1567
1845
|
_state.label = 5;
|
|
1568
1846
|
case 5:
|
|
1569
1847
|
_iteratorNormalCompletion = true;
|
|
1570
1848
|
return [
|
|
1571
1849
|
3,
|
|
1572
|
-
|
|
1850
|
+
4
|
|
1573
1851
|
];
|
|
1574
1852
|
case 6:
|
|
1575
1853
|
return [
|
|
@@ -1612,20 +1890,19 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1612
1890
|
20,
|
|
1613
1891
|
21
|
|
1614
1892
|
]);
|
|
1615
|
-
|
|
1616
|
-
|
|
1893
|
+
return [
|
|
1894
|
+
4,
|
|
1895
|
+
resolveAll(podElements)
|
|
1896
|
+
];
|
|
1617
1897
|
case 12:
|
|
1898
|
+
_iterator1 = _state.sent()[Symbol.iterator]();
|
|
1899
|
+
_state.label = 13;
|
|
1900
|
+
case 13:
|
|
1618
1901
|
if (!!(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done)) return [
|
|
1619
1902
|
3,
|
|
1620
1903
|
18
|
|
1621
1904
|
];
|
|
1622
|
-
|
|
1623
|
-
return [
|
|
1624
|
-
4,
|
|
1625
|
-
resolveAd(adElement1)
|
|
1626
|
-
];
|
|
1627
|
-
case 13:
|
|
1628
|
-
ad1 = _state.sent();
|
|
1905
|
+
ad1 = _step1.value;
|
|
1629
1906
|
_state.label = 14;
|
|
1630
1907
|
case 14:
|
|
1631
1908
|
if (!(!ad1 && buffet.length > 0)) return [
|
|
@@ -1634,7 +1911,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1634
1911
|
];
|
|
1635
1912
|
return [
|
|
1636
1913
|
4,
|
|
1637
|
-
resolveAd(buffet.shift())
|
|
1914
|
+
resolveAd(buffet.shift()).catch(function() {
|
|
1915
|
+
return null;
|
|
1916
|
+
})
|
|
1638
1917
|
];
|
|
1639
1918
|
case 15:
|
|
1640
1919
|
ad1 = _state.sent();
|
|
@@ -1649,7 +1928,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1649
1928
|
_iteratorNormalCompletion1 = true;
|
|
1650
1929
|
return [
|
|
1651
1930
|
3,
|
|
1652
|
-
|
|
1931
|
+
13
|
|
1653
1932
|
];
|
|
1654
1933
|
case 18:
|
|
1655
1934
|
return [
|
|
@@ -1744,14 +2023,17 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1744
2023
|
var progress = currentTime / currentAd.duration;
|
|
1745
2024
|
if (progress >= 0.25 && !trackingFired.firstQuartile) {
|
|
1746
2025
|
trackingFired.firstQuartile = true;
|
|
2026
|
+
logFunnel("first_quartile");
|
|
1747
2027
|
fireTrackingPixels(currentAd.trackingUrls.firstQuartile);
|
|
1748
2028
|
}
|
|
1749
2029
|
if (progress >= 0.5 && !trackingFired.midpoint) {
|
|
1750
2030
|
trackingFired.midpoint = true;
|
|
2031
|
+
logFunnel("midpoint");
|
|
1751
2032
|
fireTrackingPixels(currentAd.trackingUrls.midpoint);
|
|
1752
2033
|
}
|
|
1753
2034
|
if (progress >= 0.75 && !trackingFired.thirdQuartile) {
|
|
1754
2035
|
trackingFired.thirdQuartile = true;
|
|
2036
|
+
logFunnel("third_quartile");
|
|
1755
2037
|
fireTrackingPixels(currentAd.trackingUrls.thirdQuartile);
|
|
1756
2038
|
}
|
|
1757
2039
|
};
|
|
@@ -1774,6 +2056,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1774
2056
|
if (!trackingFired.impression) {
|
|
1775
2057
|
trackingFired.impression = true;
|
|
1776
2058
|
resolvedAds.add(currentAd);
|
|
2059
|
+
logFunnel("playing", {
|
|
2060
|
+
mutedByAutoplay: forcedMuteByAutoplay,
|
|
2061
|
+
candidateIndex: mediaCandidateIndex
|
|
2062
|
+
});
|
|
2063
|
+
logFunnel("impression_fired", {
|
|
2064
|
+
pixelCount: currentAd.trackingUrls.impression.length
|
|
2065
|
+
});
|
|
2066
|
+
if (currentAd.trackingUrls.impression.length === 0) {
|
|
2067
|
+
console.warn("[HlsAdPlayer] Ad started but VAST contained no <Impression> URLs - GAM will not count it");
|
|
2068
|
+
}
|
|
1777
2069
|
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1778
2070
|
fireTrackingPixels(currentAd.trackingUrls.creativeView);
|
|
1779
2071
|
fireTrackingPixels(currentAd.trackingUrls.verificationNotExecuted, {
|
|
@@ -1796,6 +2088,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1796
2088
|
sampleViewability();
|
|
1797
2089
|
settleViewability();
|
|
1798
2090
|
trackingFired.complete = true;
|
|
2091
|
+
logFunnel("complete");
|
|
1799
2092
|
fireTrackingPixels(currentAd.trackingUrls.complete);
|
|
1800
2093
|
console.log("[HlsAdPlayer] Ad completed");
|
|
1801
2094
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
@@ -1804,16 +2097,41 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1804
2097
|
handleAdComplete();
|
|
1805
2098
|
};
|
|
1806
2099
|
var onError = function onError(e) {
|
|
2100
|
+
var _adVideoElement_error, _adVideoElement_error1;
|
|
1807
2101
|
if (!adPlaying) return;
|
|
1808
2102
|
console.error("[HlsAdPlayer] Ad video error:", e);
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
2103
|
+
var vastErrorCode = toVastMediaErrorCode(adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.error);
|
|
2104
|
+
logFunnel("media_error", {
|
|
2105
|
+
mediaErrorCode: adVideoElement === null || adVideoElement === void 0 ? void 0 : (_adVideoElement_error = adVideoElement.error) === null || _adVideoElement_error === void 0 ? void 0 : _adVideoElement_error.code,
|
|
2106
|
+
errorMessage: adVideoElement === null || adVideoElement === void 0 ? void 0 : (_adVideoElement_error1 = adVideoElement.error) === null || _adVideoElement_error1 === void 0 ? void 0 : _adVideoElement_error1.message,
|
|
2107
|
+
networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
|
|
2108
|
+
readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
|
|
2109
|
+
currentSrc: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.currentSrc,
|
|
2110
|
+
vastErrorCode: vastErrorCode
|
|
2111
|
+
});
|
|
2112
|
+
recoverFromAdFailure(vastErrorCode);
|
|
2113
|
+
};
|
|
2114
|
+
var onMediaDiagnostic = function onMediaDiagnostic(event) {
|
|
2115
|
+
if (!adPlaying || !adVideoElement || trackingFired.impression) return;
|
|
2116
|
+
if (!adVideoElement.currentSrc) return;
|
|
2117
|
+
logFunnel("media_event", {
|
|
2118
|
+
reason: event.type,
|
|
2119
|
+
readyState: adVideoElement.readyState,
|
|
2120
|
+
networkState: adVideoElement.networkState,
|
|
2121
|
+
currentSrc: adVideoElement.currentSrc
|
|
2122
|
+
});
|
|
1814
2123
|
};
|
|
1815
2124
|
var onVolumeChange = function onVolumeChange() {
|
|
1816
2125
|
if (!currentAd || !adVideoElement) return;
|
|
2126
|
+
if (forcedMuteByAutoplay && !adVideoElement.muted) {
|
|
2127
|
+
var userActivation = navigator.userActivation;
|
|
2128
|
+
if (userActivation && !userActivation.isActive) {
|
|
2129
|
+
logFunnel("unexpected_unmute", {
|
|
2130
|
+
paused: adVideoElement.paused
|
|
2131
|
+
});
|
|
2132
|
+
}
|
|
2133
|
+
forcedMuteByAutoplay = false;
|
|
2134
|
+
}
|
|
1817
2135
|
var muted = adVideoElement.muted || adVideoElement.volume === 0;
|
|
1818
2136
|
if (!trackingFired.start) {
|
|
1819
2137
|
trackingFired.lastMuted = muted;
|
|
@@ -1873,6 +2191,22 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1873
2191
|
{
|
|
1874
2192
|
type: "play",
|
|
1875
2193
|
handler: onPlay
|
|
2194
|
+
},
|
|
2195
|
+
{
|
|
2196
|
+
type: "stalled",
|
|
2197
|
+
handler: onMediaDiagnostic
|
|
2198
|
+
},
|
|
2199
|
+
{
|
|
2200
|
+
type: "suspend",
|
|
2201
|
+
handler: onMediaDiagnostic
|
|
2202
|
+
},
|
|
2203
|
+
{
|
|
2204
|
+
type: "abort",
|
|
2205
|
+
handler: onMediaDiagnostic
|
|
2206
|
+
},
|
|
2207
|
+
{
|
|
2208
|
+
type: "emptied",
|
|
2209
|
+
handler: onMediaDiagnostic
|
|
1876
2210
|
}
|
|
1877
2211
|
];
|
|
1878
2212
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -2162,16 +2496,51 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2162
2496
|
function settlePendingPlay() {
|
|
2163
2497
|
pendingPlayPromise = void 0;
|
|
2164
2498
|
}
|
|
2499
|
+
function toVastPlayErrorCode(error) {
|
|
2500
|
+
return (error === null || error === void 0 ? void 0 : error.name) === "NotSupportedError" ? VAST_ERROR_NO_SUPPORTED_MEDIA : VAST_ERROR_MEDIA_DISPLAY;
|
|
2501
|
+
}
|
|
2502
|
+
function failAdPlayback(context, error) {
|
|
2503
|
+
var vastErrorCode = toVastPlayErrorCode(error);
|
|
2504
|
+
console.error("[HlsAdPlayer] Error starting ".concat(context, ":"), error);
|
|
2505
|
+
logFunnel("play_failed", {
|
|
2506
|
+
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
2507
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
2508
|
+
vastErrorCode: vastErrorCode
|
|
2509
|
+
});
|
|
2510
|
+
recoverFromAdFailure(vastErrorCode);
|
|
2511
|
+
}
|
|
2165
2512
|
function startAdPlayback(context) {
|
|
2513
|
+
var isMutedRetry = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
2166
2514
|
if (!adVideoElement) return;
|
|
2515
|
+
var computed = typeof getComputedStyle === "function" && adContainerEl ? getComputedStyle(adContainerEl) : void 0;
|
|
2516
|
+
logFunnel(isMutedRetry ? "muted_retry" : "play_called", {
|
|
2517
|
+
context: context,
|
|
2518
|
+
isConnected: adVideoElement.isConnected,
|
|
2519
|
+
clientWidth: adVideoElement.clientWidth,
|
|
2520
|
+
clientHeight: adVideoElement.clientHeight,
|
|
2521
|
+
containerDisplay: computed === null || computed === void 0 ? void 0 : computed.display,
|
|
2522
|
+
containerVisibility: computed === null || computed === void 0 ? void 0 : computed.visibility
|
|
2523
|
+
});
|
|
2167
2524
|
var playPromise = adVideoElement.play();
|
|
2168
2525
|
pendingPlayPromise = playPromise;
|
|
2169
2526
|
playPromise.catch(function(error) {
|
|
2170
2527
|
if (pendingPlayPromise !== playPromise) {
|
|
2171
2528
|
return;
|
|
2172
2529
|
}
|
|
2173
|
-
|
|
2174
|
-
|
|
2530
|
+
logFunnel("play_rejected", {
|
|
2531
|
+
context: context,
|
|
2532
|
+
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
2533
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
2534
|
+
});
|
|
2535
|
+
if (!isMutedRetry && (error === null || error === void 0 ? void 0 : error.name) === "NotAllowedError" && adVideoElement && !adVideoElement.muted) {
|
|
2536
|
+
console.warn("[HlsAdPlayer] Unmuted ".concat(context, " blocked by autoplay policy - retrying muted"));
|
|
2537
|
+
originalMutedState = true;
|
|
2538
|
+
forcedMuteByAutoplay = true;
|
|
2539
|
+
adVideoElement.muted = true;
|
|
2540
|
+
startAdPlayback(context, true);
|
|
2541
|
+
return;
|
|
2542
|
+
}
|
|
2543
|
+
failAdPlayback(context, error);
|
|
2175
2544
|
}).finally(function() {
|
|
2176
2545
|
if (pendingPlayPromise === playPromise) {
|
|
2177
2546
|
pendingPlayPromise = void 0;
|
|
@@ -2210,17 +2579,109 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2210
2579
|
adVideoElement.volume = Math.max(0, Math.min(1, originalVolume));
|
|
2211
2580
|
adVideoElement.muted = originalMutedState;
|
|
2212
2581
|
}
|
|
2582
|
+
function clearMediaStartTimer() {
|
|
2583
|
+
if (mediaStartTimerId !== void 0) {
|
|
2584
|
+
clearTimeout(mediaStartTimerId);
|
|
2585
|
+
mediaStartTimerId = void 0;
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
function startMediaStartTimer() {
|
|
2589
|
+
clearMediaStartTimer();
|
|
2590
|
+
if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
|
|
2591
|
+
var startedAt = Date.now();
|
|
2592
|
+
mediaStartTimerId = setTimeout(function() {
|
|
2593
|
+
mediaStartTimerId = void 0;
|
|
2594
|
+
if (!adPlaying || trackingFired.impression) return;
|
|
2595
|
+
console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(MEDIA_START_TIMEOUT_MS, "ms"));
|
|
2596
|
+
logFunnel("play_resolved_but_never_started", {
|
|
2597
|
+
timeoutMs: MEDIA_START_TIMEOUT_MS,
|
|
2598
|
+
elapsedMs: Date.now() - startedAt,
|
|
2599
|
+
readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
|
|
2600
|
+
networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
|
|
2601
|
+
currentSrc: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.currentSrc,
|
|
2602
|
+
paused: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.paused,
|
|
2603
|
+
vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
|
|
2604
|
+
});
|
|
2605
|
+
recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
|
|
2606
|
+
}, MEDIA_START_TIMEOUT_MS);
|
|
2607
|
+
}
|
|
2608
|
+
function resetVideoElementForNextSource() {
|
|
2609
|
+
clearStallWatchdog();
|
|
2610
|
+
if (requiresMediaPipelineResetAfterAds()) {
|
|
2611
|
+
recreateAdVideoElement();
|
|
2612
|
+
setupAdEventListeners();
|
|
2613
|
+
} else {
|
|
2614
|
+
prepareVideoElementForNewSource();
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
function tryNextMediaCandidate() {
|
|
2618
|
+
if (!currentAd || trackingFired.impression) return false;
|
|
2619
|
+
if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
|
|
2620
|
+
var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
|
|
2621
|
+
mediaCandidateIndex++;
|
|
2622
|
+
var next = mediaCandidates[mediaCandidateIndex];
|
|
2623
|
+
if (!next) return false;
|
|
2624
|
+
logFunnel("media_fallback", {
|
|
2625
|
+
failedUrl: failedUrl,
|
|
2626
|
+
nextUrl: next.url,
|
|
2627
|
+
nextType: next.type,
|
|
2628
|
+
candidateIndex: mediaCandidateIndex,
|
|
2629
|
+
candidateCount: mediaCandidates.length
|
|
2630
|
+
});
|
|
2631
|
+
resetVideoElementForNextSource();
|
|
2632
|
+
try {
|
|
2633
|
+
loadMediaCandidate(next);
|
|
2634
|
+
return true;
|
|
2635
|
+
} catch (error) {
|
|
2636
|
+
console.error("[HlsAdPlayer] Failed to load fallback media file:", error);
|
|
2637
|
+
return tryNextMediaCandidate();
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
function recoverFromAdFailure(vastErrorCode) {
|
|
2641
|
+
clearMediaStartTimer();
|
|
2642
|
+
if (tryNextMediaCandidate()) return;
|
|
2643
|
+
reportCurrentAdError(vastErrorCode);
|
|
2644
|
+
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) return;
|
|
2645
|
+
handleAdError();
|
|
2646
|
+
}
|
|
2213
2647
|
function loadCurrentAdMedia() {
|
|
2214
2648
|
if (!adVideoElement || !currentAd) {
|
|
2215
2649
|
throw new Error("No ad video element or ad to load");
|
|
2216
2650
|
}
|
|
2217
|
-
|
|
2651
|
+
mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
|
|
2652
|
+
mediaCandidateIndex = 0;
|
|
2653
|
+
var mediaFile = mediaCandidates[0];
|
|
2218
2654
|
if (!mediaFile) {
|
|
2219
|
-
|
|
2655
|
+
logFunnel("media_unsupported", {
|
|
2656
|
+
vastErrorCode: VAST_ERROR_NO_SUPPORTED_MEDIA,
|
|
2657
|
+
candidates: currentAd.mediaFiles.length
|
|
2658
|
+
});
|
|
2659
|
+
reportCurrentAdError(VAST_ERROR_NO_SUPPORTED_MEDIA);
|
|
2660
|
+
throw new Error("No media file this browser can play");
|
|
2661
|
+
}
|
|
2662
|
+
try {
|
|
2663
|
+
loadMediaCandidate(mediaFile);
|
|
2664
|
+
} catch (error) {
|
|
2665
|
+
if (tryNextMediaCandidate()) return;
|
|
2666
|
+
reportCurrentAdError(VAST_ERROR_NO_SUPPORTED_MEDIA);
|
|
2667
|
+
throw error;
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
function loadMediaCandidate(mediaFile) {
|
|
2671
|
+
if (!adVideoElement || !currentAd) {
|
|
2672
|
+
throw new Error("No ad video element or ad to load");
|
|
2220
2673
|
}
|
|
2221
2674
|
currentAdMediaFile = mediaFile;
|
|
2222
2675
|
var isHlsAd = isHlsMediaFile(mediaFile);
|
|
2676
|
+
logFunnel("media_selected", {
|
|
2677
|
+
width: mediaFile.width,
|
|
2678
|
+
height: mediaFile.height,
|
|
2679
|
+
bitrate: mediaFile.bitrate,
|
|
2680
|
+
candidateIndex: mediaCandidateIndex,
|
|
2681
|
+
candidates: mediaCandidates.length
|
|
2682
|
+
});
|
|
2223
2683
|
console.log("[HlsAdPlayer] Loading ".concat(isHlsAd ? "HLS" : "progressive", " ad (pod ").concat(podIndex + 1, "/").concat(podAds.length || 1, ") from: ").concat(mediaFile.url));
|
|
2684
|
+
startMediaStartTimer();
|
|
2224
2685
|
if (isHlsAd && import_hls.default.isSupported()) {
|
|
2225
2686
|
if (adHls) {
|
|
2226
2687
|
adHls.destroy();
|
|
@@ -2229,6 +2690,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2229
2690
|
enableWorker: true,
|
|
2230
2691
|
lowLatencyMode: false
|
|
2231
2692
|
});
|
|
2693
|
+
logFunnel("media_load", {
|
|
2694
|
+
pipeline: "hls.js"
|
|
2695
|
+
});
|
|
2232
2696
|
adHls.loadSource(mediaFile.url);
|
|
2233
2697
|
adHls.attachMedia(adVideoElement);
|
|
2234
2698
|
adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
|
|
@@ -2238,10 +2702,24 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2238
2702
|
adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
|
|
2239
2703
|
console.error("[HlsAdPlayer] HLS error:", data);
|
|
2240
2704
|
if (data.fatal) {
|
|
2241
|
-
|
|
2705
|
+
var _data_response, _data_response1, _data_frag;
|
|
2706
|
+
var vastErrorCode = data.type === import_hls.default.ErrorTypes.NETWORK_ERROR ? 401 : VAST_ERROR_MEDIA_DISPLAY;
|
|
2707
|
+
logFunnel("hls_fatal", {
|
|
2708
|
+
reason: data.details,
|
|
2709
|
+
errorName: data.type,
|
|
2710
|
+
errorMessage: data.details,
|
|
2711
|
+
responseCode: (_data_response = data.response) === null || _data_response === void 0 ? void 0 : _data_response.code,
|
|
2712
|
+
responseText: (_data_response1 = data.response) === null || _data_response1 === void 0 ? void 0 : _data_response1.text,
|
|
2713
|
+
fragUrl: (_data_frag = data.frag) === null || _data_frag === void 0 ? void 0 : _data_frag.url,
|
|
2714
|
+
vastErrorCode: vastErrorCode
|
|
2715
|
+
});
|
|
2716
|
+
recoverFromAdFailure(vastErrorCode);
|
|
2242
2717
|
}
|
|
2243
2718
|
});
|
|
2244
2719
|
} else if (isHlsAd && adVideoElement.canPlayType("application/vnd.apple.mpegurl")) {
|
|
2720
|
+
logFunnel("media_load", {
|
|
2721
|
+
pipeline: "native-hls"
|
|
2722
|
+
});
|
|
2245
2723
|
adVideoElement.src = mediaFile.url;
|
|
2246
2724
|
startAdPlayback("native HLS ad playback");
|
|
2247
2725
|
} else if (!isHlsAd && isProgressiveMediaFile(mediaFile)) {
|
|
@@ -2249,45 +2727,47 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2249
2727
|
adHls.destroy();
|
|
2250
2728
|
adHls = void 0;
|
|
2251
2729
|
}
|
|
2730
|
+
logFunnel("media_load", {
|
|
2731
|
+
pipeline: "progressive"
|
|
2732
|
+
});
|
|
2252
2733
|
adVideoElement.src = mediaFile.url;
|
|
2253
2734
|
adVideoElement.load();
|
|
2254
2735
|
startAdPlayback("progressive ad playback");
|
|
2255
2736
|
} else {
|
|
2737
|
+
clearMediaStartTimer();
|
|
2738
|
+
logFunnel("media_unsupported", {
|
|
2739
|
+
vastErrorCode: VAST_ERROR_NO_SUPPORTED_MEDIA
|
|
2740
|
+
});
|
|
2256
2741
|
throw new Error("Unsupported ad media file type: ".concat(mediaFile.type));
|
|
2257
2742
|
}
|
|
2258
2743
|
}
|
|
2259
2744
|
function advanceToNextPodAd() {
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
index: podIndex,
|
|
2282
|
-
total: podAds.length
|
|
2283
|
-
});
|
|
2284
|
-
return true;
|
|
2285
|
-
} catch (error) {
|
|
2286
|
-
console.error("[HlsAdPlayer] Failed to load next pod ad:", error);
|
|
2287
|
-
return false;
|
|
2745
|
+
clearMediaStartTimer();
|
|
2746
|
+
while(podIndex < podAds.length - 1){
|
|
2747
|
+
settleViewability();
|
|
2748
|
+
podIndex++;
|
|
2749
|
+
currentAd = podAds[podIndex];
|
|
2750
|
+
currentAdMediaFile = void 0;
|
|
2751
|
+
resetAdTracking();
|
|
2752
|
+
if (currentAd) {
|
|
2753
|
+
console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
|
|
2754
|
+
}
|
|
2755
|
+
resetVideoElementForNextSource();
|
|
2756
|
+
try {
|
|
2757
|
+
loadCurrentAdMedia();
|
|
2758
|
+
emit("pod_ad_started", {
|
|
2759
|
+
index: podIndex,
|
|
2760
|
+
total: podAds.length
|
|
2761
|
+
});
|
|
2762
|
+
return true;
|
|
2763
|
+
} catch (error) {
|
|
2764
|
+
console.error("[HlsAdPlayer] Failed to load next pod ad:", error);
|
|
2765
|
+
}
|
|
2288
2766
|
}
|
|
2767
|
+
return false;
|
|
2289
2768
|
}
|
|
2290
2769
|
function clearStallWatchdog() {
|
|
2770
|
+
clearMediaStartTimer();
|
|
2291
2771
|
if (stallWatchdogId != null) {
|
|
2292
2772
|
clearInterval(stallWatchdogId);
|
|
2293
2773
|
stallWatchdogId = void 0;
|
|
@@ -2303,11 +2783,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2303
2783
|
function handleAdStall() {
|
|
2304
2784
|
console.warn("[HlsAdPlayer] Ad playback stalled (no progress) - recovering to avoid a blank frame");
|
|
2305
2785
|
clearStallWatchdog();
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
handleAdError();
|
|
2786
|
+
logFunnel("stall", {
|
|
2787
|
+
vastErrorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
2788
|
+
});
|
|
2789
|
+
recoverFromAdFailure(VAST_ERROR_MEDIA_DISPLAY);
|
|
2311
2790
|
}
|
|
2312
2791
|
function getDecodedVideoFrameCount(video) {
|
|
2313
2792
|
try {
|
|
@@ -2369,11 +2848,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2369
2848
|
function handleVideoDecodeFailure() {
|
|
2370
2849
|
console.warn("[HlsAdPlayer] Ad audio is advancing but no video frames decoded (black screen) - skipping this creative");
|
|
2371
2850
|
clearStallWatchdog();
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
handleAdError();
|
|
2851
|
+
logFunnel("decode_failure", {
|
|
2852
|
+
vastErrorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
2853
|
+
});
|
|
2854
|
+
recoverFromAdFailure(VAST_ERROR_MEDIA_DISPLAY);
|
|
2377
2855
|
}
|
|
2378
2856
|
function startStallWatchdog() {
|
|
2379
2857
|
clearStallWatchdog();
|
|
@@ -2497,6 +2975,15 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2497
2975
|
Promise.reject(new Error("Ad already playing"))
|
|
2498
2976
|
];
|
|
2499
2977
|
}
|
|
2978
|
+
if (destroyed) {
|
|
2979
|
+
return [
|
|
2980
|
+
2,
|
|
2981
|
+
Promise.reject(new Error("Ad player destroyed"))
|
|
2982
|
+
];
|
|
2983
|
+
}
|
|
2984
|
+
currentVastTagUrl = vastTagUrl;
|
|
2985
|
+
pendingRequestAbortReason = void 0;
|
|
2986
|
+
logFunnel("request_sent");
|
|
2500
2987
|
_state.label = 1;
|
|
2501
2988
|
case 1:
|
|
2502
2989
|
_state.trys.push([
|
|
@@ -2531,8 +3018,18 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2531
3018
|
ads = _state.sent();
|
|
2532
3019
|
_state.label = 4;
|
|
2533
3020
|
case 4:
|
|
3021
|
+
if (destroyed) {
|
|
3022
|
+
return [
|
|
3023
|
+
2,
|
|
3024
|
+
Promise.reject(new Error("Ad player destroyed"))
|
|
3025
|
+
];
|
|
3026
|
+
}
|
|
3027
|
+
if (!ads.length && pendingRequestAbortReason) {
|
|
3028
|
+
throw new Error(pendingRequestAbortReason);
|
|
3029
|
+
}
|
|
2534
3030
|
if (!ads.length) {
|
|
2535
3031
|
console.warn("[HlsAdPlayer] No ads available from VAST response");
|
|
3032
|
+
logFunnel("no_fill");
|
|
2536
3033
|
emit("ad_error");
|
|
2537
3034
|
return [
|
|
2538
3035
|
2,
|
|
@@ -2543,6 +3040,23 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2543
3040
|
podIndex = 0;
|
|
2544
3041
|
currentAd = ads[0];
|
|
2545
3042
|
currentAdMediaFile = void 0;
|
|
3043
|
+
logFunnel("vast_received", {
|
|
3044
|
+
adCount: ads.length,
|
|
3045
|
+
durations: ads.map(function(ad) {
|
|
3046
|
+
return ad.duration;
|
|
3047
|
+
}),
|
|
3048
|
+
impressionUrls: ads.map(function(ad) {
|
|
3049
|
+
return ad.trackingUrls.impression.length;
|
|
3050
|
+
})
|
|
3051
|
+
});
|
|
3052
|
+
ads.forEach(function(ad, index) {
|
|
3053
|
+
if (ad.trackingUrls.impression.length === 0) {
|
|
3054
|
+
logFunnel("vast_missing_impression", {
|
|
3055
|
+
adIndex: index,
|
|
3056
|
+
missingAdId: ad.id
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
3059
|
+
});
|
|
2546
3060
|
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"));
|
|
2547
3061
|
return [
|
|
2548
3062
|
2,
|
|
@@ -2551,6 +3065,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2551
3065
|
case 5:
|
|
2552
3066
|
error = _state.sent();
|
|
2553
3067
|
console.error("[HlsAdPlayer] Error requesting ads:", error);
|
|
3068
|
+
logFunnel("request_failed", {
|
|
3069
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
3070
|
+
});
|
|
2554
3071
|
emit("ad_error");
|
|
2555
3072
|
return [
|
|
2556
3073
|
2,
|
|
@@ -2606,13 +3123,22 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2606
3123
|
adContainerEl.style.pointerEvents = "auto";
|
|
2607
3124
|
}
|
|
2608
3125
|
emit("content_pause");
|
|
2609
|
-
|
|
3126
|
+
try {
|
|
3127
|
+
loadCurrentAdMedia();
|
|
3128
|
+
} catch (loadError) {
|
|
3129
|
+
if (!(podIndex < podAds.length - 1 && advanceToNextPodAd())) {
|
|
3130
|
+
throw loadError;
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
2610
3133
|
return [
|
|
2611
3134
|
2,
|
|
2612
3135
|
Promise.resolve()
|
|
2613
3136
|
];
|
|
2614
3137
|
} catch (error) {
|
|
2615
3138
|
console.error("[HlsAdPlayer] Error playing ad:", error);
|
|
3139
|
+
logFunnel("play_failed", {
|
|
3140
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
3141
|
+
});
|
|
2616
3142
|
handleAdError();
|
|
2617
3143
|
return [
|
|
2618
3144
|
2,
|
|
@@ -2654,6 +3180,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2654
3180
|
var previousMutedState;
|
|
2655
3181
|
return _ts_generator(this, function(_state) {
|
|
2656
3182
|
console.log("[HlsAdPlayer] Stopping ad");
|
|
3183
|
+
if (adPlaying && currentAd && !trackingFired.impression) {
|
|
3184
|
+
logFunnel("stopped_before_start");
|
|
3185
|
+
}
|
|
2657
3186
|
settleViewability();
|
|
2658
3187
|
fireNotUsedForUnplayedAds();
|
|
2659
3188
|
clearStallWatchdog();
|
|
@@ -2686,15 +3215,18 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2686
3215
|
},
|
|
2687
3216
|
destroy: function destroy() {
|
|
2688
3217
|
console.log("[HlsAdPlayer] Destroying");
|
|
3218
|
+
if (adPlaying && currentAd && !trackingFired.impression) {
|
|
3219
|
+
logFunnel("stopped_before_start");
|
|
3220
|
+
}
|
|
2689
3221
|
settleViewability();
|
|
2690
3222
|
fireNotUsedForUnplayedAds();
|
|
2691
3223
|
destroyed = true;
|
|
2692
|
-
|
|
3224
|
+
pendingRequestAbortReason = "Ad player destroyed";
|
|
2693
3225
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2694
3226
|
try {
|
|
2695
|
-
for(var _iterator =
|
|
2696
|
-
var
|
|
2697
|
-
|
|
3227
|
+
for(var _iterator = Array.from(pendingVastRequests)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3228
|
+
var controller = _step.value;
|
|
3229
|
+
controller.abort();
|
|
2698
3230
|
}
|
|
2699
3231
|
} catch (err) {
|
|
2700
3232
|
_didIteratorError = true;
|
|
@@ -2710,6 +3242,28 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2710
3242
|
}
|
|
2711
3243
|
}
|
|
2712
3244
|
}
|
|
3245
|
+
pendingVastRequests.clear();
|
|
3246
|
+
clearStallWatchdog();
|
|
3247
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
3248
|
+
try {
|
|
3249
|
+
for(var _iterator1 = pendingTimeouts[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
3250
|
+
var timeoutId = _step1.value;
|
|
3251
|
+
clearTimeout(timeoutId);
|
|
3252
|
+
}
|
|
3253
|
+
} catch (err) {
|
|
3254
|
+
_didIteratorError1 = true;
|
|
3255
|
+
_iteratorError1 = err;
|
|
3256
|
+
} finally{
|
|
3257
|
+
try {
|
|
3258
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
3259
|
+
_iterator1.return();
|
|
3260
|
+
}
|
|
3261
|
+
} finally{
|
|
3262
|
+
if (_didIteratorError1) {
|
|
3263
|
+
throw _iteratorError1;
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
}
|
|
2713
3267
|
pendingTimeouts = [];
|
|
2714
3268
|
adPlaying = false;
|
|
2715
3269
|
setAdPlayingFlag(false);
|
|
@@ -2729,6 +3283,35 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2729
3283
|
isAdPlaying: function isAdPlaying() {
|
|
2730
3284
|
return adPlaying;
|
|
2731
3285
|
},
|
|
3286
|
+
setFunnelContext: function setFunnelContext(context) {
|
|
3287
|
+
funnelContext = _object_spread({}, context);
|
|
3288
|
+
},
|
|
3289
|
+
abortPendingRequest: function abortPendingRequest() {
|
|
3290
|
+
var reason = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "VAST request aborted (timeout)";
|
|
3291
|
+
if (pendingVastRequests.size === 0) return;
|
|
3292
|
+
pendingRequestAbortReason = reason;
|
|
3293
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3294
|
+
try {
|
|
3295
|
+
for(var _iterator = Array.from(pendingVastRequests)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3296
|
+
var controller = _step.value;
|
|
3297
|
+
controller.abort();
|
|
3298
|
+
}
|
|
3299
|
+
} catch (err) {
|
|
3300
|
+
_didIteratorError = true;
|
|
3301
|
+
_iteratorError = err;
|
|
3302
|
+
} finally{
|
|
3303
|
+
try {
|
|
3304
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3305
|
+
_iterator.return();
|
|
3306
|
+
}
|
|
3307
|
+
} finally{
|
|
3308
|
+
if (_didIteratorError) {
|
|
3309
|
+
throw _iteratorError;
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3313
|
+
pendingVastRequests.clear();
|
|
3314
|
+
},
|
|
2732
3315
|
resize: function resize(width, height) {
|
|
2733
3316
|
console.log("[HlsAdPlayer] Resizing to ".concat(width, "x").concat(height));
|
|
2734
3317
|
if (adContainerEl) {
|
|
@@ -2764,6 +3347,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2764
3347
|
if (adVideoElement && adPlaying) {
|
|
2765
3348
|
var clamped = Math.max(0, Math.min(1, volume));
|
|
2766
3349
|
adVideoElement.volume = clamped;
|
|
3350
|
+
var userActivation = navigator.userActivation;
|
|
3351
|
+
if (clamped > 0 && forcedMuteByAutoplay && userActivation && !userActivation.isActive) {
|
|
3352
|
+
logFunnel("unmute_blocked_without_gesture", {
|
|
3353
|
+
requestedVolume: clamped
|
|
3354
|
+
});
|
|
3355
|
+
return;
|
|
3356
|
+
}
|
|
2767
3357
|
adVideoElement.muted = clamped === 0;
|
|
2768
3358
|
}
|
|
2769
3359
|
},
|
|
@@ -6827,7 +7417,7 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
6827
7417
|
{
|
|
6828
7418
|
key: "adFitsRemainingBudget",
|
|
6829
7419
|
value: function adFitsRemainingBudget(durationMs) {
|
|
6830
|
-
if (durationMs <= 0) {
|
|
7420
|
+
if (durationMs <= 0 || this.expectedAdBreakDurationMs == null) {
|
|
6831
7421
|
return true;
|
|
6832
7422
|
}
|
|
6833
7423
|
return durationMs <= this.getDurationBudgetRemainingMs();
|
|
@@ -6886,6 +7476,11 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
6886
7476
|
value: function markAdStarted() {
|
|
6887
7477
|
this.currentAdIndex++;
|
|
6888
7478
|
this.totalAdsInBreak = this.currentAdIndex;
|
|
7479
|
+
}
|
|
7480
|
+
},
|
|
7481
|
+
{
|
|
7482
|
+
key: "noteAdRequestSent",
|
|
7483
|
+
value: function noteAdRequestSent() {
|
|
6889
7484
|
this.totalAdRequestsInBreak++;
|
|
6890
7485
|
this.lastAdRequestTime = Date.now();
|
|
6891
7486
|
}
|
|
@@ -6937,6 +7532,9 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
6937
7532
|
if (message.includes("timeout")) {
|
|
6938
7533
|
return true;
|
|
6939
7534
|
}
|
|
7535
|
+
if (message.includes("ad player destroyed") || message.includes("aborted")) {
|
|
7536
|
+
return true;
|
|
7537
|
+
}
|
|
6940
7538
|
if (message.includes("rate limit") || message.includes("too many requests")) {
|
|
6941
7539
|
return true;
|
|
6942
7540
|
}
|
|
@@ -8070,6 +8668,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8070
8668
|
this.adDetectSentForCurrentBreak = false;
|
|
8071
8669
|
this.continuousFetchingActive = false;
|
|
8072
8670
|
this.continuousFetchLoopRunning = false;
|
|
8671
|
+
this.breakFunnel = {};
|
|
8672
|
+
this.controllerCallInFlight = false;
|
|
8673
|
+
this.playbackStartedForCurrentRequest = false;
|
|
8674
|
+
this.opportunityEpoch = -1;
|
|
8073
8675
|
this.adRequestQueue = [];
|
|
8074
8676
|
this.adPodQueue = [];
|
|
8075
8677
|
this.maxPlaceholderDurationMs = 5e3;
|
|
@@ -8122,12 +8724,35 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8122
8724
|
adPlayer.on("ad_interaction", function(event) {
|
|
8123
8725
|
if (event) _this.host.onAdInteraction(event);
|
|
8124
8726
|
});
|
|
8125
|
-
adPlayer.on("
|
|
8126
|
-
|
|
8727
|
+
adPlayer.on("ad_funnel", function(payload) {
|
|
8728
|
+
if (!(payload === null || payload === void 0 ? void 0 : payload.stage)) return;
|
|
8729
|
+
_this.countFunnelStage(payload.stage);
|
|
8730
|
+
if (payload.reason) {
|
|
8731
|
+
_this.countFunnelStage("".concat(payload.stage, ":").concat(payload.reason));
|
|
8732
|
+
}
|
|
8733
|
+
if (payload.stage === "impression_fired" && payload.pixelCount != null) {
|
|
8734
|
+
_this.countFunnelStage("impression_urls", payload.pixelCount);
|
|
8735
|
+
}
|
|
8736
|
+
if (payload.visibilityState === "hidden") {
|
|
8737
|
+
_this.countFunnelStage("while_hidden");
|
|
8738
|
+
}
|
|
8739
|
+
});
|
|
8740
|
+
adPlayer.on("ad_impression", function() {
|
|
8741
|
+
_this.timing.consecutiveFailures = 0;
|
|
8742
|
+
if (!_this.playbackStartedForCurrentRequest) {
|
|
8743
|
+
_this.playbackStartedForCurrentRequest = true;
|
|
8744
|
+
_this.timing.markAdStarted();
|
|
8745
|
+
}
|
|
8746
|
+
sendAdImpressionTracking(_this.host.config.licenseKey, _object_spread_props(_object_spread({
|
|
8127
8747
|
source: "hls",
|
|
8128
|
-
adIndex: _this.timing.currentAdIndex
|
|
8748
|
+
adIndex: _this.timing.currentAdIndex
|
|
8749
|
+
}, _this.currentVastUrl ? {
|
|
8750
|
+
adUrl: _this.currentVastUrl
|
|
8751
|
+
} : {}), {
|
|
8129
8752
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
8130
|
-
}, _this.analyticsContext).catch(function() {});
|
|
8753
|
+
}), _this.analyticsContext).catch(function() {});
|
|
8754
|
+
});
|
|
8755
|
+
adPlayer.on("all_ads_completed", function() {
|
|
8131
8756
|
_this.timing.recordPlayedAdDuration(_this.host.getAdPlayer());
|
|
8132
8757
|
var remaining = _this.timing.getRemainingAdMs();
|
|
8133
8758
|
_this.timing.consecutiveFailures = 0;
|
|
@@ -8161,6 +8786,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8161
8786
|
}
|
|
8162
8787
|
}
|
|
8163
8788
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
8789
|
+
if (_this.controllerCallInFlight) {
|
|
8790
|
+
_this.timing.recordGamNoFill();
|
|
8791
|
+
return;
|
|
8792
|
+
}
|
|
8164
8793
|
_this.handleAdFailure();
|
|
8165
8794
|
});
|
|
8166
8795
|
adPlayer.on("content_pause", function() {
|
|
@@ -8185,11 +8814,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8185
8814
|
}
|
|
8186
8815
|
});
|
|
8187
8816
|
adPlayer.on("content_resume", function() {
|
|
8188
|
-
sendAdImpressionTracking(_this.host.config.licenseKey, {
|
|
8189
|
-
source: "hls",
|
|
8190
|
-
adIndex: _this.timing.currentAdIndex,
|
|
8191
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
8192
|
-
}, _this.analyticsContext).catch(function() {});
|
|
8193
8817
|
if (!_this.host.video.muted) {
|
|
8194
8818
|
_this.host.video.muted = true;
|
|
8195
8819
|
if (_this.debug) {
|
|
@@ -8237,6 +8861,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8237
8861
|
}
|
|
8238
8862
|
var preservedMutedState = adPlayer.getOriginalMutedState();
|
|
8239
8863
|
var preservedVolumeState = adPlayer.getOriginalVolume();
|
|
8864
|
+
this.playbackStartedForCurrentRequest = false;
|
|
8240
8865
|
if (adPlayer) {
|
|
8241
8866
|
try {
|
|
8242
8867
|
adPlayer.destroy();
|
|
@@ -8326,9 +8951,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8326
8951
|
if (this.timing.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
|
|
8327
8952
|
this.timing.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
8328
8953
|
}
|
|
8954
|
+
this.noteOpportunity("scte35", this.cueManager.activeScte35BreakKey);
|
|
8329
8955
|
return [
|
|
8330
8956
|
4,
|
|
8331
|
-
this.startOptimizedPod(baseVastUrl, adBreakDurationMs
|
|
8957
|
+
this.startOptimizedPod(baseVastUrl, adBreakDurationMs)
|
|
8332
8958
|
];
|
|
8333
8959
|
case 1:
|
|
8334
8960
|
podPlayed = _state.sent();
|
|
@@ -8362,7 +8988,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8362
8988
|
value: // ───────────────────────────────────────────────────────────────
|
|
8363
8989
|
// Optimized pod (single multi-ad request)
|
|
8364
8990
|
// ───────────────────────────────────────────────────────────────
|
|
8365
|
-
function startOptimizedPod(baseVastUrl, breakDurationMs
|
|
8991
|
+
function startOptimizedPod(baseVastUrl, breakDurationMs) {
|
|
8366
8992
|
return _async_to_generator(function() {
|
|
8367
8993
|
var podUrl, adPlayer, requestToken, _ref, _adPlayer_getPodAdCount, podCount, error;
|
|
8368
8994
|
return _ts_generator(this, function(_state) {
|
|
@@ -8385,7 +9011,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8385
9011
|
adPlayer = this.host.getAdPlayer();
|
|
8386
9012
|
requestToken = ++this.timing.adRequestTokenCounter;
|
|
8387
9013
|
this.timing.activeAdRequestToken = requestToken;
|
|
8388
|
-
this.
|
|
9014
|
+
this.currentVastUrl = podUrl;
|
|
8389
9015
|
_state.label = 1;
|
|
8390
9016
|
case 1:
|
|
8391
9017
|
_state.trys.push([
|
|
@@ -8400,10 +9026,14 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8400
9026
|
];
|
|
8401
9027
|
case 2:
|
|
8402
9028
|
_state.sent();
|
|
8403
|
-
this.timing.
|
|
9029
|
+
this.timing.startAdRequestWatchdog(requestToken);
|
|
9030
|
+
this.timing.noteAdRequestSent();
|
|
9031
|
+
this.beginFunnelRequest(adPlayer, requestToken);
|
|
8404
9032
|
return [
|
|
8405
9033
|
4,
|
|
8406
|
-
|
|
9034
|
+
this.callController(function() {
|
|
9035
|
+
return adPlayer.requestAds(podUrl);
|
|
9036
|
+
})
|
|
8407
9037
|
];
|
|
8408
9038
|
case 3:
|
|
8409
9039
|
_state.sent();
|
|
@@ -8432,16 +9062,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8432
9062
|
this.timing.startAdFailsafeTimer(requestToken);
|
|
8433
9063
|
return [
|
|
8434
9064
|
4,
|
|
8435
|
-
|
|
9065
|
+
this.callController(function() {
|
|
9066
|
+
return adPlayer.play();
|
|
9067
|
+
})
|
|
8436
9068
|
];
|
|
8437
9069
|
case 4:
|
|
8438
9070
|
_state.sent();
|
|
8439
|
-
this.timing.markAdStarted();
|
|
8440
9071
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
8441
9072
|
this.timing.scheduleAdStopAtBreakBoundary();
|
|
8442
9073
|
}
|
|
8443
|
-
adPlayer.setAdVolume(
|
|
8444
|
-
this.timing.consecutiveFailures = 0;
|
|
9074
|
+
adPlayer.setAdVolume(getAdAudioVolume(adPlayer));
|
|
8445
9075
|
this.continuousFetchingActive = true;
|
|
8446
9076
|
this.startContinuousFetching(baseVastUrl);
|
|
8447
9077
|
return [
|
|
@@ -8806,7 +9436,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8806
9436
|
];
|
|
8807
9437
|
case 3:
|
|
8808
9438
|
_state.sent();
|
|
8809
|
-
this.timing.consecutiveFailures = 0;
|
|
8810
9439
|
return [
|
|
8811
9440
|
3,
|
|
8812
9441
|
8
|
|
@@ -8819,6 +9448,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8819
9448
|
3,
|
|
8820
9449
|
6
|
|
8821
9450
|
];
|
|
9451
|
+
this.timing.consecutiveFailures++;
|
|
8822
9452
|
return [
|
|
8823
9453
|
4,
|
|
8824
9454
|
this.tryNextAvailableAdWithRateLimit()
|
|
@@ -8888,13 +9518,159 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8888
9518
|
}
|
|
8889
9519
|
},
|
|
8890
9520
|
{
|
|
8891
|
-
|
|
8892
|
-
value: // ───────────────────────────────────────────────────────────────
|
|
9521
|
+
// ───────────────────────────────────────────────────────────────
|
|
8893
9522
|
// Single ad playback
|
|
8894
9523
|
// ───────────────────────────────────────────────────────────────
|
|
8895
|
-
|
|
9524
|
+
key: "withCurrentPodBudget",
|
|
9525
|
+
value: function withCurrentPodBudget(vastTagUrl) {
|
|
9526
|
+
var remaining = Math.min(this.timing.getWallClockRemainingAdMs(), this.timing.getDurationBudgetRemainingMs());
|
|
9527
|
+
if (!(remaining > 0)) return vastTagUrl;
|
|
9528
|
+
try {
|
|
9529
|
+
var url = new URL(vastTagUrl);
|
|
9530
|
+
if (!url.searchParams.has("pmxd")) return vastTagUrl;
|
|
9531
|
+
var maxMs = Math.round(remaining);
|
|
9532
|
+
url.searchParams.set("pmxd", String(maxMs));
|
|
9533
|
+
var minMs = Number(url.searchParams.get("pmnd"));
|
|
9534
|
+
if (Number.isFinite(minMs) && minMs > maxMs) {
|
|
9535
|
+
url.searchParams.set("pmnd", String(maxMs));
|
|
9536
|
+
}
|
|
9537
|
+
return url.toString();
|
|
9538
|
+
} catch (unused) {
|
|
9539
|
+
return vastTagUrl;
|
|
9540
|
+
}
|
|
9541
|
+
}
|
|
9542
|
+
},
|
|
9543
|
+
{
|
|
9544
|
+
key: "countFunnelStage",
|
|
9545
|
+
value: function countFunnelStage(stage) {
|
|
9546
|
+
var amount = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
9547
|
+
var _this_breakFunnel_stage;
|
|
9548
|
+
this.breakFunnel[stage] = ((_this_breakFunnel_stage = this.breakFunnel[stage]) !== null && _this_breakFunnel_stage !== void 0 ? _this_breakFunnel_stage : 0) + amount;
|
|
9549
|
+
}
|
|
9550
|
+
},
|
|
9551
|
+
{
|
|
9552
|
+
key: "logOrchestratorFunnel",
|
|
9553
|
+
value: function logOrchestratorFunnel(stage) {
|
|
9554
|
+
var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
9555
|
+
this.countFunnelStage(stage);
|
|
9556
|
+
console.log("[AdBreak][FUNNEL] ".concat(stage), _object_spread({
|
|
9557
|
+
breakId: this.timing.adBreakEpoch,
|
|
9558
|
+
requestId: this.currentRequestId,
|
|
9559
|
+
visibilityState: typeof document !== "undefined" ? document.visibilityState : void 0
|
|
9560
|
+
}, extra));
|
|
9561
|
+
}
|
|
9562
|
+
},
|
|
9563
|
+
{
|
|
9564
|
+
key: "noteOpportunity",
|
|
9565
|
+
value: function noteOpportunity(source, breakKey) {
|
|
9566
|
+
if (breakKey && breakKey === this.opportunityBreakKey && this.opportunityEpoch === this.timing.adBreakEpoch) {
|
|
9567
|
+
this.logOrchestratorFunnel("duplicate_break_start", {
|
|
9568
|
+
source: source,
|
|
9569
|
+
breakKey: breakKey
|
|
9570
|
+
});
|
|
9571
|
+
return;
|
|
9572
|
+
}
|
|
9573
|
+
this.opportunityBreakKey = breakKey;
|
|
9574
|
+
this.opportunityEpoch = this.timing.adBreakEpoch;
|
|
9575
|
+
this.logOrchestratorFunnel("opportunity_created", {
|
|
9576
|
+
source: source,
|
|
9577
|
+
breakKey: breakKey,
|
|
9578
|
+
expectedDurationMs: this.timing.expectedAdBreakDurationMs
|
|
9579
|
+
});
|
|
9580
|
+
}
|
|
9581
|
+
},
|
|
9582
|
+
{
|
|
9583
|
+
key: "beginFunnelRequest",
|
|
9584
|
+
value: function beginFunnelRequest(adPlayer, requestToken) {
|
|
9585
|
+
var _adPlayer_setFunnelContext;
|
|
9586
|
+
if (this.controllerCallInFlight) {
|
|
9587
|
+
this.logOrchestratorFunnel("duplicate_request_detected", {
|
|
9588
|
+
newRequestId: requestToken
|
|
9589
|
+
});
|
|
9590
|
+
}
|
|
9591
|
+
this.currentRequestId = requestToken;
|
|
9592
|
+
this.requestStartedAt = Date.now();
|
|
9593
|
+
(_adPlayer_setFunnelContext = adPlayer.setFunnelContext) === null || _adPlayer_setFunnelContext === void 0 ? void 0 : _adPlayer_setFunnelContext.call(adPlayer, {
|
|
9594
|
+
breakId: this.timing.adBreakEpoch,
|
|
9595
|
+
requestId: requestToken
|
|
9596
|
+
});
|
|
9597
|
+
}
|
|
9598
|
+
},
|
|
9599
|
+
{
|
|
9600
|
+
key: "isAdLoadingWithoutPlayback",
|
|
9601
|
+
value: function isAdLoadingWithoutPlayback() {
|
|
9602
|
+
return this.host.getAdPlayer().isAdPlaying() && !this.playbackStartedForCurrentRequest;
|
|
9603
|
+
}
|
|
9604
|
+
},
|
|
9605
|
+
{
|
|
9606
|
+
key: "noteStopBeforeStart",
|
|
9607
|
+
value: function noteStopBeforeStart(reason) {
|
|
9608
|
+
if (!this.isAdLoadingWithoutPlayback()) return;
|
|
9609
|
+
this.logOrchestratorFunnel("ad_stopped_before_start", {
|
|
9610
|
+
reason: reason,
|
|
9611
|
+
elapsedSinceRequestMs: this.requestStartedAt != null ? Date.now() - this.requestStartedAt : void 0
|
|
9612
|
+
});
|
|
9613
|
+
}
|
|
9614
|
+
},
|
|
9615
|
+
{
|
|
9616
|
+
key: "handleRequestWatchdogTimeout",
|
|
9617
|
+
value: function handleRequestWatchdogTimeout() {
|
|
9618
|
+
var adPlayer = this.host.getAdPlayer();
|
|
9619
|
+
if (this.controllerCallInFlight && adPlayer.abortPendingRequest) {
|
|
9620
|
+
this.logOrchestratorFunnel("request_aborted_timeout", {
|
|
9621
|
+
elapsedSinceRequestMs: this.requestStartedAt != null ? Date.now() - this.requestStartedAt : void 0
|
|
9622
|
+
});
|
|
9623
|
+
adPlayer.abortPendingRequest("VAST request aborted after request watchdog timeout");
|
|
9624
|
+
return;
|
|
9625
|
+
}
|
|
9626
|
+
this.handleAdFailure();
|
|
9627
|
+
}
|
|
9628
|
+
},
|
|
9629
|
+
{
|
|
9630
|
+
key: "callController",
|
|
9631
|
+
value: function callController(call) {
|
|
8896
9632
|
return _async_to_generator(function() {
|
|
8897
|
-
|
|
9633
|
+
return _ts_generator(this, function(_state) {
|
|
9634
|
+
switch(_state.label){
|
|
9635
|
+
case 0:
|
|
9636
|
+
this.controllerCallInFlight = true;
|
|
9637
|
+
_state.label = 1;
|
|
9638
|
+
case 1:
|
|
9639
|
+
_state.trys.push([
|
|
9640
|
+
1,
|
|
9641
|
+
,
|
|
9642
|
+
3,
|
|
9643
|
+
4
|
|
9644
|
+
]);
|
|
9645
|
+
return [
|
|
9646
|
+
4,
|
|
9647
|
+
call()
|
|
9648
|
+
];
|
|
9649
|
+
case 2:
|
|
9650
|
+
_state.sent();
|
|
9651
|
+
return [
|
|
9652
|
+
3,
|
|
9653
|
+
4
|
|
9654
|
+
];
|
|
9655
|
+
case 3:
|
|
9656
|
+
this.controllerCallInFlight = false;
|
|
9657
|
+
return [
|
|
9658
|
+
7
|
|
9659
|
+
];
|
|
9660
|
+
case 4:
|
|
9661
|
+
return [
|
|
9662
|
+
2
|
|
9663
|
+
];
|
|
9664
|
+
}
|
|
9665
|
+
});
|
|
9666
|
+
}).call(this);
|
|
9667
|
+
}
|
|
9668
|
+
},
|
|
9669
|
+
{
|
|
9670
|
+
key: "playSingleAd",
|
|
9671
|
+
value: function playSingleAd(vastTagUrl) {
|
|
9672
|
+
return _async_to_generator(function() {
|
|
9673
|
+
var adPlayer, requestToken, ap, requestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, playError, error, errorMessage;
|
|
8898
9674
|
return _ts_generator(this, function(_state) {
|
|
8899
9675
|
switch(_state.label){
|
|
8900
9676
|
case 0:
|
|
@@ -8921,7 +9697,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8921
9697
|
this.recreateAdController();
|
|
8922
9698
|
requestToken = ++this.timing.adRequestTokenCounter;
|
|
8923
9699
|
this.timing.activeAdRequestToken = requestToken;
|
|
8924
|
-
this.timing.startAdRequestWatchdog(requestToken);
|
|
8925
9700
|
_state.label = 1;
|
|
8926
9701
|
case 1:
|
|
8927
9702
|
_state.trys.push([
|
|
@@ -8936,17 +9711,23 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8936
9711
|
];
|
|
8937
9712
|
case 2:
|
|
8938
9713
|
_state.sent();
|
|
8939
|
-
this.timing.
|
|
9714
|
+
this.timing.startAdRequestWatchdog(requestToken);
|
|
9715
|
+
this.timing.noteAdRequestSent();
|
|
8940
9716
|
ap = this.host.getAdPlayer();
|
|
9717
|
+
requestUrl = this.withCurrentPodBudget(vastTagUrl);
|
|
9718
|
+
this.currentVastUrl = requestUrl;
|
|
9719
|
+
this.beginFunnelRequest(ap, requestToken);
|
|
8941
9720
|
return [
|
|
8942
9721
|
4,
|
|
8943
|
-
|
|
9722
|
+
this.callController(function() {
|
|
9723
|
+
return ap.requestAds(requestUrl);
|
|
9724
|
+
})
|
|
8944
9725
|
];
|
|
8945
9726
|
case 3:
|
|
8946
9727
|
_state.sent();
|
|
8947
9728
|
sendAdLoadedTracking(this.host.config.licenseKey, {
|
|
8948
9729
|
source: "hls",
|
|
8949
|
-
vastUrl:
|
|
9730
|
+
vastUrl: requestUrl,
|
|
8950
9731
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
8951
9732
|
}, this.analyticsContext).catch(function() {});
|
|
8952
9733
|
this.timing.clearAdRequestWatchdog();
|
|
@@ -8954,6 +9735,14 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8954
9735
|
2
|
|
8955
9736
|
];
|
|
8956
9737
|
if (!this.timing.ensureLoadedAdFitsBudget(ap)) {
|
|
9738
|
+
;
|
|
9739
|
+
adDurationS = (_ap_getLoadedAdDuration = ap.getLoadedAdDuration) === null || _ap_getLoadedAdDuration === void 0 ? void 0 : _ap_getLoadedAdDuration.call(ap);
|
|
9740
|
+
remainingMs = Math.min(this.timing.getWallClockRemainingAdMs(), this.timing.getDurationBudgetRemainingMs());
|
|
9741
|
+
this.logOrchestratorFunnel("discarded_budget", {
|
|
9742
|
+
vastUrl: requestUrl,
|
|
9743
|
+
adDurationMs: adDurationS != null ? adDurationS * 1e3 : void 0,
|
|
9744
|
+
remainingMs: remainingMs
|
|
9745
|
+
});
|
|
8957
9746
|
this.timing.rejectLoadedAdForDuration(ap);
|
|
8958
9747
|
this.recreateAdController();
|
|
8959
9748
|
throw new Error("ad_duration_exceeds_budget");
|
|
@@ -8969,16 +9758,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8969
9758
|
this.timing.startAdFailsafeTimer(requestToken);
|
|
8970
9759
|
return [
|
|
8971
9760
|
4,
|
|
8972
|
-
|
|
9761
|
+
this.callController(function() {
|
|
9762
|
+
return ap.play();
|
|
9763
|
+
})
|
|
8973
9764
|
];
|
|
8974
9765
|
case 5:
|
|
8975
9766
|
_state.sent();
|
|
8976
|
-
this.timing.markAdStarted();
|
|
8977
9767
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
8978
9768
|
this.timing.scheduleAdStopAtBreakBoundary();
|
|
8979
9769
|
}
|
|
8980
9770
|
ap.setAdVolume(getAdAudioVolume(ap));
|
|
8981
|
-
this.timing.consecutiveFailures = 0;
|
|
8982
9771
|
this.timing.temporaryFailureUrls.delete(vastTagUrl);
|
|
8983
9772
|
return [
|
|
8984
9773
|
3,
|
|
@@ -9142,7 +9931,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9142
9931
|
];
|
|
9143
9932
|
case 5:
|
|
9144
9933
|
_state.sent();
|
|
9145
|
-
this.timing.consecutiveFailures = 0;
|
|
9146
9934
|
return [
|
|
9147
9935
|
3,
|
|
9148
9936
|
10
|
|
@@ -9154,6 +9942,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9154
9942
|
3,
|
|
9155
9943
|
8
|
|
9156
9944
|
];
|
|
9945
|
+
this.timing.consecutiveFailures++;
|
|
9157
9946
|
return [
|
|
9158
9947
|
4,
|
|
9159
9948
|
this.tryNextAvailableAdWithRateLimit()
|
|
@@ -9204,6 +9993,67 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9204
9993
|
// ───────────────────────────────────────────────────────────────
|
|
9205
9994
|
// Ad break completion
|
|
9206
9995
|
// ───────────────────────────────────────────────────────────────
|
|
9996
|
+
key: "logBreakFunnel",
|
|
9997
|
+
value: function logBreakFunnel() {
|
|
9998
|
+
var funnel = this.breakFunnel;
|
|
9999
|
+
this.breakFunnel = {};
|
|
10000
|
+
if (Object.keys(funnel).length === 0) return;
|
|
10001
|
+
var count = function count(stage) {
|
|
10002
|
+
var _funnel_stage;
|
|
10003
|
+
return (_funnel_stage = funnel[stage]) !== null && _funnel_stage !== void 0 ? _funnel_stage : 0;
|
|
10004
|
+
};
|
|
10005
|
+
var breakId = this.opportunityEpoch;
|
|
10006
|
+
if (count("request_sent") > 0 && count("impression_fired") === 0) {
|
|
10007
|
+
console.log("[AdBreak][FUNNEL] break_abandoned_before_start", {
|
|
10008
|
+
breakId: breakId,
|
|
10009
|
+
requests: count("request_sent")
|
|
10010
|
+
});
|
|
10011
|
+
}
|
|
10012
|
+
console.log("[AdBreak][FUNNEL] Break summary", {
|
|
10013
|
+
breakId: breakId,
|
|
10014
|
+
opportunities: count("opportunity_created"),
|
|
10015
|
+
requests: count("request_sent"),
|
|
10016
|
+
duplicates: count("duplicate_request_detected") + count("duplicate_break_start"),
|
|
10017
|
+
filled: count("vast_received"),
|
|
10018
|
+
noFill: count("no_fill"),
|
|
10019
|
+
requestFailed: count("request_failed"),
|
|
10020
|
+
requestAbortedTimeout: count("request_aborted_timeout"),
|
|
10021
|
+
credentialsRetries: count("vast_credentials_retry"),
|
|
10022
|
+
wrapperFailures: count("wrapper_fetch:failure"),
|
|
10023
|
+
noSupportedMedia: count("vast_no_supported_media"),
|
|
10024
|
+
vpaidOnly: count("vast_no_supported_media:vpaid_only"),
|
|
10025
|
+
missingImpression: count("vast_missing_impression"),
|
|
10026
|
+
discardedBudget: count("discarded_budget"),
|
|
10027
|
+
mediaCandidates: count("media_candidate:accepted") + count("media_candidate:rejected"),
|
|
10028
|
+
mediaRejected: count("media_candidate:rejected"),
|
|
10029
|
+
mediaFallbacks: count("media_fallback"),
|
|
10030
|
+
playCalled: count("play_called"),
|
|
10031
|
+
playRejected: count("play_rejected"),
|
|
10032
|
+
mutedRetry: count("muted_retry"),
|
|
10033
|
+
startTimeouts: count("play_resolved_but_never_started"),
|
|
10034
|
+
impressions: count("impression_fired"),
|
|
10035
|
+
impressionUrls: count("impression_urls"),
|
|
10036
|
+
trackingRequests: count("tracking_request_created"),
|
|
10037
|
+
trackingNotLoaded: count("tracking_request_settled:error") + count("tracking_request_settled:timeout"),
|
|
10038
|
+
trackingUnexpandedMacros: count("tracking_url_unexpanded_macro"),
|
|
10039
|
+
trackingInvalidUrls: count("tracking_url_invalid"),
|
|
10040
|
+
vastAdFallbacks: count("vast_ad_fallback"),
|
|
10041
|
+
mediaEvents: count("media_event"),
|
|
10042
|
+
quartile25: count("first_quartile"),
|
|
10043
|
+
quartile50: count("midpoint"),
|
|
10044
|
+
quartile75: count("third_quartile"),
|
|
10045
|
+
complete: count("complete"),
|
|
10046
|
+
stoppedBeforeStart: count("stopped_before_start"),
|
|
10047
|
+
stoppedBeforeStartByBreakEnd: count("ad_stopped_before_start"),
|
|
10048
|
+
unexpectedUnmutes: count("unexpected_unmute"),
|
|
10049
|
+
unmuteBlocked: count("unmute_blocked_without_gesture"),
|
|
10050
|
+
visibilityHidden: count("while_hidden"),
|
|
10051
|
+
playbackFailures: count("play_failed") + count("media_error") + count("hls_fatal") + count("stall") + count("decode_failure") + count("media_unsupported"),
|
|
10052
|
+
stages: funnel
|
|
10053
|
+
});
|
|
10054
|
+
}
|
|
10055
|
+
},
|
|
10056
|
+
{
|
|
9207
10057
|
key: "handleAdPodComplete",
|
|
9208
10058
|
value: function handleAdPodComplete() {
|
|
9209
10059
|
if (this.debug) {
|
|
@@ -9224,6 +10074,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9224
10074
|
this.adPodQueue = [];
|
|
9225
10075
|
this.showAds = false;
|
|
9226
10076
|
this.host.getAdPlayer().stop().catch(function() {});
|
|
10077
|
+
this.logBreakFunnel();
|
|
9227
10078
|
var restoredMuted = this.host.getAdPlayer().getOriginalMutedState();
|
|
9228
10079
|
var restoredVolume = this.host.getAdPlayer().getOriginalVolume();
|
|
9229
10080
|
if (this.host.video.muted !== restoredMuted) {
|
|
@@ -9575,7 +10426,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9575
10426
|
_this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : _this.timing.expectedAdBreakDurationMs);
|
|
9576
10427
|
},
|
|
9577
10428
|
onWatchdogTimeout: function onWatchdogTimeout() {
|
|
9578
|
-
return _this.adBreak.
|
|
10429
|
+
return _this.adBreak.handleRequestWatchdogTimeout();
|
|
9579
10430
|
},
|
|
9580
10431
|
onFailsafeTimeout: function onFailsafeTimeout() {
|
|
9581
10432
|
return _this.adBreak.handleAdFailure();
|
|
@@ -9680,6 +10531,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9680
10531
|
licenseKey: this.config.licenseKey
|
|
9681
10532
|
} : {}, ((_this_hlsEngine = this.hlsEngine) === null || _this_hlsEngine === void 0 ? void 0 : _this_hlsEngine.hls) ? {
|
|
9682
10533
|
mainHlsInstance: this.hlsEngine.hls
|
|
10534
|
+
} : {}, this.config.adMediaStartTimeoutMs != null ? {
|
|
10535
|
+
mediaStartTimeoutMs: this.config.adMediaStartTimeoutMs
|
|
9683
10536
|
} : {}));
|
|
9684
10537
|
}
|
|
9685
10538
|
},
|
|
@@ -10034,6 +10887,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
10034
10887
|
this.timing.clearAdStartTimer();
|
|
10035
10888
|
this.timing.clearAdStopTimer();
|
|
10036
10889
|
if (adPlaying) {
|
|
10890
|
+
this.adBreak.noteStopBeforeStart("scte_end");
|
|
10037
10891
|
this.adPlayer.stop().catch(function() {});
|
|
10038
10892
|
}
|
|
10039
10893
|
this.adBreak.handleAdPodComplete();
|
|
@@ -10073,6 +10927,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
10073
10927
|
console.log("[StormcloudVideoPlayer] Ad break boundary reached (overrun=".concat(overrunMs, "ms) - hard-stopping ads and resuming stream"));
|
|
10074
10928
|
}
|
|
10075
10929
|
if (adPlaying) {
|
|
10930
|
+
this.adBreak.noteStopBeforeStart("break_boundary");
|
|
10076
10931
|
this.adPlayer.stop().catch(function() {});
|
|
10077
10932
|
}
|
|
10078
10933
|
this.adBreak.handleAdPodComplete();
|
|
@@ -10201,6 +11056,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
10201
11056
|
this.adBreak.showAds = true;
|
|
10202
11057
|
this.adBreak.inAdBreak = true;
|
|
10203
11058
|
this.timing.currentAdBreakStartWallClockMs = Date.now();
|
|
11059
|
+
if (durationMs > 0) {
|
|
11060
|
+
this.timing.setAdBreakDurationBoundary(durationMs);
|
|
11061
|
+
}
|
|
11062
|
+
this.adBreak.noteOpportunity("vmap", key);
|
|
10204
11063
|
_state.label = 1;
|
|
10205
11064
|
case 1:
|
|
10206
11065
|
_state.trys.push([
|