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
|
@@ -737,6 +737,7 @@ function parseProgressOffset(offset) {
|
|
|
737
737
|
} : void 0;
|
|
738
738
|
}
|
|
739
739
|
var MAX_VAST_WRAPPER_DEPTH = 5;
|
|
740
|
+
var VAST_REQUEST_TIMEOUT_MS = 5e3;
|
|
740
741
|
var BEACON_TIMEOUT_MS = 3e4;
|
|
741
742
|
var inFlightBeacons = /* @__PURE__ */ new Set();
|
|
742
743
|
var VAST_ERROR_MEDIA_DISPLAY = 405;
|
|
@@ -760,7 +761,7 @@ function toVastMediaErrorCode(error) {
|
|
|
760
761
|
}
|
|
761
762
|
}
|
|
762
763
|
function createHlsAdPlayer(contentVideo, options) {
|
|
763
|
-
var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP;
|
|
764
|
+
var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP, _ref;
|
|
764
765
|
var adPlaying = false;
|
|
765
766
|
var originalMutedState = false;
|
|
766
767
|
var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
|
|
@@ -792,6 +793,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
792
793
|
var sawDecodedVideoFrame = false;
|
|
793
794
|
var videoFrameCallbackHandle;
|
|
794
795
|
var pendingPlayPromise;
|
|
796
|
+
var currentVastTagUrl;
|
|
797
|
+
var funnelContext = {};
|
|
798
|
+
var mediaCandidates = [];
|
|
799
|
+
var mediaCandidateIndex = 0;
|
|
800
|
+
var mediaStartTimerId;
|
|
801
|
+
var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
|
|
802
|
+
var VAST_ERROR_MEDIA_TIMEOUT = 402;
|
|
803
|
+
var pendingVastRequests = /* @__PURE__ */ new Set();
|
|
804
|
+
var pendingRequestAbortReason;
|
|
805
|
+
var forcedMuteByAutoplay = false;
|
|
795
806
|
function createTrackingState() {
|
|
796
807
|
return {
|
|
797
808
|
impression: false,
|
|
@@ -842,6 +853,77 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
842
853
|
}
|
|
843
854
|
}
|
|
844
855
|
}
|
|
856
|
+
var SENSITIVE_URL_PARAMS = /* @__PURE__ */ new Set([
|
|
857
|
+
"ppid",
|
|
858
|
+
"rdid",
|
|
859
|
+
"idtype",
|
|
860
|
+
"is_lat",
|
|
861
|
+
"ifa",
|
|
862
|
+
"idfa",
|
|
863
|
+
"aaid",
|
|
864
|
+
"uid",
|
|
865
|
+
"user_id",
|
|
866
|
+
"userid",
|
|
867
|
+
"device_id",
|
|
868
|
+
"deviceid",
|
|
869
|
+
"ip",
|
|
870
|
+
"ua",
|
|
871
|
+
"gdpr_consent",
|
|
872
|
+
"us_privacy",
|
|
873
|
+
"gpp",
|
|
874
|
+
"addtl_consent",
|
|
875
|
+
"cust_params",
|
|
876
|
+
"email"
|
|
877
|
+
]);
|
|
878
|
+
function redactUrl(url) {
|
|
879
|
+
if (!url) return url;
|
|
880
|
+
try {
|
|
881
|
+
var parsed = new URL(url);
|
|
882
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
883
|
+
try {
|
|
884
|
+
for(var _iterator = Array.from(parsed.searchParams.keys())[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
885
|
+
var key = _step.value;
|
|
886
|
+
if (SENSITIVE_URL_PARAMS.has(key.toLowerCase())) {
|
|
887
|
+
parsed.searchParams.set(key, "REDACTED");
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
} catch (err) {
|
|
891
|
+
_didIteratorError = true;
|
|
892
|
+
_iteratorError = err;
|
|
893
|
+
} finally{
|
|
894
|
+
try {
|
|
895
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
896
|
+
_iterator.return();
|
|
897
|
+
}
|
|
898
|
+
} finally{
|
|
899
|
+
if (_didIteratorError) {
|
|
900
|
+
throw _iteratorError;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
return parsed.toString();
|
|
905
|
+
} catch (unused) {
|
|
906
|
+
return url.split("?")[0];
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
function logFunnel(stage) {
|
|
910
|
+
var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
911
|
+
var payload = _object_spread({
|
|
912
|
+
stage: stage,
|
|
913
|
+
breakId: funnelContext.breakId,
|
|
914
|
+
requestId: funnelContext.requestId,
|
|
915
|
+
visibilityState: typeof document !== "undefined" ? document.visibilityState : void 0,
|
|
916
|
+
adId: currentAd === null || currentAd === void 0 ? void 0 : currentAd.id,
|
|
917
|
+
podIndex: podIndex,
|
|
918
|
+
podSize: podAds.length,
|
|
919
|
+
vastUrl: redactUrl(currentVastTagUrl),
|
|
920
|
+
mediaUrl: currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url,
|
|
921
|
+
mediaType: currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.type,
|
|
922
|
+
muted: adVideoElement ? adVideoElement.muted : void 0
|
|
923
|
+
}, extra);
|
|
924
|
+
console.log("[HlsAdPlayer][FUNNEL] ".concat(stage), payload);
|
|
925
|
+
emit("ad_funnel", payload);
|
|
926
|
+
}
|
|
845
927
|
function buildTrackingMacroContext() {
|
|
846
928
|
var options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
847
929
|
var _options2_ad;
|
|
@@ -881,20 +963,53 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
881
963
|
urls.forEach(function(url) {
|
|
882
964
|
try {
|
|
883
965
|
var trackingUrl = substituteVastTrackingMacros(url, macroContext);
|
|
966
|
+
var trackingHost;
|
|
967
|
+
try {
|
|
968
|
+
trackingHost = new URL(trackingUrl).host;
|
|
969
|
+
} catch (unused) {
|
|
970
|
+
logFunnel("tracking_url_invalid", {
|
|
971
|
+
trackingUrl: redactUrl(trackingUrl)
|
|
972
|
+
});
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
var unexpanded = trackingUrl.match(/\[[A-Z_]+\]/g);
|
|
976
|
+
if (unexpanded) {
|
|
977
|
+
logFunnel("tracking_url_unexpanded_macro", {
|
|
978
|
+
trackingHost: trackingHost,
|
|
979
|
+
macros: Array.from(new Set(unexpanded))
|
|
980
|
+
});
|
|
981
|
+
}
|
|
884
982
|
var img = new Image(1, 1);
|
|
885
983
|
inFlightBeacons.add(img);
|
|
886
984
|
var timeoutId;
|
|
887
|
-
var release = function release() {
|
|
985
|
+
var release = function release(outcome) {
|
|
888
986
|
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
889
987
|
img.onload = null;
|
|
890
988
|
img.onerror = null;
|
|
891
989
|
inFlightBeacons.delete(img);
|
|
990
|
+
console.log("[HlsAdPlayer] Tracking pixel settled (".concat(outcome, "): ").concat(trackingUrl));
|
|
991
|
+
if (outcome !== "load") {
|
|
992
|
+
logFunnel("tracking_request_settled", {
|
|
993
|
+
reason: outcome,
|
|
994
|
+
trackingHost: trackingHost
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
img.onload = function() {
|
|
999
|
+
return release("load");
|
|
1000
|
+
};
|
|
1001
|
+
img.onerror = function() {
|
|
1002
|
+
return release("error");
|
|
892
1003
|
};
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
1004
|
+
timeoutId = setTimeout(function() {
|
|
1005
|
+
return release("timeout");
|
|
1006
|
+
}, BEACON_TIMEOUT_MS);
|
|
896
1007
|
img.src = trackingUrl;
|
|
897
1008
|
console.log("[HlsAdPlayer] Fired tracking pixel: ".concat(trackingUrl));
|
|
1009
|
+
logFunnel("tracking_request_created", {
|
|
1010
|
+
trackingHost: trackingHost,
|
|
1011
|
+
errorCode: options2 === null || options2 === void 0 ? void 0 : options2.errorCode
|
|
1012
|
+
});
|
|
898
1013
|
} catch (error) {
|
|
899
1014
|
console.warn("[HlsAdPlayer] Error firing tracking pixel:", error);
|
|
900
1015
|
}
|
|
@@ -924,54 +1039,80 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
924
1039
|
bitrate: level.bitrate || 5e6
|
|
925
1040
|
};
|
|
926
1041
|
}
|
|
927
|
-
function
|
|
928
|
-
if (mediaFiles.length === 0) {
|
|
929
|
-
throw new Error("No media files available");
|
|
930
|
-
}
|
|
931
|
-
var firstFile = mediaFiles[0];
|
|
932
|
-
if (!firstFile) {
|
|
933
|
-
throw new Error("No media files available");
|
|
934
|
-
}
|
|
935
|
-
if (mediaFiles.length === 1) {
|
|
936
|
-
return firstFile;
|
|
937
|
-
}
|
|
1042
|
+
function getMediaTargetQuality() {
|
|
938
1043
|
var mainQuality = getMainStreamQuality();
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1044
|
+
var dpr = typeof window !== "undefined" && window.devicePixelRatio > 0 ? window.devicePixelRatio : 1;
|
|
1045
|
+
var containerWidth = ((adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.clientWidth) || contentVideo.clientWidth) * dpr;
|
|
1046
|
+
var containerHeight = ((adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.clientHeight) || contentVideo.clientHeight) * dpr;
|
|
1047
|
+
if (!mainQuality && !(containerWidth > 0 && containerHeight > 0)) {
|
|
1048
|
+
return null;
|
|
1049
|
+
}
|
|
1050
|
+
var base = mainQuality !== null && mainQuality !== void 0 ? mainQuality : {
|
|
1051
|
+
width: containerWidth,
|
|
1052
|
+
height: containerHeight,
|
|
1053
|
+
bitrate: 5e6
|
|
1054
|
+
};
|
|
1055
|
+
var width = containerWidth > 0 ? Math.min(base.width, containerWidth) : base.width;
|
|
1056
|
+
var height = containerHeight > 0 ? Math.min(base.height, containerHeight) : base.height;
|
|
1057
|
+
return {
|
|
1058
|
+
width: width,
|
|
1059
|
+
height: height,
|
|
1060
|
+
bitrate: base.bitrate
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
function rankMediaCandidates(mediaFiles) {
|
|
1064
|
+
var probe = adVideoElement !== null && adVideoElement !== void 0 ? adVideoElement : document.createElement("video");
|
|
1065
|
+
var pageIsHttps = typeof location !== "undefined" && location.protocol === "https:";
|
|
1066
|
+
var target = getMediaTargetQuality();
|
|
1067
|
+
var accepted = [];
|
|
1068
|
+
mediaFiles.forEach(function(file, index) {
|
|
1069
|
+
var isHls = isHlsMediaFile(file);
|
|
1070
|
+
var mimeForProbe = isHls ? "application/vnd.apple.mpegurl" : file.type || "video/mp4";
|
|
1071
|
+
var canPlay = probe.canPlayType(mimeForProbe);
|
|
1072
|
+
var playable = isHls ? import_hls.default.isSupported() || canPlay !== "" : canPlay !== "";
|
|
1073
|
+
var insecure = pageIsHttps && /^http:/i.test(file.url);
|
|
1074
|
+
var details = {
|
|
1075
|
+
index: index,
|
|
1076
|
+
candidateUrl: file.url,
|
|
1077
|
+
candidateType: file.type,
|
|
1078
|
+
width: file.width,
|
|
1079
|
+
height: file.height,
|
|
1080
|
+
bitrate: file.bitrate,
|
|
1081
|
+
canPlayType: canPlay,
|
|
1082
|
+
hlsJs: isHls ? import_hls.default.isSupported() : void 0
|
|
1083
|
+
};
|
|
1084
|
+
if (!playable) {
|
|
1085
|
+
logFunnel("media_candidate", _object_spread_props(_object_spread({}, details), {
|
|
1086
|
+
reason: "rejected",
|
|
1087
|
+
why: "cannot_play_type"
|
|
1088
|
+
}));
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
var score = 0;
|
|
1092
|
+
if (target) {
|
|
1093
|
+
var resolutionDiff = Math.abs(file.width - target.width) + Math.abs(file.height - target.height);
|
|
1094
|
+
var bitrateDiff = Math.abs((file.bitrate || 5e3) * 1e3 - target.bitrate);
|
|
1095
|
+
score = resolutionDiff * 2 + bitrateDiff / 1e3;
|
|
1096
|
+
}
|
|
1097
|
+
accepted.push({
|
|
952
1098
|
file: file,
|
|
953
1099
|
score: score,
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
}
|
|
1100
|
+
insecure: insecure
|
|
1101
|
+
});
|
|
1102
|
+
logFunnel("media_candidate", _object_spread_props(_object_spread({}, details), {
|
|
1103
|
+
reason: "accepted",
|
|
1104
|
+
// Mixed-content media is often auto-upgraded, so it is kept as a last resort.
|
|
1105
|
+
why: insecure ? "insecure_http_deprioritized" : "playable",
|
|
1106
|
+
score: score
|
|
1107
|
+
}));
|
|
957
1108
|
});
|
|
958
|
-
|
|
1109
|
+
accepted.sort(function(a, b) {
|
|
1110
|
+
if (a.insecure !== b.insecure) return a.insecure ? 1 : -1;
|
|
959
1111
|
return a.score - b.score;
|
|
960
1112
|
});
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
console.log("[HlsAdPlayer] No best match found, using first media file");
|
|
964
|
-
return firstFile;
|
|
965
|
-
}
|
|
966
|
-
console.log("[HlsAdPlayer] Selected media file:", {
|
|
967
|
-
url: bestMatch.file.url,
|
|
968
|
-
resolution: "".concat(bestMatch.file.width, "x").concat(bestMatch.file.height),
|
|
969
|
-
bitrate: bestMatch.file.bitrate,
|
|
970
|
-
score: bestMatch.score,
|
|
971
|
-
resolutionDiff: bestMatch.resolutionDiff,
|
|
972
|
-
bitrateDiff: bestMatch.bitrateDiff
|
|
1113
|
+
return accepted.map(function(entry) {
|
|
1114
|
+
return entry.file;
|
|
973
1115
|
});
|
|
974
|
-
return bestMatch.file;
|
|
975
1116
|
}
|
|
976
1117
|
function isHlsMediaFile(mediaFile) {
|
|
977
1118
|
var type = mediaFile.type.toLowerCase();
|
|
@@ -988,9 +1129,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
988
1129
|
var url = (mediaFile.url.toLowerCase().split("?")[0] || "").trim();
|
|
989
1130
|
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");
|
|
990
1131
|
}
|
|
991
|
-
function collectVideoMediaFiles(linear, verbose) {
|
|
1132
|
+
function collectVideoMediaFiles(linear, verbose, stats) {
|
|
992
1133
|
var mediaFileElements = linear.querySelectorAll(":scope > MediaFiles > MediaFile");
|
|
993
1134
|
var mediaFiles = [];
|
|
1135
|
+
if (stats) stats.total += mediaFileElements.length;
|
|
994
1136
|
if (verbose) {
|
|
995
1137
|
console.log("[HlsAdPlayer] Found ".concat(mediaFileElements.length, " MediaFile element(s) in VAST XML"));
|
|
996
1138
|
}
|
|
@@ -1011,6 +1153,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1011
1153
|
}
|
|
1012
1154
|
var apiFramework = (mf.getAttribute("apiFramework") || "").toUpperCase();
|
|
1013
1155
|
if (apiFramework === "VPAID") {
|
|
1156
|
+
if (stats) stats.vpaid++;
|
|
1014
1157
|
if (verbose) {
|
|
1015
1158
|
console.log("[HlsAdPlayer] MediaFile ".concat(index, " ignored (VPAID creatives are not supported)"));
|
|
1016
1159
|
}
|
|
@@ -1026,11 +1169,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1026
1169
|
bitrate: bitrateValue && bitrateValue > 0 ? bitrateValue : void 0
|
|
1027
1170
|
};
|
|
1028
1171
|
if (isAudioMediaFile(mediaFile)) {
|
|
1172
|
+
if (stats) stats.audio++;
|
|
1029
1173
|
console.warn("[HlsAdPlayer] MediaFile ".concat(index, ' skipped (audio-only, type="').concat(type, '") — audio ads are not played to avoid a black screen'));
|
|
1030
1174
|
return;
|
|
1031
1175
|
}
|
|
1032
1176
|
var hasExplicitDimensions = mf.getAttribute("width") != null && mf.getAttribute("height") != null;
|
|
1033
1177
|
if (!isHlsMediaFile(mediaFile) && hasExplicitDimensions && (mediaFile.width <= 1 || mediaFile.height <= 1)) {
|
|
1178
|
+
if (stats) stats.audio++;
|
|
1034
1179
|
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'));
|
|
1035
1180
|
return;
|
|
1036
1181
|
}
|
|
@@ -1039,8 +1184,11 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1039
1184
|
if (verbose) {
|
|
1040
1185
|
console.log("[HlsAdPlayer] Added ".concat(isHlsMediaFile(mediaFile) ? "HLS" : "progressive", " MediaFile: ").concat(url));
|
|
1041
1186
|
}
|
|
1042
|
-
} else
|
|
1043
|
-
|
|
1187
|
+
} else {
|
|
1188
|
+
if (stats) stats.unsupported++;
|
|
1189
|
+
if (verbose) {
|
|
1190
|
+
console.log("[HlsAdPlayer] MediaFile ".concat(index, ' ignored (type="').concat(type, '" is not supported)'));
|
|
1191
|
+
}
|
|
1044
1192
|
}
|
|
1045
1193
|
});
|
|
1046
1194
|
return mediaFiles;
|
|
@@ -1164,26 +1312,58 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1164
1312
|
}
|
|
1165
1313
|
function parseVastXml(xmlString) {
|
|
1166
1314
|
try {
|
|
1167
|
-
var _adElements_find;
|
|
1168
1315
|
var xmlDoc = parseXml(xmlString);
|
|
1169
1316
|
if (!xmlDoc) return {
|
|
1170
1317
|
type: "empty"
|
|
1171
1318
|
};
|
|
1172
1319
|
var root = xmlDoc.documentElement;
|
|
1173
1320
|
var adElements = Array.from(root.querySelectorAll(":scope > Ad"));
|
|
1174
|
-
|
|
1175
|
-
return getAdSequence(el) === void 0;
|
|
1176
|
-
})) !== null && _adElements_find !== void 0 ? _adElements_find : adElements[0];
|
|
1177
|
-
if (!adElement) {
|
|
1321
|
+
if (adElements.length === 0) {
|
|
1178
1322
|
var _root_getAttribute;
|
|
1179
1323
|
console.warn("[HlsAdPlayer] No Ad element found in VAST ".concat((_root_getAttribute = root.getAttribute("version")) !== null && _root_getAttribute !== void 0 ? _root_getAttribute : "", " response"));
|
|
1180
1324
|
return emptyVastResult(root);
|
|
1181
1325
|
}
|
|
1182
|
-
var
|
|
1183
|
-
|
|
1184
|
-
|
|
1326
|
+
var ordered = _to_consumable_array(adElements.filter(function(el) {
|
|
1327
|
+
return getAdSequence(el) === void 0;
|
|
1328
|
+
})).concat(_to_consumable_array(adElements.filter(function(el) {
|
|
1329
|
+
return getAdSequence(el) !== void 0;
|
|
1330
|
+
})));
|
|
1331
|
+
var firstEmpty;
|
|
1332
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1333
|
+
try {
|
|
1334
|
+
for(var _iterator = ordered.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1335
|
+
var _step_value = _sliced_to_array(_step.value, 2), index = _step_value[0], adElement = _step_value[1];
|
|
1336
|
+
var parsed = parseAdElement(adElement, true);
|
|
1337
|
+
if (parsed.type === "empty") {
|
|
1338
|
+
firstEmpty !== null && firstEmpty !== void 0 ? firstEmpty : firstEmpty = parsed;
|
|
1339
|
+
continue;
|
|
1340
|
+
}
|
|
1341
|
+
if (index > 0) {
|
|
1342
|
+
logFunnel("vast_ad_fallback", {
|
|
1343
|
+
usedAdIndex: index,
|
|
1344
|
+
adCount: ordered.length
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
if (parsed.type === "wrapper") {
|
|
1348
|
+
console.log("[HlsAdPlayer] VAST wrapper detected, following VASTAdTagURI: ".concat(parsed.vastAdTagUri));
|
|
1349
|
+
}
|
|
1350
|
+
return parsed;
|
|
1351
|
+
}
|
|
1352
|
+
} catch (err) {
|
|
1353
|
+
_didIteratorError = true;
|
|
1354
|
+
_iteratorError = err;
|
|
1355
|
+
} finally{
|
|
1356
|
+
try {
|
|
1357
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1358
|
+
_iterator.return();
|
|
1359
|
+
}
|
|
1360
|
+
} finally{
|
|
1361
|
+
if (_didIteratorError) {
|
|
1362
|
+
throw _iteratorError;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1185
1365
|
}
|
|
1186
|
-
return
|
|
1366
|
+
return firstEmpty !== null && firstEmpty !== void 0 ? firstEmpty : emptyVastResult(root);
|
|
1187
1367
|
} catch (error) {
|
|
1188
1368
|
console.error("[HlsAdPlayer] Error parsing VAST XML:", error);
|
|
1189
1369
|
return {
|
|
@@ -1229,6 +1409,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1229
1409
|
pushUrls(errorUrls, inLine.querySelectorAll(":scope > Error"));
|
|
1230
1410
|
if (adElement.getAttribute("conditionalAd") === "true") {
|
|
1231
1411
|
console.warn("[HlsAdPlayer] Skipping conditional <Ad> (VPAID-only)");
|
|
1412
|
+
logFunnel("vast_no_supported_media", {
|
|
1413
|
+
reason: "vpaid_only",
|
|
1414
|
+
conditionalAd: true
|
|
1415
|
+
});
|
|
1232
1416
|
return {
|
|
1233
1417
|
type: "empty",
|
|
1234
1418
|
errorUrls: errorUrls,
|
|
@@ -1237,11 +1421,17 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1237
1421
|
}
|
|
1238
1422
|
var linear;
|
|
1239
1423
|
var mediaFiles = [];
|
|
1424
|
+
var rejectStats = {
|
|
1425
|
+
total: 0,
|
|
1426
|
+
vpaid: 0,
|
|
1427
|
+
audio: 0,
|
|
1428
|
+
unsupported: 0
|
|
1429
|
+
};
|
|
1240
1430
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1241
1431
|
try {
|
|
1242
1432
|
for(var _iterator = Array.from(inLine.querySelectorAll(":scope > Creatives > Creative > Linear"))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1243
1433
|
var candidate = _step.value;
|
|
1244
|
-
var files = collectVideoMediaFiles(candidate, verbose);
|
|
1434
|
+
var files = collectVideoMediaFiles(candidate, verbose, rejectStats);
|
|
1245
1435
|
if (files.length > 0) {
|
|
1246
1436
|
linear = candidate;
|
|
1247
1437
|
mediaFiles = files;
|
|
@@ -1264,6 +1454,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1264
1454
|
}
|
|
1265
1455
|
if (!linear) {
|
|
1266
1456
|
console.warn("[HlsAdPlayer] No supported linear media files in <Ad>");
|
|
1457
|
+
var reason = rejectStats.total === 0 ? "no_mediafiles" : rejectStats.vpaid > 0 ? "vpaid_only" : rejectStats.audio > 0 ? "audio_only" : "unsupported_type";
|
|
1458
|
+
logFunnel("vast_no_supported_media", _object_spread({
|
|
1459
|
+
reason: reason
|
|
1460
|
+
}, rejectStats));
|
|
1267
1461
|
return {
|
|
1268
1462
|
type: "empty",
|
|
1269
1463
|
errorUrls: errorUrls,
|
|
@@ -1295,77 +1489,122 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1295
1489
|
function fetchVastXml(vastTagUrl) {
|
|
1296
1490
|
var credentials = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "include";
|
|
1297
1491
|
return _async_to_generator(function() {
|
|
1298
|
-
var requestVast, response, error;
|
|
1492
|
+
var controller, timeoutId, requestVast, response, error, error1;
|
|
1299
1493
|
return _ts_generator(this, function(_state) {
|
|
1300
1494
|
switch(_state.label){
|
|
1301
1495
|
case 0:
|
|
1496
|
+
if (destroyed) {
|
|
1497
|
+
throw new Error("VAST request skipped: ad player destroyed");
|
|
1498
|
+
}
|
|
1499
|
+
controller = typeof AbortController !== "undefined" ? new AbortController() : void 0;
|
|
1500
|
+
if (controller) pendingVastRequests.add(controller);
|
|
1501
|
+
timeoutId = controller ? setTimeout(function() {
|
|
1502
|
+
return controller.abort();
|
|
1503
|
+
}, VAST_REQUEST_TIMEOUT_MS) : void 0;
|
|
1302
1504
|
requestVast = function requestVast(creds) {
|
|
1303
|
-
return fetch(vastTagUrl, {
|
|
1505
|
+
return fetch(vastTagUrl, _object_spread({
|
|
1304
1506
|
mode: "cors",
|
|
1305
1507
|
credentials: creds,
|
|
1306
1508
|
headers: {
|
|
1307
1509
|
"Accept": "application/xml, text/xml, */*"
|
|
1308
1510
|
},
|
|
1309
1511
|
referrerPolicy: "no-referrer-when-downgrade"
|
|
1310
|
-
}
|
|
1512
|
+
}, controller ? {
|
|
1513
|
+
signal: controller.signal
|
|
1514
|
+
} : {}));
|
|
1311
1515
|
};
|
|
1312
1516
|
_state.label = 1;
|
|
1313
1517
|
case 1:
|
|
1314
1518
|
_state.trys.push([
|
|
1315
1519
|
1,
|
|
1316
|
-
|
|
1520
|
+
10,
|
|
1521
|
+
11,
|
|
1522
|
+
12
|
|
1523
|
+
]);
|
|
1524
|
+
_state.label = 2;
|
|
1525
|
+
case 2:
|
|
1526
|
+
_state.trys.push([
|
|
1527
|
+
2,
|
|
1528
|
+
4,
|
|
1317
1529
|
,
|
|
1318
|
-
|
|
1530
|
+
8
|
|
1319
1531
|
]);
|
|
1320
1532
|
return [
|
|
1321
1533
|
4,
|
|
1322
1534
|
requestVast(credentials)
|
|
1323
1535
|
];
|
|
1324
|
-
case
|
|
1536
|
+
case 3:
|
|
1325
1537
|
response = _state.sent();
|
|
1326
1538
|
return [
|
|
1327
1539
|
3,
|
|
1328
|
-
|
|
1540
|
+
8
|
|
1329
1541
|
];
|
|
1330
|
-
case
|
|
1542
|
+
case 4:
|
|
1331
1543
|
error = _state.sent();
|
|
1332
|
-
if (!(credentials !== "omit")) return [
|
|
1544
|
+
if (!(credentials !== "omit" && !(controller === null || controller === void 0 ? void 0 : controller.signal.aborted))) return [
|
|
1333
1545
|
3,
|
|
1334
|
-
|
|
1546
|
+
6
|
|
1335
1547
|
];
|
|
1336
1548
|
console.warn('[HlsAdPlayer] VAST fetch failed with credentials="'.concat(credentials, '", retrying without credentials:'), error);
|
|
1549
|
+
logFunnel("vast_credentials_retry", {
|
|
1550
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
1551
|
+
});
|
|
1337
1552
|
return [
|
|
1338
1553
|
4,
|
|
1339
1554
|
requestVast("omit")
|
|
1340
1555
|
];
|
|
1341
|
-
case
|
|
1556
|
+
case 5:
|
|
1342
1557
|
response = _state.sent();
|
|
1343
1558
|
return [
|
|
1344
1559
|
3,
|
|
1345
|
-
|
|
1560
|
+
7
|
|
1346
1561
|
];
|
|
1347
|
-
case 5:
|
|
1348
|
-
throw error;
|
|
1349
1562
|
case 6:
|
|
1563
|
+
throw error;
|
|
1564
|
+
case 7:
|
|
1350
1565
|
return [
|
|
1351
1566
|
3,
|
|
1352
|
-
|
|
1567
|
+
8
|
|
1353
1568
|
];
|
|
1354
|
-
case
|
|
1569
|
+
case 8:
|
|
1355
1570
|
if (!response.ok) {
|
|
1356
1571
|
throw new Error("Failed to fetch VAST: ".concat(response.statusText));
|
|
1357
1572
|
}
|
|
1358
1573
|
return [
|
|
1359
|
-
|
|
1574
|
+
4,
|
|
1360
1575
|
response.text()
|
|
1361
1576
|
];
|
|
1577
|
+
case 9:
|
|
1578
|
+
return [
|
|
1579
|
+
2,
|
|
1580
|
+
_state.sent()
|
|
1581
|
+
];
|
|
1582
|
+
case 10:
|
|
1583
|
+
error1 = _state.sent();
|
|
1584
|
+
if (controller === null || controller === void 0 ? void 0 : controller.signal.aborted) {
|
|
1585
|
+
if (pendingRequestAbortReason) {
|
|
1586
|
+
throw new Error("".concat(pendingRequestAbortReason, " (timeout): ").concat(vastTagUrl));
|
|
1587
|
+
}
|
|
1588
|
+
throw new Error("VAST request timeout after ".concat(VAST_REQUEST_TIMEOUT_MS, "ms: ").concat(vastTagUrl));
|
|
1589
|
+
}
|
|
1590
|
+
throw error1;
|
|
1591
|
+
case 11:
|
|
1592
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
1593
|
+
if (controller) pendingVastRequests.delete(controller);
|
|
1594
|
+
return [
|
|
1595
|
+
7
|
|
1596
|
+
];
|
|
1597
|
+
case 12:
|
|
1598
|
+
return [
|
|
1599
|
+
2
|
|
1600
|
+
];
|
|
1362
1601
|
}
|
|
1363
1602
|
});
|
|
1364
1603
|
})();
|
|
1365
1604
|
}
|
|
1366
1605
|
function fetchAndParseVastAd(_0) {
|
|
1367
1606
|
return _async_to_generator(function(vastTagUrl) {
|
|
1368
|
-
var depth, accumulatedTracking, rules, vastXml, error, parsed, _parsed_errorUrls, _parsed_errorCode;
|
|
1607
|
+
var depth, accumulatedTracking, rules, vastXml, fetchStartedAt, error, parsed, _parsed_errorUrls, _parsed_errorCode;
|
|
1369
1608
|
var _arguments = arguments;
|
|
1370
1609
|
return _ts_generator(this, function(_state) {
|
|
1371
1610
|
switch(_state.label){
|
|
@@ -1373,6 +1612,11 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1373
1612
|
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] : {
|
|
1374
1613
|
followAdditionalWrappers: true
|
|
1375
1614
|
};
|
|
1615
|
+
if (destroyed) return [
|
|
1616
|
+
2,
|
|
1617
|
+
null
|
|
1618
|
+
];
|
|
1619
|
+
fetchStartedAt = Date.now();
|
|
1376
1620
|
_state.label = 1;
|
|
1377
1621
|
case 1:
|
|
1378
1622
|
_state.trys.push([
|
|
@@ -1395,14 +1639,35 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1395
1639
|
error = _state.sent();
|
|
1396
1640
|
if (depth === 0) throw error;
|
|
1397
1641
|
console.warn("[HlsAdPlayer] Wrapped VAST request failed:", error);
|
|
1398
|
-
|
|
1399
|
-
|
|
1642
|
+
logFunnel("wrapper_fetch", {
|
|
1643
|
+
reason: "failure",
|
|
1644
|
+
depth: depth,
|
|
1645
|
+
wrapperUrl: redactUrl(vastTagUrl),
|
|
1646
|
+
elapsedMs: Date.now() - fetchStartedAt,
|
|
1647
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
1400
1648
|
});
|
|
1649
|
+
if (!destroyed) {
|
|
1650
|
+
fireTrackingPixels(accumulatedTracking.error, {
|
|
1651
|
+
errorCode: VAST_ERROR_WRAPPER_TIMEOUT
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1401
1654
|
return [
|
|
1402
1655
|
2,
|
|
1403
1656
|
null
|
|
1404
1657
|
];
|
|
1405
1658
|
case 4:
|
|
1659
|
+
if (destroyed) return [
|
|
1660
|
+
2,
|
|
1661
|
+
null
|
|
1662
|
+
];
|
|
1663
|
+
if (depth > 0) {
|
|
1664
|
+
logFunnel("wrapper_fetch", {
|
|
1665
|
+
reason: "success",
|
|
1666
|
+
depth: depth,
|
|
1667
|
+
wrapperUrl: redactUrl(vastTagUrl),
|
|
1668
|
+
elapsedMs: Date.now() - fetchStartedAt
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1406
1671
|
console.log("[HlsAdPlayer] VAST XML received");
|
|
1407
1672
|
console.log("[HlsAdPlayer] VAST XML content (first 2000 chars):", vastXml.substring(0, 2e3));
|
|
1408
1673
|
parsed = parseVastXml(vastXml);
|
|
@@ -1434,6 +1699,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1434
1699
|
];
|
|
1435
1700
|
}
|
|
1436
1701
|
mergeTrackingUrls(parsed.ad.trackingUrls, accumulatedTracking);
|
|
1702
|
+
logFunnel("inline_resolved", {
|
|
1703
|
+
depth: depth
|
|
1704
|
+
});
|
|
1437
1705
|
return [
|
|
1438
1706
|
2,
|
|
1439
1707
|
parsed.ad
|
|
@@ -1444,7 +1712,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1444
1712
|
}
|
|
1445
1713
|
function fetchAndParsePod(vastTagUrl) {
|
|
1446
1714
|
return _async_to_generator(function() {
|
|
1447
|
-
var _root_getAttribute, vastXml, trimmedXml, xmlDoc, root, adElements, _root_getAttribute1, _empty_errorUrls, empty, _empty_errorCode, resolveAd, podElements, buffet, ads, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step,
|
|
1715
|
+
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;
|
|
1448
1716
|
return _ts_generator(this, function(_state) {
|
|
1449
1717
|
switch(_state.label){
|
|
1450
1718
|
case 0:
|
|
@@ -1454,6 +1722,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1454
1722
|
];
|
|
1455
1723
|
case 1:
|
|
1456
1724
|
vastXml = _state.sent();
|
|
1725
|
+
if (destroyed) return [
|
|
1726
|
+
2,
|
|
1727
|
+
[]
|
|
1728
|
+
];
|
|
1457
1729
|
console.log("[HlsAdPlayer] Pod VAST XML received (length=".concat(vastXml.length, ")"));
|
|
1458
1730
|
trimmedXml = vastXml.trim();
|
|
1459
1731
|
if (trimmedXml.length === 0) {
|
|
@@ -1525,6 +1797,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1525
1797
|
buffet = adElements.filter(function(el) {
|
|
1526
1798
|
return getAdSequence(el) === void 0;
|
|
1527
1799
|
});
|
|
1800
|
+
resolveAll = function resolveAll(elements) {
|
|
1801
|
+
return Promise.all(elements.map(function(el) {
|
|
1802
|
+
return resolveAd(el).catch(function() {
|
|
1803
|
+
return null;
|
|
1804
|
+
});
|
|
1805
|
+
}));
|
|
1806
|
+
};
|
|
1528
1807
|
ads = [];
|
|
1529
1808
|
if (!(podElements.length === 0)) return [
|
|
1530
1809
|
3,
|
|
@@ -1539,27 +1818,26 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1539
1818
|
8,
|
|
1540
1819
|
9
|
|
1541
1820
|
]);
|
|
1542
|
-
|
|
1543
|
-
|
|
1821
|
+
return [
|
|
1822
|
+
4,
|
|
1823
|
+
resolveAll(buffet)
|
|
1824
|
+
];
|
|
1544
1825
|
case 3:
|
|
1826
|
+
_iterator = _state.sent()[Symbol.iterator]();
|
|
1827
|
+
_state.label = 4;
|
|
1828
|
+
case 4:
|
|
1545
1829
|
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
1546
1830
|
3,
|
|
1547
1831
|
6
|
|
1548
1832
|
];
|
|
1549
|
-
|
|
1550
|
-
return [
|
|
1551
|
-
4,
|
|
1552
|
-
resolveAd(adElement)
|
|
1553
|
-
];
|
|
1554
|
-
case 4:
|
|
1555
|
-
ad = _state.sent();
|
|
1833
|
+
ad = _step.value;
|
|
1556
1834
|
if (ad) ads.push(ad);
|
|
1557
1835
|
_state.label = 5;
|
|
1558
1836
|
case 5:
|
|
1559
1837
|
_iteratorNormalCompletion = true;
|
|
1560
1838
|
return [
|
|
1561
1839
|
3,
|
|
1562
|
-
|
|
1840
|
+
4
|
|
1563
1841
|
];
|
|
1564
1842
|
case 6:
|
|
1565
1843
|
return [
|
|
@@ -1602,20 +1880,19 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1602
1880
|
20,
|
|
1603
1881
|
21
|
|
1604
1882
|
]);
|
|
1605
|
-
|
|
1606
|
-
|
|
1883
|
+
return [
|
|
1884
|
+
4,
|
|
1885
|
+
resolveAll(podElements)
|
|
1886
|
+
];
|
|
1607
1887
|
case 12:
|
|
1888
|
+
_iterator1 = _state.sent()[Symbol.iterator]();
|
|
1889
|
+
_state.label = 13;
|
|
1890
|
+
case 13:
|
|
1608
1891
|
if (!!(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done)) return [
|
|
1609
1892
|
3,
|
|
1610
1893
|
18
|
|
1611
1894
|
];
|
|
1612
|
-
|
|
1613
|
-
return [
|
|
1614
|
-
4,
|
|
1615
|
-
resolveAd(adElement1)
|
|
1616
|
-
];
|
|
1617
|
-
case 13:
|
|
1618
|
-
ad1 = _state.sent();
|
|
1895
|
+
ad1 = _step1.value;
|
|
1619
1896
|
_state.label = 14;
|
|
1620
1897
|
case 14:
|
|
1621
1898
|
if (!(!ad1 && buffet.length > 0)) return [
|
|
@@ -1624,7 +1901,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1624
1901
|
];
|
|
1625
1902
|
return [
|
|
1626
1903
|
4,
|
|
1627
|
-
resolveAd(buffet.shift())
|
|
1904
|
+
resolveAd(buffet.shift()).catch(function() {
|
|
1905
|
+
return null;
|
|
1906
|
+
})
|
|
1628
1907
|
];
|
|
1629
1908
|
case 15:
|
|
1630
1909
|
ad1 = _state.sent();
|
|
@@ -1639,7 +1918,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1639
1918
|
_iteratorNormalCompletion1 = true;
|
|
1640
1919
|
return [
|
|
1641
1920
|
3,
|
|
1642
|
-
|
|
1921
|
+
13
|
|
1643
1922
|
];
|
|
1644
1923
|
case 18:
|
|
1645
1924
|
return [
|
|
@@ -1734,14 +2013,17 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1734
2013
|
var progress = currentTime / currentAd.duration;
|
|
1735
2014
|
if (progress >= 0.25 && !trackingFired.firstQuartile) {
|
|
1736
2015
|
trackingFired.firstQuartile = true;
|
|
2016
|
+
logFunnel("first_quartile");
|
|
1737
2017
|
fireTrackingPixels(currentAd.trackingUrls.firstQuartile);
|
|
1738
2018
|
}
|
|
1739
2019
|
if (progress >= 0.5 && !trackingFired.midpoint) {
|
|
1740
2020
|
trackingFired.midpoint = true;
|
|
2021
|
+
logFunnel("midpoint");
|
|
1741
2022
|
fireTrackingPixels(currentAd.trackingUrls.midpoint);
|
|
1742
2023
|
}
|
|
1743
2024
|
if (progress >= 0.75 && !trackingFired.thirdQuartile) {
|
|
1744
2025
|
trackingFired.thirdQuartile = true;
|
|
2026
|
+
logFunnel("third_quartile");
|
|
1745
2027
|
fireTrackingPixels(currentAd.trackingUrls.thirdQuartile);
|
|
1746
2028
|
}
|
|
1747
2029
|
};
|
|
@@ -1764,6 +2046,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1764
2046
|
if (!trackingFired.impression) {
|
|
1765
2047
|
trackingFired.impression = true;
|
|
1766
2048
|
resolvedAds.add(currentAd);
|
|
2049
|
+
logFunnel("playing", {
|
|
2050
|
+
mutedByAutoplay: forcedMuteByAutoplay,
|
|
2051
|
+
candidateIndex: mediaCandidateIndex
|
|
2052
|
+
});
|
|
2053
|
+
logFunnel("impression_fired", {
|
|
2054
|
+
pixelCount: currentAd.trackingUrls.impression.length
|
|
2055
|
+
});
|
|
2056
|
+
if (currentAd.trackingUrls.impression.length === 0) {
|
|
2057
|
+
console.warn("[HlsAdPlayer] Ad started but VAST contained no <Impression> URLs - GAM will not count it");
|
|
2058
|
+
}
|
|
1767
2059
|
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1768
2060
|
fireTrackingPixels(currentAd.trackingUrls.creativeView);
|
|
1769
2061
|
fireTrackingPixels(currentAd.trackingUrls.verificationNotExecuted, {
|
|
@@ -1786,6 +2078,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1786
2078
|
sampleViewability();
|
|
1787
2079
|
settleViewability();
|
|
1788
2080
|
trackingFired.complete = true;
|
|
2081
|
+
logFunnel("complete");
|
|
1789
2082
|
fireTrackingPixels(currentAd.trackingUrls.complete);
|
|
1790
2083
|
console.log("[HlsAdPlayer] Ad completed");
|
|
1791
2084
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
@@ -1794,16 +2087,41 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1794
2087
|
handleAdComplete();
|
|
1795
2088
|
};
|
|
1796
2089
|
var onError = function onError(e) {
|
|
2090
|
+
var _adVideoElement_error, _adVideoElement_error1;
|
|
1797
2091
|
if (!adPlaying) return;
|
|
1798
2092
|
console.error("[HlsAdPlayer] Ad video error:", e);
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
2093
|
+
var vastErrorCode = toVastMediaErrorCode(adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.error);
|
|
2094
|
+
logFunnel("media_error", {
|
|
2095
|
+
mediaErrorCode: adVideoElement === null || adVideoElement === void 0 ? void 0 : (_adVideoElement_error = adVideoElement.error) === null || _adVideoElement_error === void 0 ? void 0 : _adVideoElement_error.code,
|
|
2096
|
+
errorMessage: adVideoElement === null || adVideoElement === void 0 ? void 0 : (_adVideoElement_error1 = adVideoElement.error) === null || _adVideoElement_error1 === void 0 ? void 0 : _adVideoElement_error1.message,
|
|
2097
|
+
networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
|
|
2098
|
+
readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
|
|
2099
|
+
currentSrc: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.currentSrc,
|
|
2100
|
+
vastErrorCode: vastErrorCode
|
|
2101
|
+
});
|
|
2102
|
+
recoverFromAdFailure(vastErrorCode);
|
|
2103
|
+
};
|
|
2104
|
+
var onMediaDiagnostic = function onMediaDiagnostic(event) {
|
|
2105
|
+
if (!adPlaying || !adVideoElement || trackingFired.impression) return;
|
|
2106
|
+
if (!adVideoElement.currentSrc) return;
|
|
2107
|
+
logFunnel("media_event", {
|
|
2108
|
+
reason: event.type,
|
|
2109
|
+
readyState: adVideoElement.readyState,
|
|
2110
|
+
networkState: adVideoElement.networkState,
|
|
2111
|
+
currentSrc: adVideoElement.currentSrc
|
|
2112
|
+
});
|
|
1804
2113
|
};
|
|
1805
2114
|
var onVolumeChange = function onVolumeChange() {
|
|
1806
2115
|
if (!currentAd || !adVideoElement) return;
|
|
2116
|
+
if (forcedMuteByAutoplay && !adVideoElement.muted) {
|
|
2117
|
+
var userActivation = navigator.userActivation;
|
|
2118
|
+
if (userActivation && !userActivation.isActive) {
|
|
2119
|
+
logFunnel("unexpected_unmute", {
|
|
2120
|
+
paused: adVideoElement.paused
|
|
2121
|
+
});
|
|
2122
|
+
}
|
|
2123
|
+
forcedMuteByAutoplay = false;
|
|
2124
|
+
}
|
|
1807
2125
|
var muted = adVideoElement.muted || adVideoElement.volume === 0;
|
|
1808
2126
|
if (!trackingFired.start) {
|
|
1809
2127
|
trackingFired.lastMuted = muted;
|
|
@@ -1863,6 +2181,22 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1863
2181
|
{
|
|
1864
2182
|
type: "play",
|
|
1865
2183
|
handler: onPlay
|
|
2184
|
+
},
|
|
2185
|
+
{
|
|
2186
|
+
type: "stalled",
|
|
2187
|
+
handler: onMediaDiagnostic
|
|
2188
|
+
},
|
|
2189
|
+
{
|
|
2190
|
+
type: "suspend",
|
|
2191
|
+
handler: onMediaDiagnostic
|
|
2192
|
+
},
|
|
2193
|
+
{
|
|
2194
|
+
type: "abort",
|
|
2195
|
+
handler: onMediaDiagnostic
|
|
2196
|
+
},
|
|
2197
|
+
{
|
|
2198
|
+
type: "emptied",
|
|
2199
|
+
handler: onMediaDiagnostic
|
|
1866
2200
|
}
|
|
1867
2201
|
];
|
|
1868
2202
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -2152,16 +2486,51 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2152
2486
|
function settlePendingPlay() {
|
|
2153
2487
|
pendingPlayPromise = void 0;
|
|
2154
2488
|
}
|
|
2489
|
+
function toVastPlayErrorCode(error) {
|
|
2490
|
+
return (error === null || error === void 0 ? void 0 : error.name) === "NotSupportedError" ? VAST_ERROR_NO_SUPPORTED_MEDIA : VAST_ERROR_MEDIA_DISPLAY;
|
|
2491
|
+
}
|
|
2492
|
+
function failAdPlayback(context, error) {
|
|
2493
|
+
var vastErrorCode = toVastPlayErrorCode(error);
|
|
2494
|
+
console.error("[HlsAdPlayer] Error starting ".concat(context, ":"), error);
|
|
2495
|
+
logFunnel("play_failed", {
|
|
2496
|
+
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
2497
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
2498
|
+
vastErrorCode: vastErrorCode
|
|
2499
|
+
});
|
|
2500
|
+
recoverFromAdFailure(vastErrorCode);
|
|
2501
|
+
}
|
|
2155
2502
|
function startAdPlayback(context) {
|
|
2503
|
+
var isMutedRetry = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
2156
2504
|
if (!adVideoElement) return;
|
|
2505
|
+
var computed = typeof getComputedStyle === "function" && adContainerEl ? getComputedStyle(adContainerEl) : void 0;
|
|
2506
|
+
logFunnel(isMutedRetry ? "muted_retry" : "play_called", {
|
|
2507
|
+
context: context,
|
|
2508
|
+
isConnected: adVideoElement.isConnected,
|
|
2509
|
+
clientWidth: adVideoElement.clientWidth,
|
|
2510
|
+
clientHeight: adVideoElement.clientHeight,
|
|
2511
|
+
containerDisplay: computed === null || computed === void 0 ? void 0 : computed.display,
|
|
2512
|
+
containerVisibility: computed === null || computed === void 0 ? void 0 : computed.visibility
|
|
2513
|
+
});
|
|
2157
2514
|
var playPromise = adVideoElement.play();
|
|
2158
2515
|
pendingPlayPromise = playPromise;
|
|
2159
2516
|
playPromise.catch(function(error) {
|
|
2160
2517
|
if (pendingPlayPromise !== playPromise) {
|
|
2161
2518
|
return;
|
|
2162
2519
|
}
|
|
2163
|
-
|
|
2164
|
-
|
|
2520
|
+
logFunnel("play_rejected", {
|
|
2521
|
+
context: context,
|
|
2522
|
+
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
2523
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
2524
|
+
});
|
|
2525
|
+
if (!isMutedRetry && (error === null || error === void 0 ? void 0 : error.name) === "NotAllowedError" && adVideoElement && !adVideoElement.muted) {
|
|
2526
|
+
console.warn("[HlsAdPlayer] Unmuted ".concat(context, " blocked by autoplay policy - retrying muted"));
|
|
2527
|
+
originalMutedState = true;
|
|
2528
|
+
forcedMuteByAutoplay = true;
|
|
2529
|
+
adVideoElement.muted = true;
|
|
2530
|
+
startAdPlayback(context, true);
|
|
2531
|
+
return;
|
|
2532
|
+
}
|
|
2533
|
+
failAdPlayback(context, error);
|
|
2165
2534
|
}).finally(function() {
|
|
2166
2535
|
if (pendingPlayPromise === playPromise) {
|
|
2167
2536
|
pendingPlayPromise = void 0;
|
|
@@ -2200,17 +2569,109 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2200
2569
|
adVideoElement.volume = Math.max(0, Math.min(1, originalVolume));
|
|
2201
2570
|
adVideoElement.muted = originalMutedState;
|
|
2202
2571
|
}
|
|
2572
|
+
function clearMediaStartTimer() {
|
|
2573
|
+
if (mediaStartTimerId !== void 0) {
|
|
2574
|
+
clearTimeout(mediaStartTimerId);
|
|
2575
|
+
mediaStartTimerId = void 0;
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
function startMediaStartTimer() {
|
|
2579
|
+
clearMediaStartTimer();
|
|
2580
|
+
if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
|
|
2581
|
+
var startedAt = Date.now();
|
|
2582
|
+
mediaStartTimerId = setTimeout(function() {
|
|
2583
|
+
mediaStartTimerId = void 0;
|
|
2584
|
+
if (!adPlaying || trackingFired.impression) return;
|
|
2585
|
+
console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(MEDIA_START_TIMEOUT_MS, "ms"));
|
|
2586
|
+
logFunnel("play_resolved_but_never_started", {
|
|
2587
|
+
timeoutMs: MEDIA_START_TIMEOUT_MS,
|
|
2588
|
+
elapsedMs: Date.now() - startedAt,
|
|
2589
|
+
readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
|
|
2590
|
+
networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
|
|
2591
|
+
currentSrc: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.currentSrc,
|
|
2592
|
+
paused: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.paused,
|
|
2593
|
+
vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
|
|
2594
|
+
});
|
|
2595
|
+
recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
|
|
2596
|
+
}, MEDIA_START_TIMEOUT_MS);
|
|
2597
|
+
}
|
|
2598
|
+
function resetVideoElementForNextSource() {
|
|
2599
|
+
clearStallWatchdog();
|
|
2600
|
+
if (requiresMediaPipelineResetAfterAds()) {
|
|
2601
|
+
recreateAdVideoElement();
|
|
2602
|
+
setupAdEventListeners();
|
|
2603
|
+
} else {
|
|
2604
|
+
prepareVideoElementForNewSource();
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
function tryNextMediaCandidate() {
|
|
2608
|
+
if (!currentAd || trackingFired.impression) return false;
|
|
2609
|
+
if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
|
|
2610
|
+
var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
|
|
2611
|
+
mediaCandidateIndex++;
|
|
2612
|
+
var next = mediaCandidates[mediaCandidateIndex];
|
|
2613
|
+
if (!next) return false;
|
|
2614
|
+
logFunnel("media_fallback", {
|
|
2615
|
+
failedUrl: failedUrl,
|
|
2616
|
+
nextUrl: next.url,
|
|
2617
|
+
nextType: next.type,
|
|
2618
|
+
candidateIndex: mediaCandidateIndex,
|
|
2619
|
+
candidateCount: mediaCandidates.length
|
|
2620
|
+
});
|
|
2621
|
+
resetVideoElementForNextSource();
|
|
2622
|
+
try {
|
|
2623
|
+
loadMediaCandidate(next);
|
|
2624
|
+
return true;
|
|
2625
|
+
} catch (error) {
|
|
2626
|
+
console.error("[HlsAdPlayer] Failed to load fallback media file:", error);
|
|
2627
|
+
return tryNextMediaCandidate();
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
function recoverFromAdFailure(vastErrorCode) {
|
|
2631
|
+
clearMediaStartTimer();
|
|
2632
|
+
if (tryNextMediaCandidate()) return;
|
|
2633
|
+
reportCurrentAdError(vastErrorCode);
|
|
2634
|
+
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) return;
|
|
2635
|
+
handleAdError();
|
|
2636
|
+
}
|
|
2203
2637
|
function loadCurrentAdMedia() {
|
|
2204
2638
|
if (!adVideoElement || !currentAd) {
|
|
2205
2639
|
throw new Error("No ad video element or ad to load");
|
|
2206
2640
|
}
|
|
2207
|
-
|
|
2641
|
+
mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
|
|
2642
|
+
mediaCandidateIndex = 0;
|
|
2643
|
+
var mediaFile = mediaCandidates[0];
|
|
2208
2644
|
if (!mediaFile) {
|
|
2209
|
-
|
|
2645
|
+
logFunnel("media_unsupported", {
|
|
2646
|
+
vastErrorCode: VAST_ERROR_NO_SUPPORTED_MEDIA,
|
|
2647
|
+
candidates: currentAd.mediaFiles.length
|
|
2648
|
+
});
|
|
2649
|
+
reportCurrentAdError(VAST_ERROR_NO_SUPPORTED_MEDIA);
|
|
2650
|
+
throw new Error("No media file this browser can play");
|
|
2651
|
+
}
|
|
2652
|
+
try {
|
|
2653
|
+
loadMediaCandidate(mediaFile);
|
|
2654
|
+
} catch (error) {
|
|
2655
|
+
if (tryNextMediaCandidate()) return;
|
|
2656
|
+
reportCurrentAdError(VAST_ERROR_NO_SUPPORTED_MEDIA);
|
|
2657
|
+
throw error;
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
function loadMediaCandidate(mediaFile) {
|
|
2661
|
+
if (!adVideoElement || !currentAd) {
|
|
2662
|
+
throw new Error("No ad video element or ad to load");
|
|
2210
2663
|
}
|
|
2211
2664
|
currentAdMediaFile = mediaFile;
|
|
2212
2665
|
var isHlsAd = isHlsMediaFile(mediaFile);
|
|
2666
|
+
logFunnel("media_selected", {
|
|
2667
|
+
width: mediaFile.width,
|
|
2668
|
+
height: mediaFile.height,
|
|
2669
|
+
bitrate: mediaFile.bitrate,
|
|
2670
|
+
candidateIndex: mediaCandidateIndex,
|
|
2671
|
+
candidates: mediaCandidates.length
|
|
2672
|
+
});
|
|
2213
2673
|
console.log("[HlsAdPlayer] Loading ".concat(isHlsAd ? "HLS" : "progressive", " ad (pod ").concat(podIndex + 1, "/").concat(podAds.length || 1, ") from: ").concat(mediaFile.url));
|
|
2674
|
+
startMediaStartTimer();
|
|
2214
2675
|
if (isHlsAd && import_hls.default.isSupported()) {
|
|
2215
2676
|
if (adHls) {
|
|
2216
2677
|
adHls.destroy();
|
|
@@ -2219,6 +2680,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2219
2680
|
enableWorker: true,
|
|
2220
2681
|
lowLatencyMode: false
|
|
2221
2682
|
});
|
|
2683
|
+
logFunnel("media_load", {
|
|
2684
|
+
pipeline: "hls.js"
|
|
2685
|
+
});
|
|
2222
2686
|
adHls.loadSource(mediaFile.url);
|
|
2223
2687
|
adHls.attachMedia(adVideoElement);
|
|
2224
2688
|
adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
|
|
@@ -2228,10 +2692,24 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2228
2692
|
adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
|
|
2229
2693
|
console.error("[HlsAdPlayer] HLS error:", data);
|
|
2230
2694
|
if (data.fatal) {
|
|
2231
|
-
|
|
2695
|
+
var _data_response, _data_response1, _data_frag;
|
|
2696
|
+
var vastErrorCode = data.type === import_hls.default.ErrorTypes.NETWORK_ERROR ? 401 : VAST_ERROR_MEDIA_DISPLAY;
|
|
2697
|
+
logFunnel("hls_fatal", {
|
|
2698
|
+
reason: data.details,
|
|
2699
|
+
errorName: data.type,
|
|
2700
|
+
errorMessage: data.details,
|
|
2701
|
+
responseCode: (_data_response = data.response) === null || _data_response === void 0 ? void 0 : _data_response.code,
|
|
2702
|
+
responseText: (_data_response1 = data.response) === null || _data_response1 === void 0 ? void 0 : _data_response1.text,
|
|
2703
|
+
fragUrl: (_data_frag = data.frag) === null || _data_frag === void 0 ? void 0 : _data_frag.url,
|
|
2704
|
+
vastErrorCode: vastErrorCode
|
|
2705
|
+
});
|
|
2706
|
+
recoverFromAdFailure(vastErrorCode);
|
|
2232
2707
|
}
|
|
2233
2708
|
});
|
|
2234
2709
|
} else if (isHlsAd && adVideoElement.canPlayType("application/vnd.apple.mpegurl")) {
|
|
2710
|
+
logFunnel("media_load", {
|
|
2711
|
+
pipeline: "native-hls"
|
|
2712
|
+
});
|
|
2235
2713
|
adVideoElement.src = mediaFile.url;
|
|
2236
2714
|
startAdPlayback("native HLS ad playback");
|
|
2237
2715
|
} else if (!isHlsAd && isProgressiveMediaFile(mediaFile)) {
|
|
@@ -2239,45 +2717,47 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2239
2717
|
adHls.destroy();
|
|
2240
2718
|
adHls = void 0;
|
|
2241
2719
|
}
|
|
2720
|
+
logFunnel("media_load", {
|
|
2721
|
+
pipeline: "progressive"
|
|
2722
|
+
});
|
|
2242
2723
|
adVideoElement.src = mediaFile.url;
|
|
2243
2724
|
adVideoElement.load();
|
|
2244
2725
|
startAdPlayback("progressive ad playback");
|
|
2245
2726
|
} else {
|
|
2727
|
+
clearMediaStartTimer();
|
|
2728
|
+
logFunnel("media_unsupported", {
|
|
2729
|
+
vastErrorCode: VAST_ERROR_NO_SUPPORTED_MEDIA
|
|
2730
|
+
});
|
|
2246
2731
|
throw new Error("Unsupported ad media file type: ".concat(mediaFile.type));
|
|
2247
2732
|
}
|
|
2248
2733
|
}
|
|
2249
2734
|
function advanceToNextPodAd() {
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
index: podIndex,
|
|
2272
|
-
total: podAds.length
|
|
2273
|
-
});
|
|
2274
|
-
return true;
|
|
2275
|
-
} catch (error) {
|
|
2276
|
-
console.error("[HlsAdPlayer] Failed to load next pod ad:", error);
|
|
2277
|
-
return false;
|
|
2735
|
+
clearMediaStartTimer();
|
|
2736
|
+
while(podIndex < podAds.length - 1){
|
|
2737
|
+
settleViewability();
|
|
2738
|
+
podIndex++;
|
|
2739
|
+
currentAd = podAds[podIndex];
|
|
2740
|
+
currentAdMediaFile = void 0;
|
|
2741
|
+
resetAdTracking();
|
|
2742
|
+
if (currentAd) {
|
|
2743
|
+
console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
|
|
2744
|
+
}
|
|
2745
|
+
resetVideoElementForNextSource();
|
|
2746
|
+
try {
|
|
2747
|
+
loadCurrentAdMedia();
|
|
2748
|
+
emit("pod_ad_started", {
|
|
2749
|
+
index: podIndex,
|
|
2750
|
+
total: podAds.length
|
|
2751
|
+
});
|
|
2752
|
+
return true;
|
|
2753
|
+
} catch (error) {
|
|
2754
|
+
console.error("[HlsAdPlayer] Failed to load next pod ad:", error);
|
|
2755
|
+
}
|
|
2278
2756
|
}
|
|
2757
|
+
return false;
|
|
2279
2758
|
}
|
|
2280
2759
|
function clearStallWatchdog() {
|
|
2760
|
+
clearMediaStartTimer();
|
|
2281
2761
|
if (stallWatchdogId != null) {
|
|
2282
2762
|
clearInterval(stallWatchdogId);
|
|
2283
2763
|
stallWatchdogId = void 0;
|
|
@@ -2293,11 +2773,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2293
2773
|
function handleAdStall() {
|
|
2294
2774
|
console.warn("[HlsAdPlayer] Ad playback stalled (no progress) - recovering to avoid a blank frame");
|
|
2295
2775
|
clearStallWatchdog();
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
handleAdError();
|
|
2776
|
+
logFunnel("stall", {
|
|
2777
|
+
vastErrorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
2778
|
+
});
|
|
2779
|
+
recoverFromAdFailure(VAST_ERROR_MEDIA_DISPLAY);
|
|
2301
2780
|
}
|
|
2302
2781
|
function getDecodedVideoFrameCount(video) {
|
|
2303
2782
|
try {
|
|
@@ -2359,11 +2838,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2359
2838
|
function handleVideoDecodeFailure() {
|
|
2360
2839
|
console.warn("[HlsAdPlayer] Ad audio is advancing but no video frames decoded (black screen) - skipping this creative");
|
|
2361
2840
|
clearStallWatchdog();
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
handleAdError();
|
|
2841
|
+
logFunnel("decode_failure", {
|
|
2842
|
+
vastErrorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
2843
|
+
});
|
|
2844
|
+
recoverFromAdFailure(VAST_ERROR_MEDIA_DISPLAY);
|
|
2367
2845
|
}
|
|
2368
2846
|
function startStallWatchdog() {
|
|
2369
2847
|
clearStallWatchdog();
|
|
@@ -2487,6 +2965,15 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2487
2965
|
Promise.reject(new Error("Ad already playing"))
|
|
2488
2966
|
];
|
|
2489
2967
|
}
|
|
2968
|
+
if (destroyed) {
|
|
2969
|
+
return [
|
|
2970
|
+
2,
|
|
2971
|
+
Promise.reject(new Error("Ad player destroyed"))
|
|
2972
|
+
];
|
|
2973
|
+
}
|
|
2974
|
+
currentVastTagUrl = vastTagUrl;
|
|
2975
|
+
pendingRequestAbortReason = void 0;
|
|
2976
|
+
logFunnel("request_sent");
|
|
2490
2977
|
_state.label = 1;
|
|
2491
2978
|
case 1:
|
|
2492
2979
|
_state.trys.push([
|
|
@@ -2521,8 +3008,18 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2521
3008
|
ads = _state.sent();
|
|
2522
3009
|
_state.label = 4;
|
|
2523
3010
|
case 4:
|
|
3011
|
+
if (destroyed) {
|
|
3012
|
+
return [
|
|
3013
|
+
2,
|
|
3014
|
+
Promise.reject(new Error("Ad player destroyed"))
|
|
3015
|
+
];
|
|
3016
|
+
}
|
|
3017
|
+
if (!ads.length && pendingRequestAbortReason) {
|
|
3018
|
+
throw new Error(pendingRequestAbortReason);
|
|
3019
|
+
}
|
|
2524
3020
|
if (!ads.length) {
|
|
2525
3021
|
console.warn("[HlsAdPlayer] No ads available from VAST response");
|
|
3022
|
+
logFunnel("no_fill");
|
|
2526
3023
|
emit("ad_error");
|
|
2527
3024
|
return [
|
|
2528
3025
|
2,
|
|
@@ -2533,6 +3030,23 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2533
3030
|
podIndex = 0;
|
|
2534
3031
|
currentAd = ads[0];
|
|
2535
3032
|
currentAdMediaFile = void 0;
|
|
3033
|
+
logFunnel("vast_received", {
|
|
3034
|
+
adCount: ads.length,
|
|
3035
|
+
durations: ads.map(function(ad) {
|
|
3036
|
+
return ad.duration;
|
|
3037
|
+
}),
|
|
3038
|
+
impressionUrls: ads.map(function(ad) {
|
|
3039
|
+
return ad.trackingUrls.impression.length;
|
|
3040
|
+
})
|
|
3041
|
+
});
|
|
3042
|
+
ads.forEach(function(ad, index) {
|
|
3043
|
+
if (ad.trackingUrls.impression.length === 0) {
|
|
3044
|
+
logFunnel("vast_missing_impression", {
|
|
3045
|
+
adIndex: index,
|
|
3046
|
+
missingAdId: ad.id
|
|
3047
|
+
});
|
|
3048
|
+
}
|
|
3049
|
+
});
|
|
2536
3050
|
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"));
|
|
2537
3051
|
return [
|
|
2538
3052
|
2,
|
|
@@ -2541,6 +3055,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2541
3055
|
case 5:
|
|
2542
3056
|
error = _state.sent();
|
|
2543
3057
|
console.error("[HlsAdPlayer] Error requesting ads:", error);
|
|
3058
|
+
logFunnel("request_failed", {
|
|
3059
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
3060
|
+
});
|
|
2544
3061
|
emit("ad_error");
|
|
2545
3062
|
return [
|
|
2546
3063
|
2,
|
|
@@ -2596,13 +3113,22 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2596
3113
|
adContainerEl.style.pointerEvents = "auto";
|
|
2597
3114
|
}
|
|
2598
3115
|
emit("content_pause");
|
|
2599
|
-
|
|
3116
|
+
try {
|
|
3117
|
+
loadCurrentAdMedia();
|
|
3118
|
+
} catch (loadError) {
|
|
3119
|
+
if (!(podIndex < podAds.length - 1 && advanceToNextPodAd())) {
|
|
3120
|
+
throw loadError;
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
2600
3123
|
return [
|
|
2601
3124
|
2,
|
|
2602
3125
|
Promise.resolve()
|
|
2603
3126
|
];
|
|
2604
3127
|
} catch (error) {
|
|
2605
3128
|
console.error("[HlsAdPlayer] Error playing ad:", error);
|
|
3129
|
+
logFunnel("play_failed", {
|
|
3130
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
3131
|
+
});
|
|
2606
3132
|
handleAdError();
|
|
2607
3133
|
return [
|
|
2608
3134
|
2,
|
|
@@ -2644,6 +3170,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2644
3170
|
var previousMutedState;
|
|
2645
3171
|
return _ts_generator(this, function(_state) {
|
|
2646
3172
|
console.log("[HlsAdPlayer] Stopping ad");
|
|
3173
|
+
if (adPlaying && currentAd && !trackingFired.impression) {
|
|
3174
|
+
logFunnel("stopped_before_start");
|
|
3175
|
+
}
|
|
2647
3176
|
settleViewability();
|
|
2648
3177
|
fireNotUsedForUnplayedAds();
|
|
2649
3178
|
clearStallWatchdog();
|
|
@@ -2676,15 +3205,18 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2676
3205
|
},
|
|
2677
3206
|
destroy: function destroy() {
|
|
2678
3207
|
console.log("[HlsAdPlayer] Destroying");
|
|
3208
|
+
if (adPlaying && currentAd && !trackingFired.impression) {
|
|
3209
|
+
logFunnel("stopped_before_start");
|
|
3210
|
+
}
|
|
2679
3211
|
settleViewability();
|
|
2680
3212
|
fireNotUsedForUnplayedAds();
|
|
2681
3213
|
destroyed = true;
|
|
2682
|
-
|
|
3214
|
+
pendingRequestAbortReason = "Ad player destroyed";
|
|
2683
3215
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2684
3216
|
try {
|
|
2685
|
-
for(var _iterator =
|
|
2686
|
-
var
|
|
2687
|
-
|
|
3217
|
+
for(var _iterator = Array.from(pendingVastRequests)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3218
|
+
var controller = _step.value;
|
|
3219
|
+
controller.abort();
|
|
2688
3220
|
}
|
|
2689
3221
|
} catch (err) {
|
|
2690
3222
|
_didIteratorError = true;
|
|
@@ -2700,6 +3232,28 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2700
3232
|
}
|
|
2701
3233
|
}
|
|
2702
3234
|
}
|
|
3235
|
+
pendingVastRequests.clear();
|
|
3236
|
+
clearStallWatchdog();
|
|
3237
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
3238
|
+
try {
|
|
3239
|
+
for(var _iterator1 = pendingTimeouts[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
3240
|
+
var timeoutId = _step1.value;
|
|
3241
|
+
clearTimeout(timeoutId);
|
|
3242
|
+
}
|
|
3243
|
+
} catch (err) {
|
|
3244
|
+
_didIteratorError1 = true;
|
|
3245
|
+
_iteratorError1 = err;
|
|
3246
|
+
} finally{
|
|
3247
|
+
try {
|
|
3248
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
3249
|
+
_iterator1.return();
|
|
3250
|
+
}
|
|
3251
|
+
} finally{
|
|
3252
|
+
if (_didIteratorError1) {
|
|
3253
|
+
throw _iteratorError1;
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
2703
3257
|
pendingTimeouts = [];
|
|
2704
3258
|
adPlaying = false;
|
|
2705
3259
|
setAdPlayingFlag(false);
|
|
@@ -2719,6 +3273,35 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2719
3273
|
isAdPlaying: function isAdPlaying() {
|
|
2720
3274
|
return adPlaying;
|
|
2721
3275
|
},
|
|
3276
|
+
setFunnelContext: function setFunnelContext(context) {
|
|
3277
|
+
funnelContext = _object_spread({}, context);
|
|
3278
|
+
},
|
|
3279
|
+
abortPendingRequest: function abortPendingRequest() {
|
|
3280
|
+
var reason = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "VAST request aborted (timeout)";
|
|
3281
|
+
if (pendingVastRequests.size === 0) return;
|
|
3282
|
+
pendingRequestAbortReason = reason;
|
|
3283
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3284
|
+
try {
|
|
3285
|
+
for(var _iterator = Array.from(pendingVastRequests)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3286
|
+
var controller = _step.value;
|
|
3287
|
+
controller.abort();
|
|
3288
|
+
}
|
|
3289
|
+
} catch (err) {
|
|
3290
|
+
_didIteratorError = true;
|
|
3291
|
+
_iteratorError = err;
|
|
3292
|
+
} finally{
|
|
3293
|
+
try {
|
|
3294
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3295
|
+
_iterator.return();
|
|
3296
|
+
}
|
|
3297
|
+
} finally{
|
|
3298
|
+
if (_didIteratorError) {
|
|
3299
|
+
throw _iteratorError;
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
pendingVastRequests.clear();
|
|
3304
|
+
},
|
|
2722
3305
|
resize: function resize(width, height) {
|
|
2723
3306
|
console.log("[HlsAdPlayer] Resizing to ".concat(width, "x").concat(height));
|
|
2724
3307
|
if (adContainerEl) {
|
|
@@ -2754,6 +3337,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2754
3337
|
if (adVideoElement && adPlaying) {
|
|
2755
3338
|
var clamped = Math.max(0, Math.min(1, volume));
|
|
2756
3339
|
adVideoElement.volume = clamped;
|
|
3340
|
+
var userActivation = navigator.userActivation;
|
|
3341
|
+
if (clamped > 0 && forcedMuteByAutoplay && userActivation && !userActivation.isActive) {
|
|
3342
|
+
logFunnel("unmute_blocked_without_gesture", {
|
|
3343
|
+
requestedVolume: clamped
|
|
3344
|
+
});
|
|
3345
|
+
return;
|
|
3346
|
+
}
|
|
2757
3347
|
adVideoElement.muted = clamped === 0;
|
|
2758
3348
|
}
|
|
2759
3349
|
},
|
|
@@ -6817,7 +7407,7 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
6817
7407
|
{
|
|
6818
7408
|
key: "adFitsRemainingBudget",
|
|
6819
7409
|
value: function adFitsRemainingBudget(durationMs) {
|
|
6820
|
-
if (durationMs <= 0) {
|
|
7410
|
+
if (durationMs <= 0 || this.expectedAdBreakDurationMs == null) {
|
|
6821
7411
|
return true;
|
|
6822
7412
|
}
|
|
6823
7413
|
return durationMs <= this.getDurationBudgetRemainingMs();
|
|
@@ -6876,6 +7466,11 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
6876
7466
|
value: function markAdStarted() {
|
|
6877
7467
|
this.currentAdIndex++;
|
|
6878
7468
|
this.totalAdsInBreak = this.currentAdIndex;
|
|
7469
|
+
}
|
|
7470
|
+
},
|
|
7471
|
+
{
|
|
7472
|
+
key: "noteAdRequestSent",
|
|
7473
|
+
value: function noteAdRequestSent() {
|
|
6879
7474
|
this.totalAdRequestsInBreak++;
|
|
6880
7475
|
this.lastAdRequestTime = Date.now();
|
|
6881
7476
|
}
|
|
@@ -6927,6 +7522,9 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
6927
7522
|
if (message.includes("timeout")) {
|
|
6928
7523
|
return true;
|
|
6929
7524
|
}
|
|
7525
|
+
if (message.includes("ad player destroyed") || message.includes("aborted")) {
|
|
7526
|
+
return true;
|
|
7527
|
+
}
|
|
6930
7528
|
if (message.includes("rate limit") || message.includes("too many requests")) {
|
|
6931
7529
|
return true;
|
|
6932
7530
|
}
|
|
@@ -8060,6 +8658,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8060
8658
|
this.adDetectSentForCurrentBreak = false;
|
|
8061
8659
|
this.continuousFetchingActive = false;
|
|
8062
8660
|
this.continuousFetchLoopRunning = false;
|
|
8661
|
+
this.breakFunnel = {};
|
|
8662
|
+
this.controllerCallInFlight = false;
|
|
8663
|
+
this.playbackStartedForCurrentRequest = false;
|
|
8664
|
+
this.opportunityEpoch = -1;
|
|
8063
8665
|
this.adRequestQueue = [];
|
|
8064
8666
|
this.adPodQueue = [];
|
|
8065
8667
|
this.maxPlaceholderDurationMs = 5e3;
|
|
@@ -8112,12 +8714,35 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8112
8714
|
adPlayer.on("ad_interaction", function(event) {
|
|
8113
8715
|
if (event) _this.host.onAdInteraction(event);
|
|
8114
8716
|
});
|
|
8115
|
-
adPlayer.on("
|
|
8116
|
-
|
|
8717
|
+
adPlayer.on("ad_funnel", function(payload) {
|
|
8718
|
+
if (!(payload === null || payload === void 0 ? void 0 : payload.stage)) return;
|
|
8719
|
+
_this.countFunnelStage(payload.stage);
|
|
8720
|
+
if (payload.reason) {
|
|
8721
|
+
_this.countFunnelStage("".concat(payload.stage, ":").concat(payload.reason));
|
|
8722
|
+
}
|
|
8723
|
+
if (payload.stage === "impression_fired" && payload.pixelCount != null) {
|
|
8724
|
+
_this.countFunnelStage("impression_urls", payload.pixelCount);
|
|
8725
|
+
}
|
|
8726
|
+
if (payload.visibilityState === "hidden") {
|
|
8727
|
+
_this.countFunnelStage("while_hidden");
|
|
8728
|
+
}
|
|
8729
|
+
});
|
|
8730
|
+
adPlayer.on("ad_impression", function() {
|
|
8731
|
+
_this.timing.consecutiveFailures = 0;
|
|
8732
|
+
if (!_this.playbackStartedForCurrentRequest) {
|
|
8733
|
+
_this.playbackStartedForCurrentRequest = true;
|
|
8734
|
+
_this.timing.markAdStarted();
|
|
8735
|
+
}
|
|
8736
|
+
sendAdImpressionTracking(_this.host.config.licenseKey, _object_spread_props(_object_spread({
|
|
8117
8737
|
source: "hls",
|
|
8118
|
-
adIndex: _this.timing.currentAdIndex
|
|
8738
|
+
adIndex: _this.timing.currentAdIndex
|
|
8739
|
+
}, _this.currentVastUrl ? {
|
|
8740
|
+
adUrl: _this.currentVastUrl
|
|
8741
|
+
} : {}), {
|
|
8119
8742
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
8120
|
-
}, _this.analyticsContext).catch(function() {});
|
|
8743
|
+
}), _this.analyticsContext).catch(function() {});
|
|
8744
|
+
});
|
|
8745
|
+
adPlayer.on("all_ads_completed", function() {
|
|
8121
8746
|
_this.timing.recordPlayedAdDuration(_this.host.getAdPlayer());
|
|
8122
8747
|
var remaining = _this.timing.getRemainingAdMs();
|
|
8123
8748
|
_this.timing.consecutiveFailures = 0;
|
|
@@ -8151,6 +8776,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8151
8776
|
}
|
|
8152
8777
|
}
|
|
8153
8778
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
8779
|
+
if (_this.controllerCallInFlight) {
|
|
8780
|
+
_this.timing.recordGamNoFill();
|
|
8781
|
+
return;
|
|
8782
|
+
}
|
|
8154
8783
|
_this.handleAdFailure();
|
|
8155
8784
|
});
|
|
8156
8785
|
adPlayer.on("content_pause", function() {
|
|
@@ -8175,11 +8804,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8175
8804
|
}
|
|
8176
8805
|
});
|
|
8177
8806
|
adPlayer.on("content_resume", function() {
|
|
8178
|
-
sendAdImpressionTracking(_this.host.config.licenseKey, {
|
|
8179
|
-
source: "hls",
|
|
8180
|
-
adIndex: _this.timing.currentAdIndex,
|
|
8181
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
8182
|
-
}, _this.analyticsContext).catch(function() {});
|
|
8183
8807
|
if (!_this.host.video.muted) {
|
|
8184
8808
|
_this.host.video.muted = true;
|
|
8185
8809
|
if (_this.debug) {
|
|
@@ -8227,6 +8851,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8227
8851
|
}
|
|
8228
8852
|
var preservedMutedState = adPlayer.getOriginalMutedState();
|
|
8229
8853
|
var preservedVolumeState = adPlayer.getOriginalVolume();
|
|
8854
|
+
this.playbackStartedForCurrentRequest = false;
|
|
8230
8855
|
if (adPlayer) {
|
|
8231
8856
|
try {
|
|
8232
8857
|
adPlayer.destroy();
|
|
@@ -8316,9 +8941,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8316
8941
|
if (this.timing.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
|
|
8317
8942
|
this.timing.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
8318
8943
|
}
|
|
8944
|
+
this.noteOpportunity("scte35", this.cueManager.activeScte35BreakKey);
|
|
8319
8945
|
return [
|
|
8320
8946
|
4,
|
|
8321
|
-
this.startOptimizedPod(baseVastUrl, adBreakDurationMs
|
|
8947
|
+
this.startOptimizedPod(baseVastUrl, adBreakDurationMs)
|
|
8322
8948
|
];
|
|
8323
8949
|
case 1:
|
|
8324
8950
|
podPlayed = _state.sent();
|
|
@@ -8352,7 +8978,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8352
8978
|
value: // ───────────────────────────────────────────────────────────────
|
|
8353
8979
|
// Optimized pod (single multi-ad request)
|
|
8354
8980
|
// ───────────────────────────────────────────────────────────────
|
|
8355
|
-
function startOptimizedPod(baseVastUrl, breakDurationMs
|
|
8981
|
+
function startOptimizedPod(baseVastUrl, breakDurationMs) {
|
|
8356
8982
|
return _async_to_generator(function() {
|
|
8357
8983
|
var podUrl, adPlayer, requestToken, _ref, _adPlayer_getPodAdCount, podCount, error;
|
|
8358
8984
|
return _ts_generator(this, function(_state) {
|
|
@@ -8375,7 +9001,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8375
9001
|
adPlayer = this.host.getAdPlayer();
|
|
8376
9002
|
requestToken = ++this.timing.adRequestTokenCounter;
|
|
8377
9003
|
this.timing.activeAdRequestToken = requestToken;
|
|
8378
|
-
this.
|
|
9004
|
+
this.currentVastUrl = podUrl;
|
|
8379
9005
|
_state.label = 1;
|
|
8380
9006
|
case 1:
|
|
8381
9007
|
_state.trys.push([
|
|
@@ -8390,10 +9016,14 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8390
9016
|
];
|
|
8391
9017
|
case 2:
|
|
8392
9018
|
_state.sent();
|
|
8393
|
-
this.timing.
|
|
9019
|
+
this.timing.startAdRequestWatchdog(requestToken);
|
|
9020
|
+
this.timing.noteAdRequestSent();
|
|
9021
|
+
this.beginFunnelRequest(adPlayer, requestToken);
|
|
8394
9022
|
return [
|
|
8395
9023
|
4,
|
|
8396
|
-
|
|
9024
|
+
this.callController(function() {
|
|
9025
|
+
return adPlayer.requestAds(podUrl);
|
|
9026
|
+
})
|
|
8397
9027
|
];
|
|
8398
9028
|
case 3:
|
|
8399
9029
|
_state.sent();
|
|
@@ -8422,16 +9052,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8422
9052
|
this.timing.startAdFailsafeTimer(requestToken);
|
|
8423
9053
|
return [
|
|
8424
9054
|
4,
|
|
8425
|
-
|
|
9055
|
+
this.callController(function() {
|
|
9056
|
+
return adPlayer.play();
|
|
9057
|
+
})
|
|
8426
9058
|
];
|
|
8427
9059
|
case 4:
|
|
8428
9060
|
_state.sent();
|
|
8429
|
-
this.timing.markAdStarted();
|
|
8430
9061
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
8431
9062
|
this.timing.scheduleAdStopAtBreakBoundary();
|
|
8432
9063
|
}
|
|
8433
|
-
adPlayer.setAdVolume(
|
|
8434
|
-
this.timing.consecutiveFailures = 0;
|
|
9064
|
+
adPlayer.setAdVolume(getAdAudioVolume(adPlayer));
|
|
8435
9065
|
this.continuousFetchingActive = true;
|
|
8436
9066
|
this.startContinuousFetching(baseVastUrl);
|
|
8437
9067
|
return [
|
|
@@ -8796,7 +9426,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8796
9426
|
];
|
|
8797
9427
|
case 3:
|
|
8798
9428
|
_state.sent();
|
|
8799
|
-
this.timing.consecutiveFailures = 0;
|
|
8800
9429
|
return [
|
|
8801
9430
|
3,
|
|
8802
9431
|
8
|
|
@@ -8809,6 +9438,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8809
9438
|
3,
|
|
8810
9439
|
6
|
|
8811
9440
|
];
|
|
9441
|
+
this.timing.consecutiveFailures++;
|
|
8812
9442
|
return [
|
|
8813
9443
|
4,
|
|
8814
9444
|
this.tryNextAvailableAdWithRateLimit()
|
|
@@ -8878,13 +9508,159 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8878
9508
|
}
|
|
8879
9509
|
},
|
|
8880
9510
|
{
|
|
8881
|
-
|
|
8882
|
-
value: // ───────────────────────────────────────────────────────────────
|
|
9511
|
+
// ───────────────────────────────────────────────────────────────
|
|
8883
9512
|
// Single ad playback
|
|
8884
9513
|
// ───────────────────────────────────────────────────────────────
|
|
8885
|
-
|
|
9514
|
+
key: "withCurrentPodBudget",
|
|
9515
|
+
value: function withCurrentPodBudget(vastTagUrl) {
|
|
9516
|
+
var remaining = Math.min(this.timing.getWallClockRemainingAdMs(), this.timing.getDurationBudgetRemainingMs());
|
|
9517
|
+
if (!(remaining > 0)) return vastTagUrl;
|
|
9518
|
+
try {
|
|
9519
|
+
var url = new URL(vastTagUrl);
|
|
9520
|
+
if (!url.searchParams.has("pmxd")) return vastTagUrl;
|
|
9521
|
+
var maxMs = Math.round(remaining);
|
|
9522
|
+
url.searchParams.set("pmxd", String(maxMs));
|
|
9523
|
+
var minMs = Number(url.searchParams.get("pmnd"));
|
|
9524
|
+
if (Number.isFinite(minMs) && minMs > maxMs) {
|
|
9525
|
+
url.searchParams.set("pmnd", String(maxMs));
|
|
9526
|
+
}
|
|
9527
|
+
return url.toString();
|
|
9528
|
+
} catch (unused) {
|
|
9529
|
+
return vastTagUrl;
|
|
9530
|
+
}
|
|
9531
|
+
}
|
|
9532
|
+
},
|
|
9533
|
+
{
|
|
9534
|
+
key: "countFunnelStage",
|
|
9535
|
+
value: function countFunnelStage(stage) {
|
|
9536
|
+
var amount = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
9537
|
+
var _this_breakFunnel_stage;
|
|
9538
|
+
this.breakFunnel[stage] = ((_this_breakFunnel_stage = this.breakFunnel[stage]) !== null && _this_breakFunnel_stage !== void 0 ? _this_breakFunnel_stage : 0) + amount;
|
|
9539
|
+
}
|
|
9540
|
+
},
|
|
9541
|
+
{
|
|
9542
|
+
key: "logOrchestratorFunnel",
|
|
9543
|
+
value: function logOrchestratorFunnel(stage) {
|
|
9544
|
+
var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
9545
|
+
this.countFunnelStage(stage);
|
|
9546
|
+
console.log("[AdBreak][FUNNEL] ".concat(stage), _object_spread({
|
|
9547
|
+
breakId: this.timing.adBreakEpoch,
|
|
9548
|
+
requestId: this.currentRequestId,
|
|
9549
|
+
visibilityState: typeof document !== "undefined" ? document.visibilityState : void 0
|
|
9550
|
+
}, extra));
|
|
9551
|
+
}
|
|
9552
|
+
},
|
|
9553
|
+
{
|
|
9554
|
+
key: "noteOpportunity",
|
|
9555
|
+
value: function noteOpportunity(source, breakKey) {
|
|
9556
|
+
if (breakKey && breakKey === this.opportunityBreakKey && this.opportunityEpoch === this.timing.adBreakEpoch) {
|
|
9557
|
+
this.logOrchestratorFunnel("duplicate_break_start", {
|
|
9558
|
+
source: source,
|
|
9559
|
+
breakKey: breakKey
|
|
9560
|
+
});
|
|
9561
|
+
return;
|
|
9562
|
+
}
|
|
9563
|
+
this.opportunityBreakKey = breakKey;
|
|
9564
|
+
this.opportunityEpoch = this.timing.adBreakEpoch;
|
|
9565
|
+
this.logOrchestratorFunnel("opportunity_created", {
|
|
9566
|
+
source: source,
|
|
9567
|
+
breakKey: breakKey,
|
|
9568
|
+
expectedDurationMs: this.timing.expectedAdBreakDurationMs
|
|
9569
|
+
});
|
|
9570
|
+
}
|
|
9571
|
+
},
|
|
9572
|
+
{
|
|
9573
|
+
key: "beginFunnelRequest",
|
|
9574
|
+
value: function beginFunnelRequest(adPlayer, requestToken) {
|
|
9575
|
+
var _adPlayer_setFunnelContext;
|
|
9576
|
+
if (this.controllerCallInFlight) {
|
|
9577
|
+
this.logOrchestratorFunnel("duplicate_request_detected", {
|
|
9578
|
+
newRequestId: requestToken
|
|
9579
|
+
});
|
|
9580
|
+
}
|
|
9581
|
+
this.currentRequestId = requestToken;
|
|
9582
|
+
this.requestStartedAt = Date.now();
|
|
9583
|
+
(_adPlayer_setFunnelContext = adPlayer.setFunnelContext) === null || _adPlayer_setFunnelContext === void 0 ? void 0 : _adPlayer_setFunnelContext.call(adPlayer, {
|
|
9584
|
+
breakId: this.timing.adBreakEpoch,
|
|
9585
|
+
requestId: requestToken
|
|
9586
|
+
});
|
|
9587
|
+
}
|
|
9588
|
+
},
|
|
9589
|
+
{
|
|
9590
|
+
key: "isAdLoadingWithoutPlayback",
|
|
9591
|
+
value: function isAdLoadingWithoutPlayback() {
|
|
9592
|
+
return this.host.getAdPlayer().isAdPlaying() && !this.playbackStartedForCurrentRequest;
|
|
9593
|
+
}
|
|
9594
|
+
},
|
|
9595
|
+
{
|
|
9596
|
+
key: "noteStopBeforeStart",
|
|
9597
|
+
value: function noteStopBeforeStart(reason) {
|
|
9598
|
+
if (!this.isAdLoadingWithoutPlayback()) return;
|
|
9599
|
+
this.logOrchestratorFunnel("ad_stopped_before_start", {
|
|
9600
|
+
reason: reason,
|
|
9601
|
+
elapsedSinceRequestMs: this.requestStartedAt != null ? Date.now() - this.requestStartedAt : void 0
|
|
9602
|
+
});
|
|
9603
|
+
}
|
|
9604
|
+
},
|
|
9605
|
+
{
|
|
9606
|
+
key: "handleRequestWatchdogTimeout",
|
|
9607
|
+
value: function handleRequestWatchdogTimeout() {
|
|
9608
|
+
var adPlayer = this.host.getAdPlayer();
|
|
9609
|
+
if (this.controllerCallInFlight && adPlayer.abortPendingRequest) {
|
|
9610
|
+
this.logOrchestratorFunnel("request_aborted_timeout", {
|
|
9611
|
+
elapsedSinceRequestMs: this.requestStartedAt != null ? Date.now() - this.requestStartedAt : void 0
|
|
9612
|
+
});
|
|
9613
|
+
adPlayer.abortPendingRequest("VAST request aborted after request watchdog timeout");
|
|
9614
|
+
return;
|
|
9615
|
+
}
|
|
9616
|
+
this.handleAdFailure();
|
|
9617
|
+
}
|
|
9618
|
+
},
|
|
9619
|
+
{
|
|
9620
|
+
key: "callController",
|
|
9621
|
+
value: function callController(call) {
|
|
8886
9622
|
return _async_to_generator(function() {
|
|
8887
|
-
|
|
9623
|
+
return _ts_generator(this, function(_state) {
|
|
9624
|
+
switch(_state.label){
|
|
9625
|
+
case 0:
|
|
9626
|
+
this.controllerCallInFlight = true;
|
|
9627
|
+
_state.label = 1;
|
|
9628
|
+
case 1:
|
|
9629
|
+
_state.trys.push([
|
|
9630
|
+
1,
|
|
9631
|
+
,
|
|
9632
|
+
3,
|
|
9633
|
+
4
|
|
9634
|
+
]);
|
|
9635
|
+
return [
|
|
9636
|
+
4,
|
|
9637
|
+
call()
|
|
9638
|
+
];
|
|
9639
|
+
case 2:
|
|
9640
|
+
_state.sent();
|
|
9641
|
+
return [
|
|
9642
|
+
3,
|
|
9643
|
+
4
|
|
9644
|
+
];
|
|
9645
|
+
case 3:
|
|
9646
|
+
this.controllerCallInFlight = false;
|
|
9647
|
+
return [
|
|
9648
|
+
7
|
|
9649
|
+
];
|
|
9650
|
+
case 4:
|
|
9651
|
+
return [
|
|
9652
|
+
2
|
|
9653
|
+
];
|
|
9654
|
+
}
|
|
9655
|
+
});
|
|
9656
|
+
}).call(this);
|
|
9657
|
+
}
|
|
9658
|
+
},
|
|
9659
|
+
{
|
|
9660
|
+
key: "playSingleAd",
|
|
9661
|
+
value: function playSingleAd(vastTagUrl) {
|
|
9662
|
+
return _async_to_generator(function() {
|
|
9663
|
+
var adPlayer, requestToken, ap, requestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, playError, error, errorMessage;
|
|
8888
9664
|
return _ts_generator(this, function(_state) {
|
|
8889
9665
|
switch(_state.label){
|
|
8890
9666
|
case 0:
|
|
@@ -8911,7 +9687,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8911
9687
|
this.recreateAdController();
|
|
8912
9688
|
requestToken = ++this.timing.adRequestTokenCounter;
|
|
8913
9689
|
this.timing.activeAdRequestToken = requestToken;
|
|
8914
|
-
this.timing.startAdRequestWatchdog(requestToken);
|
|
8915
9690
|
_state.label = 1;
|
|
8916
9691
|
case 1:
|
|
8917
9692
|
_state.trys.push([
|
|
@@ -8926,17 +9701,23 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8926
9701
|
];
|
|
8927
9702
|
case 2:
|
|
8928
9703
|
_state.sent();
|
|
8929
|
-
this.timing.
|
|
9704
|
+
this.timing.startAdRequestWatchdog(requestToken);
|
|
9705
|
+
this.timing.noteAdRequestSent();
|
|
8930
9706
|
ap = this.host.getAdPlayer();
|
|
9707
|
+
requestUrl = this.withCurrentPodBudget(vastTagUrl);
|
|
9708
|
+
this.currentVastUrl = requestUrl;
|
|
9709
|
+
this.beginFunnelRequest(ap, requestToken);
|
|
8931
9710
|
return [
|
|
8932
9711
|
4,
|
|
8933
|
-
|
|
9712
|
+
this.callController(function() {
|
|
9713
|
+
return ap.requestAds(requestUrl);
|
|
9714
|
+
})
|
|
8934
9715
|
];
|
|
8935
9716
|
case 3:
|
|
8936
9717
|
_state.sent();
|
|
8937
9718
|
sendAdLoadedTracking(this.host.config.licenseKey, {
|
|
8938
9719
|
source: "hls",
|
|
8939
|
-
vastUrl:
|
|
9720
|
+
vastUrl: requestUrl,
|
|
8940
9721
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
8941
9722
|
}, this.analyticsContext).catch(function() {});
|
|
8942
9723
|
this.timing.clearAdRequestWatchdog();
|
|
@@ -8944,6 +9725,14 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8944
9725
|
2
|
|
8945
9726
|
];
|
|
8946
9727
|
if (!this.timing.ensureLoadedAdFitsBudget(ap)) {
|
|
9728
|
+
;
|
|
9729
|
+
adDurationS = (_ap_getLoadedAdDuration = ap.getLoadedAdDuration) === null || _ap_getLoadedAdDuration === void 0 ? void 0 : _ap_getLoadedAdDuration.call(ap);
|
|
9730
|
+
remainingMs = Math.min(this.timing.getWallClockRemainingAdMs(), this.timing.getDurationBudgetRemainingMs());
|
|
9731
|
+
this.logOrchestratorFunnel("discarded_budget", {
|
|
9732
|
+
vastUrl: requestUrl,
|
|
9733
|
+
adDurationMs: adDurationS != null ? adDurationS * 1e3 : void 0,
|
|
9734
|
+
remainingMs: remainingMs
|
|
9735
|
+
});
|
|
8947
9736
|
this.timing.rejectLoadedAdForDuration(ap);
|
|
8948
9737
|
this.recreateAdController();
|
|
8949
9738
|
throw new Error("ad_duration_exceeds_budget");
|
|
@@ -8959,16 +9748,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8959
9748
|
this.timing.startAdFailsafeTimer(requestToken);
|
|
8960
9749
|
return [
|
|
8961
9750
|
4,
|
|
8962
|
-
|
|
9751
|
+
this.callController(function() {
|
|
9752
|
+
return ap.play();
|
|
9753
|
+
})
|
|
8963
9754
|
];
|
|
8964
9755
|
case 5:
|
|
8965
9756
|
_state.sent();
|
|
8966
|
-
this.timing.markAdStarted();
|
|
8967
9757
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
8968
9758
|
this.timing.scheduleAdStopAtBreakBoundary();
|
|
8969
9759
|
}
|
|
8970
9760
|
ap.setAdVolume(getAdAudioVolume(ap));
|
|
8971
|
-
this.timing.consecutiveFailures = 0;
|
|
8972
9761
|
this.timing.temporaryFailureUrls.delete(vastTagUrl);
|
|
8973
9762
|
return [
|
|
8974
9763
|
3,
|
|
@@ -9132,7 +9921,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9132
9921
|
];
|
|
9133
9922
|
case 5:
|
|
9134
9923
|
_state.sent();
|
|
9135
|
-
this.timing.consecutiveFailures = 0;
|
|
9136
9924
|
return [
|
|
9137
9925
|
3,
|
|
9138
9926
|
10
|
|
@@ -9144,6 +9932,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9144
9932
|
3,
|
|
9145
9933
|
8
|
|
9146
9934
|
];
|
|
9935
|
+
this.timing.consecutiveFailures++;
|
|
9147
9936
|
return [
|
|
9148
9937
|
4,
|
|
9149
9938
|
this.tryNextAvailableAdWithRateLimit()
|
|
@@ -9194,6 +9983,67 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9194
9983
|
// ───────────────────────────────────────────────────────────────
|
|
9195
9984
|
// Ad break completion
|
|
9196
9985
|
// ───────────────────────────────────────────────────────────────
|
|
9986
|
+
key: "logBreakFunnel",
|
|
9987
|
+
value: function logBreakFunnel() {
|
|
9988
|
+
var funnel = this.breakFunnel;
|
|
9989
|
+
this.breakFunnel = {};
|
|
9990
|
+
if (Object.keys(funnel).length === 0) return;
|
|
9991
|
+
var count = function count(stage) {
|
|
9992
|
+
var _funnel_stage;
|
|
9993
|
+
return (_funnel_stage = funnel[stage]) !== null && _funnel_stage !== void 0 ? _funnel_stage : 0;
|
|
9994
|
+
};
|
|
9995
|
+
var breakId = this.opportunityEpoch;
|
|
9996
|
+
if (count("request_sent") > 0 && count("impression_fired") === 0) {
|
|
9997
|
+
console.log("[AdBreak][FUNNEL] break_abandoned_before_start", {
|
|
9998
|
+
breakId: breakId,
|
|
9999
|
+
requests: count("request_sent")
|
|
10000
|
+
});
|
|
10001
|
+
}
|
|
10002
|
+
console.log("[AdBreak][FUNNEL] Break summary", {
|
|
10003
|
+
breakId: breakId,
|
|
10004
|
+
opportunities: count("opportunity_created"),
|
|
10005
|
+
requests: count("request_sent"),
|
|
10006
|
+
duplicates: count("duplicate_request_detected") + count("duplicate_break_start"),
|
|
10007
|
+
filled: count("vast_received"),
|
|
10008
|
+
noFill: count("no_fill"),
|
|
10009
|
+
requestFailed: count("request_failed"),
|
|
10010
|
+
requestAbortedTimeout: count("request_aborted_timeout"),
|
|
10011
|
+
credentialsRetries: count("vast_credentials_retry"),
|
|
10012
|
+
wrapperFailures: count("wrapper_fetch:failure"),
|
|
10013
|
+
noSupportedMedia: count("vast_no_supported_media"),
|
|
10014
|
+
vpaidOnly: count("vast_no_supported_media:vpaid_only"),
|
|
10015
|
+
missingImpression: count("vast_missing_impression"),
|
|
10016
|
+
discardedBudget: count("discarded_budget"),
|
|
10017
|
+
mediaCandidates: count("media_candidate:accepted") + count("media_candidate:rejected"),
|
|
10018
|
+
mediaRejected: count("media_candidate:rejected"),
|
|
10019
|
+
mediaFallbacks: count("media_fallback"),
|
|
10020
|
+
playCalled: count("play_called"),
|
|
10021
|
+
playRejected: count("play_rejected"),
|
|
10022
|
+
mutedRetry: count("muted_retry"),
|
|
10023
|
+
startTimeouts: count("play_resolved_but_never_started"),
|
|
10024
|
+
impressions: count("impression_fired"),
|
|
10025
|
+
impressionUrls: count("impression_urls"),
|
|
10026
|
+
trackingRequests: count("tracking_request_created"),
|
|
10027
|
+
trackingNotLoaded: count("tracking_request_settled:error") + count("tracking_request_settled:timeout"),
|
|
10028
|
+
trackingUnexpandedMacros: count("tracking_url_unexpanded_macro"),
|
|
10029
|
+
trackingInvalidUrls: count("tracking_url_invalid"),
|
|
10030
|
+
vastAdFallbacks: count("vast_ad_fallback"),
|
|
10031
|
+
mediaEvents: count("media_event"),
|
|
10032
|
+
quartile25: count("first_quartile"),
|
|
10033
|
+
quartile50: count("midpoint"),
|
|
10034
|
+
quartile75: count("third_quartile"),
|
|
10035
|
+
complete: count("complete"),
|
|
10036
|
+
stoppedBeforeStart: count("stopped_before_start"),
|
|
10037
|
+
stoppedBeforeStartByBreakEnd: count("ad_stopped_before_start"),
|
|
10038
|
+
unexpectedUnmutes: count("unexpected_unmute"),
|
|
10039
|
+
unmuteBlocked: count("unmute_blocked_without_gesture"),
|
|
10040
|
+
visibilityHidden: count("while_hidden"),
|
|
10041
|
+
playbackFailures: count("play_failed") + count("media_error") + count("hls_fatal") + count("stall") + count("decode_failure") + count("media_unsupported"),
|
|
10042
|
+
stages: funnel
|
|
10043
|
+
});
|
|
10044
|
+
}
|
|
10045
|
+
},
|
|
10046
|
+
{
|
|
9197
10047
|
key: "handleAdPodComplete",
|
|
9198
10048
|
value: function handleAdPodComplete() {
|
|
9199
10049
|
if (this.debug) {
|
|
@@ -9214,6 +10064,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9214
10064
|
this.adPodQueue = [];
|
|
9215
10065
|
this.showAds = false;
|
|
9216
10066
|
this.host.getAdPlayer().stop().catch(function() {});
|
|
10067
|
+
this.logBreakFunnel();
|
|
9217
10068
|
var restoredMuted = this.host.getAdPlayer().getOriginalMutedState();
|
|
9218
10069
|
var restoredVolume = this.host.getAdPlayer().getOriginalVolume();
|
|
9219
10070
|
if (this.host.video.muted !== restoredMuted) {
|
|
@@ -9565,7 +10416,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9565
10416
|
_this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : _this.timing.expectedAdBreakDurationMs);
|
|
9566
10417
|
},
|
|
9567
10418
|
onWatchdogTimeout: function onWatchdogTimeout() {
|
|
9568
|
-
return _this.adBreak.
|
|
10419
|
+
return _this.adBreak.handleRequestWatchdogTimeout();
|
|
9569
10420
|
},
|
|
9570
10421
|
onFailsafeTimeout: function onFailsafeTimeout() {
|
|
9571
10422
|
return _this.adBreak.handleAdFailure();
|
|
@@ -9670,6 +10521,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9670
10521
|
licenseKey: this.config.licenseKey
|
|
9671
10522
|
} : {}, ((_this_hlsEngine = this.hlsEngine) === null || _this_hlsEngine === void 0 ? void 0 : _this_hlsEngine.hls) ? {
|
|
9672
10523
|
mainHlsInstance: this.hlsEngine.hls
|
|
10524
|
+
} : {}, this.config.adMediaStartTimeoutMs != null ? {
|
|
10525
|
+
mediaStartTimeoutMs: this.config.adMediaStartTimeoutMs
|
|
9673
10526
|
} : {}));
|
|
9674
10527
|
}
|
|
9675
10528
|
},
|
|
@@ -10024,6 +10877,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
10024
10877
|
this.timing.clearAdStartTimer();
|
|
10025
10878
|
this.timing.clearAdStopTimer();
|
|
10026
10879
|
if (adPlaying) {
|
|
10880
|
+
this.adBreak.noteStopBeforeStart("scte_end");
|
|
10027
10881
|
this.adPlayer.stop().catch(function() {});
|
|
10028
10882
|
}
|
|
10029
10883
|
this.adBreak.handleAdPodComplete();
|
|
@@ -10063,6 +10917,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
10063
10917
|
console.log("[StormcloudVideoPlayer] Ad break boundary reached (overrun=".concat(overrunMs, "ms) - hard-stopping ads and resuming stream"));
|
|
10064
10918
|
}
|
|
10065
10919
|
if (adPlaying) {
|
|
10920
|
+
this.adBreak.noteStopBeforeStart("break_boundary");
|
|
10066
10921
|
this.adPlayer.stop().catch(function() {});
|
|
10067
10922
|
}
|
|
10068
10923
|
this.adBreak.handleAdPodComplete();
|
|
@@ -10191,6 +11046,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
10191
11046
|
this.adBreak.showAds = true;
|
|
10192
11047
|
this.adBreak.inAdBreak = true;
|
|
10193
11048
|
this.timing.currentAdBreakStartWallClockMs = Date.now();
|
|
11049
|
+
if (durationMs > 0) {
|
|
11050
|
+
this.timing.setAdBreakDurationBoundary(durationMs);
|
|
11051
|
+
}
|
|
11052
|
+
this.adBreak.noteOpportunity("vmap", key);
|
|
10194
11053
|
_state.label = 1;
|
|
10195
11054
|
case 1:
|
|
10196
11055
|
_state.trys.push([
|