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
package/lib/index.cjs
CHANGED
|
@@ -933,6 +933,7 @@ function parseProgressOffset(offset) {
|
|
|
933
933
|
} : void 0;
|
|
934
934
|
}
|
|
935
935
|
var MAX_VAST_WRAPPER_DEPTH = 5;
|
|
936
|
+
var VAST_REQUEST_TIMEOUT_MS = 5e3;
|
|
936
937
|
var BEACON_TIMEOUT_MS = 3e4;
|
|
937
938
|
var inFlightBeacons = /* @__PURE__ */ new Set();
|
|
938
939
|
var VAST_ERROR_MEDIA_DISPLAY = 405;
|
|
@@ -956,7 +957,7 @@ function toVastMediaErrorCode(error) {
|
|
|
956
957
|
}
|
|
957
958
|
}
|
|
958
959
|
function createHlsAdPlayer(contentVideo, options) {
|
|
959
|
-
var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP;
|
|
960
|
+
var _contentVideo_AD_VIDEO_PROP, _contentVideo_AD_CONTAINER_PROP, _ref;
|
|
960
961
|
var adPlaying = false;
|
|
961
962
|
var originalMutedState = false;
|
|
962
963
|
var originalVolume = Math.max(0, Math.min(1, contentVideo.volume || 1));
|
|
@@ -988,6 +989,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
988
989
|
var sawDecodedVideoFrame = false;
|
|
989
990
|
var videoFrameCallbackHandle;
|
|
990
991
|
var pendingPlayPromise;
|
|
992
|
+
var currentVastTagUrl;
|
|
993
|
+
var funnelContext = {};
|
|
994
|
+
var mediaCandidates = [];
|
|
995
|
+
var mediaCandidateIndex = 0;
|
|
996
|
+
var mediaStartTimerId;
|
|
997
|
+
var MEDIA_START_TIMEOUT_MS = (_ref = options === null || options === void 0 ? void 0 : options.mediaStartTimeoutMs) !== null && _ref !== void 0 ? _ref : 8e3;
|
|
998
|
+
var VAST_ERROR_MEDIA_TIMEOUT = 402;
|
|
999
|
+
var pendingVastRequests = /* @__PURE__ */ new Set();
|
|
1000
|
+
var pendingRequestAbortReason;
|
|
1001
|
+
var forcedMuteByAutoplay = false;
|
|
991
1002
|
function createTrackingState() {
|
|
992
1003
|
return {
|
|
993
1004
|
impression: false,
|
|
@@ -1038,6 +1049,77 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1038
1049
|
}
|
|
1039
1050
|
}
|
|
1040
1051
|
}
|
|
1052
|
+
var SENSITIVE_URL_PARAMS = /* @__PURE__ */ new Set([
|
|
1053
|
+
"ppid",
|
|
1054
|
+
"rdid",
|
|
1055
|
+
"idtype",
|
|
1056
|
+
"is_lat",
|
|
1057
|
+
"ifa",
|
|
1058
|
+
"idfa",
|
|
1059
|
+
"aaid",
|
|
1060
|
+
"uid",
|
|
1061
|
+
"user_id",
|
|
1062
|
+
"userid",
|
|
1063
|
+
"device_id",
|
|
1064
|
+
"deviceid",
|
|
1065
|
+
"ip",
|
|
1066
|
+
"ua",
|
|
1067
|
+
"gdpr_consent",
|
|
1068
|
+
"us_privacy",
|
|
1069
|
+
"gpp",
|
|
1070
|
+
"addtl_consent",
|
|
1071
|
+
"cust_params",
|
|
1072
|
+
"email"
|
|
1073
|
+
]);
|
|
1074
|
+
function redactUrl(url) {
|
|
1075
|
+
if (!url) return url;
|
|
1076
|
+
try {
|
|
1077
|
+
var parsed = new URL(url);
|
|
1078
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1079
|
+
try {
|
|
1080
|
+
for(var _iterator = Array.from(parsed.searchParams.keys())[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1081
|
+
var key = _step.value;
|
|
1082
|
+
if (SENSITIVE_URL_PARAMS.has(key.toLowerCase())) {
|
|
1083
|
+
parsed.searchParams.set(key, "REDACTED");
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
} catch (err) {
|
|
1087
|
+
_didIteratorError = true;
|
|
1088
|
+
_iteratorError = err;
|
|
1089
|
+
} finally{
|
|
1090
|
+
try {
|
|
1091
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1092
|
+
_iterator.return();
|
|
1093
|
+
}
|
|
1094
|
+
} finally{
|
|
1095
|
+
if (_didIteratorError) {
|
|
1096
|
+
throw _iteratorError;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
return parsed.toString();
|
|
1101
|
+
} catch (unused) {
|
|
1102
|
+
return url.split("?")[0];
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
function logFunnel(stage) {
|
|
1106
|
+
var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1107
|
+
var payload = _object_spread({
|
|
1108
|
+
stage: stage,
|
|
1109
|
+
breakId: funnelContext.breakId,
|
|
1110
|
+
requestId: funnelContext.requestId,
|
|
1111
|
+
visibilityState: typeof document !== "undefined" ? document.visibilityState : void 0,
|
|
1112
|
+
adId: currentAd === null || currentAd === void 0 ? void 0 : currentAd.id,
|
|
1113
|
+
podIndex: podIndex,
|
|
1114
|
+
podSize: podAds.length,
|
|
1115
|
+
vastUrl: redactUrl(currentVastTagUrl),
|
|
1116
|
+
mediaUrl: currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url,
|
|
1117
|
+
mediaType: currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.type,
|
|
1118
|
+
muted: adVideoElement ? adVideoElement.muted : void 0
|
|
1119
|
+
}, extra);
|
|
1120
|
+
console.log("[HlsAdPlayer][FUNNEL] ".concat(stage), payload);
|
|
1121
|
+
emit("ad_funnel", payload);
|
|
1122
|
+
}
|
|
1041
1123
|
function buildTrackingMacroContext() {
|
|
1042
1124
|
var options2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1043
1125
|
var _options2_ad;
|
|
@@ -1077,20 +1159,53 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1077
1159
|
urls.forEach(function(url) {
|
|
1078
1160
|
try {
|
|
1079
1161
|
var trackingUrl = substituteVastTrackingMacros(url, macroContext);
|
|
1162
|
+
var trackingHost;
|
|
1163
|
+
try {
|
|
1164
|
+
trackingHost = new URL(trackingUrl).host;
|
|
1165
|
+
} catch (unused) {
|
|
1166
|
+
logFunnel("tracking_url_invalid", {
|
|
1167
|
+
trackingUrl: redactUrl(trackingUrl)
|
|
1168
|
+
});
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
var unexpanded = trackingUrl.match(/\[[A-Z_]+\]/g);
|
|
1172
|
+
if (unexpanded) {
|
|
1173
|
+
logFunnel("tracking_url_unexpanded_macro", {
|
|
1174
|
+
trackingHost: trackingHost,
|
|
1175
|
+
macros: Array.from(new Set(unexpanded))
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1080
1178
|
var img = new Image(1, 1);
|
|
1081
1179
|
inFlightBeacons.add(img);
|
|
1082
1180
|
var timeoutId;
|
|
1083
|
-
var release = function release() {
|
|
1181
|
+
var release = function release(outcome) {
|
|
1084
1182
|
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
1085
1183
|
img.onload = null;
|
|
1086
1184
|
img.onerror = null;
|
|
1087
1185
|
inFlightBeacons.delete(img);
|
|
1186
|
+
console.log("[HlsAdPlayer] Tracking pixel settled (".concat(outcome, "): ").concat(trackingUrl));
|
|
1187
|
+
if (outcome !== "load") {
|
|
1188
|
+
logFunnel("tracking_request_settled", {
|
|
1189
|
+
reason: outcome,
|
|
1190
|
+
trackingHost: trackingHost
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1088
1193
|
};
|
|
1089
|
-
img.onload =
|
|
1090
|
-
|
|
1091
|
-
|
|
1194
|
+
img.onload = function() {
|
|
1195
|
+
return release("load");
|
|
1196
|
+
};
|
|
1197
|
+
img.onerror = function() {
|
|
1198
|
+
return release("error");
|
|
1199
|
+
};
|
|
1200
|
+
timeoutId = setTimeout(function() {
|
|
1201
|
+
return release("timeout");
|
|
1202
|
+
}, BEACON_TIMEOUT_MS);
|
|
1092
1203
|
img.src = trackingUrl;
|
|
1093
1204
|
console.log("[HlsAdPlayer] Fired tracking pixel: ".concat(trackingUrl));
|
|
1205
|
+
logFunnel("tracking_request_created", {
|
|
1206
|
+
trackingHost: trackingHost,
|
|
1207
|
+
errorCode: options2 === null || options2 === void 0 ? void 0 : options2.errorCode
|
|
1208
|
+
});
|
|
1094
1209
|
} catch (error) {
|
|
1095
1210
|
console.warn("[HlsAdPlayer] Error firing tracking pixel:", error);
|
|
1096
1211
|
}
|
|
@@ -1120,54 +1235,80 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1120
1235
|
bitrate: level.bitrate || 5e6
|
|
1121
1236
|
};
|
|
1122
1237
|
}
|
|
1123
|
-
function
|
|
1124
|
-
if (mediaFiles.length === 0) {
|
|
1125
|
-
throw new Error("No media files available");
|
|
1126
|
-
}
|
|
1127
|
-
var firstFile = mediaFiles[0];
|
|
1128
|
-
if (!firstFile) {
|
|
1129
|
-
throw new Error("No media files available");
|
|
1130
|
-
}
|
|
1131
|
-
if (mediaFiles.length === 1) {
|
|
1132
|
-
return firstFile;
|
|
1133
|
-
}
|
|
1238
|
+
function getMediaTargetQuality() {
|
|
1134
1239
|
var mainQuality = getMainStreamQuality();
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1240
|
+
var dpr = typeof window !== "undefined" && window.devicePixelRatio > 0 ? window.devicePixelRatio : 1;
|
|
1241
|
+
var containerWidth = ((adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.clientWidth) || contentVideo.clientWidth) * dpr;
|
|
1242
|
+
var containerHeight = ((adContainerEl === null || adContainerEl === void 0 ? void 0 : adContainerEl.clientHeight) || contentVideo.clientHeight) * dpr;
|
|
1243
|
+
if (!mainQuality && !(containerWidth > 0 && containerHeight > 0)) {
|
|
1244
|
+
return null;
|
|
1245
|
+
}
|
|
1246
|
+
var base = mainQuality !== null && mainQuality !== void 0 ? mainQuality : {
|
|
1247
|
+
width: containerWidth,
|
|
1248
|
+
height: containerHeight,
|
|
1249
|
+
bitrate: 5e6
|
|
1250
|
+
};
|
|
1251
|
+
var width = containerWidth > 0 ? Math.min(base.width, containerWidth) : base.width;
|
|
1252
|
+
var height = containerHeight > 0 ? Math.min(base.height, containerHeight) : base.height;
|
|
1253
|
+
return {
|
|
1254
|
+
width: width,
|
|
1255
|
+
height: height,
|
|
1256
|
+
bitrate: base.bitrate
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
function rankMediaCandidates(mediaFiles) {
|
|
1260
|
+
var probe = adVideoElement !== null && adVideoElement !== void 0 ? adVideoElement : document.createElement("video");
|
|
1261
|
+
var pageIsHttps = typeof location !== "undefined" && location.protocol === "https:";
|
|
1262
|
+
var target = getMediaTargetQuality();
|
|
1263
|
+
var accepted = [];
|
|
1264
|
+
mediaFiles.forEach(function(file, index) {
|
|
1265
|
+
var isHls = isHlsMediaFile(file);
|
|
1266
|
+
var mimeForProbe = isHls ? "application/vnd.apple.mpegurl" : file.type || "video/mp4";
|
|
1267
|
+
var canPlay2 = probe.canPlayType(mimeForProbe);
|
|
1268
|
+
var playable = isHls ? import_hls.default.isSupported() || canPlay2 !== "" : canPlay2 !== "";
|
|
1269
|
+
var insecure = pageIsHttps && /^http:/i.test(file.url);
|
|
1270
|
+
var details = {
|
|
1271
|
+
index: index,
|
|
1272
|
+
candidateUrl: file.url,
|
|
1273
|
+
candidateType: file.type,
|
|
1274
|
+
width: file.width,
|
|
1275
|
+
height: file.height,
|
|
1276
|
+
bitrate: file.bitrate,
|
|
1277
|
+
canPlayType: canPlay2,
|
|
1278
|
+
hlsJs: isHls ? import_hls.default.isSupported() : void 0
|
|
1279
|
+
};
|
|
1280
|
+
if (!playable) {
|
|
1281
|
+
logFunnel("media_candidate", _object_spread_props(_object_spread({}, details), {
|
|
1282
|
+
reason: "rejected",
|
|
1283
|
+
why: "cannot_play_type"
|
|
1284
|
+
}));
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
var score = 0;
|
|
1288
|
+
if (target) {
|
|
1289
|
+
var resolutionDiff = Math.abs(file.width - target.width) + Math.abs(file.height - target.height);
|
|
1290
|
+
var bitrateDiff = Math.abs((file.bitrate || 5e3) * 1e3 - target.bitrate);
|
|
1291
|
+
score = resolutionDiff * 2 + bitrateDiff / 1e3;
|
|
1292
|
+
}
|
|
1293
|
+
accepted.push({
|
|
1148
1294
|
file: file,
|
|
1149
1295
|
score: score,
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
}
|
|
1296
|
+
insecure: insecure
|
|
1297
|
+
});
|
|
1298
|
+
logFunnel("media_candidate", _object_spread_props(_object_spread({}, details), {
|
|
1299
|
+
reason: "accepted",
|
|
1300
|
+
// Mixed-content media is often auto-upgraded, so it is kept as a last resort.
|
|
1301
|
+
why: insecure ? "insecure_http_deprioritized" : "playable",
|
|
1302
|
+
score: score
|
|
1303
|
+
}));
|
|
1153
1304
|
});
|
|
1154
|
-
|
|
1305
|
+
accepted.sort(function(a, b) {
|
|
1306
|
+
if (a.insecure !== b.insecure) return a.insecure ? 1 : -1;
|
|
1155
1307
|
return a.score - b.score;
|
|
1156
1308
|
});
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
console.log("[HlsAdPlayer] No best match found, using first media file");
|
|
1160
|
-
return firstFile;
|
|
1161
|
-
}
|
|
1162
|
-
console.log("[HlsAdPlayer] Selected media file:", {
|
|
1163
|
-
url: bestMatch.file.url,
|
|
1164
|
-
resolution: "".concat(bestMatch.file.width, "x").concat(bestMatch.file.height),
|
|
1165
|
-
bitrate: bestMatch.file.bitrate,
|
|
1166
|
-
score: bestMatch.score,
|
|
1167
|
-
resolutionDiff: bestMatch.resolutionDiff,
|
|
1168
|
-
bitrateDiff: bestMatch.bitrateDiff
|
|
1309
|
+
return accepted.map(function(entry) {
|
|
1310
|
+
return entry.file;
|
|
1169
1311
|
});
|
|
1170
|
-
return bestMatch.file;
|
|
1171
1312
|
}
|
|
1172
1313
|
function isHlsMediaFile(mediaFile) {
|
|
1173
1314
|
var type = mediaFile.type.toLowerCase();
|
|
@@ -1184,9 +1325,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1184
1325
|
var url = (mediaFile.url.toLowerCase().split("?")[0] || "").trim();
|
|
1185
1326
|
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");
|
|
1186
1327
|
}
|
|
1187
|
-
function collectVideoMediaFiles(linear, verbose) {
|
|
1328
|
+
function collectVideoMediaFiles(linear, verbose, stats) {
|
|
1188
1329
|
var mediaFileElements = linear.querySelectorAll(":scope > MediaFiles > MediaFile");
|
|
1189
1330
|
var mediaFiles = [];
|
|
1331
|
+
if (stats) stats.total += mediaFileElements.length;
|
|
1190
1332
|
if (verbose) {
|
|
1191
1333
|
console.log("[HlsAdPlayer] Found ".concat(mediaFileElements.length, " MediaFile element(s) in VAST XML"));
|
|
1192
1334
|
}
|
|
@@ -1207,6 +1349,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1207
1349
|
}
|
|
1208
1350
|
var apiFramework = (mf.getAttribute("apiFramework") || "").toUpperCase();
|
|
1209
1351
|
if (apiFramework === "VPAID") {
|
|
1352
|
+
if (stats) stats.vpaid++;
|
|
1210
1353
|
if (verbose) {
|
|
1211
1354
|
console.log("[HlsAdPlayer] MediaFile ".concat(index, " ignored (VPAID creatives are not supported)"));
|
|
1212
1355
|
}
|
|
@@ -1222,11 +1365,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1222
1365
|
bitrate: bitrateValue && bitrateValue > 0 ? bitrateValue : void 0
|
|
1223
1366
|
};
|
|
1224
1367
|
if (isAudioMediaFile(mediaFile)) {
|
|
1368
|
+
if (stats) stats.audio++;
|
|
1225
1369
|
console.warn("[HlsAdPlayer] MediaFile ".concat(index, ' skipped (audio-only, type="').concat(type, '") — audio ads are not played to avoid a black screen'));
|
|
1226
1370
|
return;
|
|
1227
1371
|
}
|
|
1228
1372
|
var hasExplicitDimensions = mf.getAttribute("width") != null && mf.getAttribute("height") != null;
|
|
1229
1373
|
if (!isHlsMediaFile(mediaFile) && hasExplicitDimensions && (mediaFile.width <= 1 || mediaFile.height <= 1)) {
|
|
1374
|
+
if (stats) stats.audio++;
|
|
1230
1375
|
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'));
|
|
1231
1376
|
return;
|
|
1232
1377
|
}
|
|
@@ -1235,8 +1380,11 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1235
1380
|
if (verbose) {
|
|
1236
1381
|
console.log("[HlsAdPlayer] Added ".concat(isHlsMediaFile(mediaFile) ? "HLS" : "progressive", " MediaFile: ").concat(url));
|
|
1237
1382
|
}
|
|
1238
|
-
} else
|
|
1239
|
-
|
|
1383
|
+
} else {
|
|
1384
|
+
if (stats) stats.unsupported++;
|
|
1385
|
+
if (verbose) {
|
|
1386
|
+
console.log("[HlsAdPlayer] MediaFile ".concat(index, ' ignored (type="').concat(type, '" is not supported)'));
|
|
1387
|
+
}
|
|
1240
1388
|
}
|
|
1241
1389
|
});
|
|
1242
1390
|
return mediaFiles;
|
|
@@ -1360,26 +1508,58 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1360
1508
|
}
|
|
1361
1509
|
function parseVastXml(xmlString) {
|
|
1362
1510
|
try {
|
|
1363
|
-
var _adElements_find;
|
|
1364
1511
|
var xmlDoc = parseXml(xmlString);
|
|
1365
1512
|
if (!xmlDoc) return {
|
|
1366
1513
|
type: "empty"
|
|
1367
1514
|
};
|
|
1368
1515
|
var root = xmlDoc.documentElement;
|
|
1369
1516
|
var adElements = Array.from(root.querySelectorAll(":scope > Ad"));
|
|
1370
|
-
|
|
1371
|
-
return getAdSequence(el) === void 0;
|
|
1372
|
-
})) !== null && _adElements_find !== void 0 ? _adElements_find : adElements[0];
|
|
1373
|
-
if (!adElement) {
|
|
1517
|
+
if (adElements.length === 0) {
|
|
1374
1518
|
var _root_getAttribute;
|
|
1375
1519
|
console.warn("[HlsAdPlayer] No Ad element found in VAST ".concat((_root_getAttribute = root.getAttribute("version")) !== null && _root_getAttribute !== void 0 ? _root_getAttribute : "", " response"));
|
|
1376
1520
|
return emptyVastResult(root);
|
|
1377
1521
|
}
|
|
1378
|
-
var
|
|
1379
|
-
|
|
1380
|
-
|
|
1522
|
+
var ordered = _to_consumable_array(adElements.filter(function(el) {
|
|
1523
|
+
return getAdSequence(el) === void 0;
|
|
1524
|
+
})).concat(_to_consumable_array(adElements.filter(function(el) {
|
|
1525
|
+
return getAdSequence(el) !== void 0;
|
|
1526
|
+
})));
|
|
1527
|
+
var firstEmpty;
|
|
1528
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1529
|
+
try {
|
|
1530
|
+
for(var _iterator = ordered.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1531
|
+
var _step_value = _sliced_to_array(_step.value, 2), index = _step_value[0], adElement = _step_value[1];
|
|
1532
|
+
var parsed = parseAdElement(adElement, true);
|
|
1533
|
+
if (parsed.type === "empty") {
|
|
1534
|
+
firstEmpty !== null && firstEmpty !== void 0 ? firstEmpty : firstEmpty = parsed;
|
|
1535
|
+
continue;
|
|
1536
|
+
}
|
|
1537
|
+
if (index > 0) {
|
|
1538
|
+
logFunnel("vast_ad_fallback", {
|
|
1539
|
+
usedAdIndex: index,
|
|
1540
|
+
adCount: ordered.length
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
if (parsed.type === "wrapper") {
|
|
1544
|
+
console.log("[HlsAdPlayer] VAST wrapper detected, following VASTAdTagURI: ".concat(parsed.vastAdTagUri));
|
|
1545
|
+
}
|
|
1546
|
+
return parsed;
|
|
1547
|
+
}
|
|
1548
|
+
} catch (err) {
|
|
1549
|
+
_didIteratorError = true;
|
|
1550
|
+
_iteratorError = err;
|
|
1551
|
+
} finally{
|
|
1552
|
+
try {
|
|
1553
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1554
|
+
_iterator.return();
|
|
1555
|
+
}
|
|
1556
|
+
} finally{
|
|
1557
|
+
if (_didIteratorError) {
|
|
1558
|
+
throw _iteratorError;
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1381
1561
|
}
|
|
1382
|
-
return
|
|
1562
|
+
return firstEmpty !== null && firstEmpty !== void 0 ? firstEmpty : emptyVastResult(root);
|
|
1383
1563
|
} catch (error) {
|
|
1384
1564
|
console.error("[HlsAdPlayer] Error parsing VAST XML:", error);
|
|
1385
1565
|
return {
|
|
@@ -1425,6 +1605,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1425
1605
|
pushUrls(errorUrls, inLine.querySelectorAll(":scope > Error"));
|
|
1426
1606
|
if (adElement.getAttribute("conditionalAd") === "true") {
|
|
1427
1607
|
console.warn("[HlsAdPlayer] Skipping conditional <Ad> (VPAID-only)");
|
|
1608
|
+
logFunnel("vast_no_supported_media", {
|
|
1609
|
+
reason: "vpaid_only",
|
|
1610
|
+
conditionalAd: true
|
|
1611
|
+
});
|
|
1428
1612
|
return {
|
|
1429
1613
|
type: "empty",
|
|
1430
1614
|
errorUrls: errorUrls,
|
|
@@ -1433,11 +1617,17 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1433
1617
|
}
|
|
1434
1618
|
var linear;
|
|
1435
1619
|
var mediaFiles = [];
|
|
1620
|
+
var rejectStats = {
|
|
1621
|
+
total: 0,
|
|
1622
|
+
vpaid: 0,
|
|
1623
|
+
audio: 0,
|
|
1624
|
+
unsupported: 0
|
|
1625
|
+
};
|
|
1436
1626
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1437
1627
|
try {
|
|
1438
1628
|
for(var _iterator = Array.from(inLine.querySelectorAll(":scope > Creatives > Creative > Linear"))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1439
1629
|
var candidate = _step.value;
|
|
1440
|
-
var files = collectVideoMediaFiles(candidate, verbose);
|
|
1630
|
+
var files = collectVideoMediaFiles(candidate, verbose, rejectStats);
|
|
1441
1631
|
if (files.length > 0) {
|
|
1442
1632
|
linear = candidate;
|
|
1443
1633
|
mediaFiles = files;
|
|
@@ -1460,6 +1650,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1460
1650
|
}
|
|
1461
1651
|
if (!linear) {
|
|
1462
1652
|
console.warn("[HlsAdPlayer] No supported linear media files in <Ad>");
|
|
1653
|
+
var reason = rejectStats.total === 0 ? "no_mediafiles" : rejectStats.vpaid > 0 ? "vpaid_only" : rejectStats.audio > 0 ? "audio_only" : "unsupported_type";
|
|
1654
|
+
logFunnel("vast_no_supported_media", _object_spread({
|
|
1655
|
+
reason: reason
|
|
1656
|
+
}, rejectStats));
|
|
1463
1657
|
return {
|
|
1464
1658
|
type: "empty",
|
|
1465
1659
|
errorUrls: errorUrls,
|
|
@@ -1491,77 +1685,122 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1491
1685
|
function fetchVastXml(vastTagUrl) {
|
|
1492
1686
|
var credentials = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "include";
|
|
1493
1687
|
return _async_to_generator(function() {
|
|
1494
|
-
var requestVast, response, error;
|
|
1688
|
+
var controller, timeoutId, requestVast, response, error, error1;
|
|
1495
1689
|
return _ts_generator(this, function(_state) {
|
|
1496
1690
|
switch(_state.label){
|
|
1497
1691
|
case 0:
|
|
1692
|
+
if (destroyed) {
|
|
1693
|
+
throw new Error("VAST request skipped: ad player destroyed");
|
|
1694
|
+
}
|
|
1695
|
+
controller = typeof AbortController !== "undefined" ? new AbortController() : void 0;
|
|
1696
|
+
if (controller) pendingVastRequests.add(controller);
|
|
1697
|
+
timeoutId = controller ? setTimeout(function() {
|
|
1698
|
+
return controller.abort();
|
|
1699
|
+
}, VAST_REQUEST_TIMEOUT_MS) : void 0;
|
|
1498
1700
|
requestVast = function requestVast(creds) {
|
|
1499
|
-
return fetch(vastTagUrl, {
|
|
1701
|
+
return fetch(vastTagUrl, _object_spread({
|
|
1500
1702
|
mode: "cors",
|
|
1501
1703
|
credentials: creds,
|
|
1502
1704
|
headers: {
|
|
1503
1705
|
"Accept": "application/xml, text/xml, */*"
|
|
1504
1706
|
},
|
|
1505
1707
|
referrerPolicy: "no-referrer-when-downgrade"
|
|
1506
|
-
}
|
|
1708
|
+
}, controller ? {
|
|
1709
|
+
signal: controller.signal
|
|
1710
|
+
} : {}));
|
|
1507
1711
|
};
|
|
1508
1712
|
_state.label = 1;
|
|
1509
1713
|
case 1:
|
|
1510
1714
|
_state.trys.push([
|
|
1511
1715
|
1,
|
|
1512
|
-
|
|
1716
|
+
10,
|
|
1717
|
+
11,
|
|
1718
|
+
12
|
|
1719
|
+
]);
|
|
1720
|
+
_state.label = 2;
|
|
1721
|
+
case 2:
|
|
1722
|
+
_state.trys.push([
|
|
1723
|
+
2,
|
|
1724
|
+
4,
|
|
1513
1725
|
,
|
|
1514
|
-
|
|
1726
|
+
8
|
|
1515
1727
|
]);
|
|
1516
1728
|
return [
|
|
1517
1729
|
4,
|
|
1518
1730
|
requestVast(credentials)
|
|
1519
1731
|
];
|
|
1520
|
-
case
|
|
1732
|
+
case 3:
|
|
1521
1733
|
response = _state.sent();
|
|
1522
1734
|
return [
|
|
1523
1735
|
3,
|
|
1524
|
-
|
|
1736
|
+
8
|
|
1525
1737
|
];
|
|
1526
|
-
case
|
|
1738
|
+
case 4:
|
|
1527
1739
|
error = _state.sent();
|
|
1528
|
-
if (!(credentials !== "omit")) return [
|
|
1740
|
+
if (!(credentials !== "omit" && !(controller === null || controller === void 0 ? void 0 : controller.signal.aborted))) return [
|
|
1529
1741
|
3,
|
|
1530
|
-
|
|
1742
|
+
6
|
|
1531
1743
|
];
|
|
1532
1744
|
console.warn('[HlsAdPlayer] VAST fetch failed with credentials="'.concat(credentials, '", retrying without credentials:'), error);
|
|
1745
|
+
logFunnel("vast_credentials_retry", {
|
|
1746
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
1747
|
+
});
|
|
1533
1748
|
return [
|
|
1534
1749
|
4,
|
|
1535
1750
|
requestVast("omit")
|
|
1536
1751
|
];
|
|
1537
|
-
case
|
|
1752
|
+
case 5:
|
|
1538
1753
|
response = _state.sent();
|
|
1539
1754
|
return [
|
|
1540
1755
|
3,
|
|
1541
|
-
|
|
1756
|
+
7
|
|
1542
1757
|
];
|
|
1543
|
-
case 5:
|
|
1544
|
-
throw error;
|
|
1545
1758
|
case 6:
|
|
1759
|
+
throw error;
|
|
1760
|
+
case 7:
|
|
1546
1761
|
return [
|
|
1547
1762
|
3,
|
|
1548
|
-
|
|
1763
|
+
8
|
|
1549
1764
|
];
|
|
1550
|
-
case
|
|
1765
|
+
case 8:
|
|
1551
1766
|
if (!response.ok) {
|
|
1552
1767
|
throw new Error("Failed to fetch VAST: ".concat(response.statusText));
|
|
1553
1768
|
}
|
|
1554
1769
|
return [
|
|
1555
|
-
|
|
1770
|
+
4,
|
|
1556
1771
|
response.text()
|
|
1557
1772
|
];
|
|
1773
|
+
case 9:
|
|
1774
|
+
return [
|
|
1775
|
+
2,
|
|
1776
|
+
_state.sent()
|
|
1777
|
+
];
|
|
1778
|
+
case 10:
|
|
1779
|
+
error1 = _state.sent();
|
|
1780
|
+
if (controller === null || controller === void 0 ? void 0 : controller.signal.aborted) {
|
|
1781
|
+
if (pendingRequestAbortReason) {
|
|
1782
|
+
throw new Error("".concat(pendingRequestAbortReason, " (timeout): ").concat(vastTagUrl));
|
|
1783
|
+
}
|
|
1784
|
+
throw new Error("VAST request timeout after ".concat(VAST_REQUEST_TIMEOUT_MS, "ms: ").concat(vastTagUrl));
|
|
1785
|
+
}
|
|
1786
|
+
throw error1;
|
|
1787
|
+
case 11:
|
|
1788
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
1789
|
+
if (controller) pendingVastRequests.delete(controller);
|
|
1790
|
+
return [
|
|
1791
|
+
7
|
|
1792
|
+
];
|
|
1793
|
+
case 12:
|
|
1794
|
+
return [
|
|
1795
|
+
2
|
|
1796
|
+
];
|
|
1558
1797
|
}
|
|
1559
1798
|
});
|
|
1560
1799
|
})();
|
|
1561
1800
|
}
|
|
1562
1801
|
function fetchAndParseVastAd(_0) {
|
|
1563
1802
|
return _async_to_generator(function(vastTagUrl) {
|
|
1564
|
-
var depth, accumulatedTracking, rules, vastXml, error, parsed, _parsed_errorUrls, _parsed_errorCode;
|
|
1803
|
+
var depth, accumulatedTracking, rules, vastXml, fetchStartedAt, error, parsed, _parsed_errorUrls, _parsed_errorCode;
|
|
1565
1804
|
var _arguments = arguments;
|
|
1566
1805
|
return _ts_generator(this, function(_state) {
|
|
1567
1806
|
switch(_state.label){
|
|
@@ -1569,6 +1808,11 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1569
1808
|
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] : {
|
|
1570
1809
|
followAdditionalWrappers: true
|
|
1571
1810
|
};
|
|
1811
|
+
if (destroyed) return [
|
|
1812
|
+
2,
|
|
1813
|
+
null
|
|
1814
|
+
];
|
|
1815
|
+
fetchStartedAt = Date.now();
|
|
1572
1816
|
_state.label = 1;
|
|
1573
1817
|
case 1:
|
|
1574
1818
|
_state.trys.push([
|
|
@@ -1591,14 +1835,35 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1591
1835
|
error = _state.sent();
|
|
1592
1836
|
if (depth === 0) throw error;
|
|
1593
1837
|
console.warn("[HlsAdPlayer] Wrapped VAST request failed:", error);
|
|
1594
|
-
|
|
1595
|
-
|
|
1838
|
+
logFunnel("wrapper_fetch", {
|
|
1839
|
+
reason: "failure",
|
|
1840
|
+
depth: depth,
|
|
1841
|
+
wrapperUrl: redactUrl(vastTagUrl),
|
|
1842
|
+
elapsedMs: Date.now() - fetchStartedAt,
|
|
1843
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
1596
1844
|
});
|
|
1845
|
+
if (!destroyed) {
|
|
1846
|
+
fireTrackingPixels(accumulatedTracking.error, {
|
|
1847
|
+
errorCode: VAST_ERROR_WRAPPER_TIMEOUT
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1597
1850
|
return [
|
|
1598
1851
|
2,
|
|
1599
1852
|
null
|
|
1600
1853
|
];
|
|
1601
1854
|
case 4:
|
|
1855
|
+
if (destroyed) return [
|
|
1856
|
+
2,
|
|
1857
|
+
null
|
|
1858
|
+
];
|
|
1859
|
+
if (depth > 0) {
|
|
1860
|
+
logFunnel("wrapper_fetch", {
|
|
1861
|
+
reason: "success",
|
|
1862
|
+
depth: depth,
|
|
1863
|
+
wrapperUrl: redactUrl(vastTagUrl),
|
|
1864
|
+
elapsedMs: Date.now() - fetchStartedAt
|
|
1865
|
+
});
|
|
1866
|
+
}
|
|
1602
1867
|
console.log("[HlsAdPlayer] VAST XML received");
|
|
1603
1868
|
console.log("[HlsAdPlayer] VAST XML content (first 2000 chars):", vastXml.substring(0, 2e3));
|
|
1604
1869
|
parsed = parseVastXml(vastXml);
|
|
@@ -1630,6 +1895,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1630
1895
|
];
|
|
1631
1896
|
}
|
|
1632
1897
|
mergeTrackingUrls(parsed.ad.trackingUrls, accumulatedTracking);
|
|
1898
|
+
logFunnel("inline_resolved", {
|
|
1899
|
+
depth: depth
|
|
1900
|
+
});
|
|
1633
1901
|
return [
|
|
1634
1902
|
2,
|
|
1635
1903
|
parsed.ad
|
|
@@ -1640,7 +1908,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1640
1908
|
}
|
|
1641
1909
|
function fetchAndParsePod(vastTagUrl) {
|
|
1642
1910
|
return _async_to_generator(function() {
|
|
1643
|
-
var _root_getAttribute, vastXml, trimmedXml, xmlDoc, root, adElements, _root_getAttribute1, _empty_errorUrls, empty, _empty_errorCode, resolveAd, podElements, buffet, ads, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step,
|
|
1911
|
+
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;
|
|
1644
1912
|
return _ts_generator(this, function(_state) {
|
|
1645
1913
|
switch(_state.label){
|
|
1646
1914
|
case 0:
|
|
@@ -1650,6 +1918,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1650
1918
|
];
|
|
1651
1919
|
case 1:
|
|
1652
1920
|
vastXml = _state.sent();
|
|
1921
|
+
if (destroyed) return [
|
|
1922
|
+
2,
|
|
1923
|
+
[]
|
|
1924
|
+
];
|
|
1653
1925
|
console.log("[HlsAdPlayer] Pod VAST XML received (length=".concat(vastXml.length, ")"));
|
|
1654
1926
|
trimmedXml = vastXml.trim();
|
|
1655
1927
|
if (trimmedXml.length === 0) {
|
|
@@ -1721,6 +1993,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1721
1993
|
buffet = adElements.filter(function(el) {
|
|
1722
1994
|
return getAdSequence(el) === void 0;
|
|
1723
1995
|
});
|
|
1996
|
+
resolveAll = function resolveAll(elements) {
|
|
1997
|
+
return Promise.all(elements.map(function(el) {
|
|
1998
|
+
return resolveAd(el).catch(function() {
|
|
1999
|
+
return null;
|
|
2000
|
+
});
|
|
2001
|
+
}));
|
|
2002
|
+
};
|
|
1724
2003
|
ads = [];
|
|
1725
2004
|
if (!(podElements.length === 0)) return [
|
|
1726
2005
|
3,
|
|
@@ -1735,27 +2014,26 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1735
2014
|
8,
|
|
1736
2015
|
9
|
|
1737
2016
|
]);
|
|
1738
|
-
|
|
1739
|
-
|
|
2017
|
+
return [
|
|
2018
|
+
4,
|
|
2019
|
+
resolveAll(buffet)
|
|
2020
|
+
];
|
|
1740
2021
|
case 3:
|
|
2022
|
+
_iterator = _state.sent()[Symbol.iterator]();
|
|
2023
|
+
_state.label = 4;
|
|
2024
|
+
case 4:
|
|
1741
2025
|
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
1742
2026
|
3,
|
|
1743
2027
|
6
|
|
1744
2028
|
];
|
|
1745
|
-
|
|
1746
|
-
return [
|
|
1747
|
-
4,
|
|
1748
|
-
resolveAd(adElement)
|
|
1749
|
-
];
|
|
1750
|
-
case 4:
|
|
1751
|
-
ad = _state.sent();
|
|
2029
|
+
ad = _step.value;
|
|
1752
2030
|
if (ad) ads.push(ad);
|
|
1753
2031
|
_state.label = 5;
|
|
1754
2032
|
case 5:
|
|
1755
2033
|
_iteratorNormalCompletion = true;
|
|
1756
2034
|
return [
|
|
1757
2035
|
3,
|
|
1758
|
-
|
|
2036
|
+
4
|
|
1759
2037
|
];
|
|
1760
2038
|
case 6:
|
|
1761
2039
|
return [
|
|
@@ -1798,20 +2076,19 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1798
2076
|
20,
|
|
1799
2077
|
21
|
|
1800
2078
|
]);
|
|
1801
|
-
|
|
1802
|
-
|
|
2079
|
+
return [
|
|
2080
|
+
4,
|
|
2081
|
+
resolveAll(podElements)
|
|
2082
|
+
];
|
|
1803
2083
|
case 12:
|
|
2084
|
+
_iterator1 = _state.sent()[Symbol.iterator]();
|
|
2085
|
+
_state.label = 13;
|
|
2086
|
+
case 13:
|
|
1804
2087
|
if (!!(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done)) return [
|
|
1805
2088
|
3,
|
|
1806
2089
|
18
|
|
1807
2090
|
];
|
|
1808
|
-
|
|
1809
|
-
return [
|
|
1810
|
-
4,
|
|
1811
|
-
resolveAd(adElement1)
|
|
1812
|
-
];
|
|
1813
|
-
case 13:
|
|
1814
|
-
ad1 = _state.sent();
|
|
2091
|
+
ad1 = _step1.value;
|
|
1815
2092
|
_state.label = 14;
|
|
1816
2093
|
case 14:
|
|
1817
2094
|
if (!(!ad1 && buffet.length > 0)) return [
|
|
@@ -1820,7 +2097,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1820
2097
|
];
|
|
1821
2098
|
return [
|
|
1822
2099
|
4,
|
|
1823
|
-
resolveAd(buffet.shift())
|
|
2100
|
+
resolveAd(buffet.shift()).catch(function() {
|
|
2101
|
+
return null;
|
|
2102
|
+
})
|
|
1824
2103
|
];
|
|
1825
2104
|
case 15:
|
|
1826
2105
|
ad1 = _state.sent();
|
|
@@ -1835,7 +2114,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1835
2114
|
_iteratorNormalCompletion1 = true;
|
|
1836
2115
|
return [
|
|
1837
2116
|
3,
|
|
1838
|
-
|
|
2117
|
+
13
|
|
1839
2118
|
];
|
|
1840
2119
|
case 18:
|
|
1841
2120
|
return [
|
|
@@ -1930,14 +2209,17 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1930
2209
|
var progress = currentTime / currentAd.duration;
|
|
1931
2210
|
if (progress >= 0.25 && !trackingFired.firstQuartile) {
|
|
1932
2211
|
trackingFired.firstQuartile = true;
|
|
2212
|
+
logFunnel("first_quartile");
|
|
1933
2213
|
fireTrackingPixels(currentAd.trackingUrls.firstQuartile);
|
|
1934
2214
|
}
|
|
1935
2215
|
if (progress >= 0.5 && !trackingFired.midpoint) {
|
|
1936
2216
|
trackingFired.midpoint = true;
|
|
2217
|
+
logFunnel("midpoint");
|
|
1937
2218
|
fireTrackingPixels(currentAd.trackingUrls.midpoint);
|
|
1938
2219
|
}
|
|
1939
2220
|
if (progress >= 0.75 && !trackingFired.thirdQuartile) {
|
|
1940
2221
|
trackingFired.thirdQuartile = true;
|
|
2222
|
+
logFunnel("third_quartile");
|
|
1941
2223
|
fireTrackingPixels(currentAd.trackingUrls.thirdQuartile);
|
|
1942
2224
|
}
|
|
1943
2225
|
};
|
|
@@ -1960,6 +2242,16 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1960
2242
|
if (!trackingFired.impression) {
|
|
1961
2243
|
trackingFired.impression = true;
|
|
1962
2244
|
resolvedAds.add(currentAd);
|
|
2245
|
+
logFunnel("playing", {
|
|
2246
|
+
mutedByAutoplay: forcedMuteByAutoplay,
|
|
2247
|
+
candidateIndex: mediaCandidateIndex
|
|
2248
|
+
});
|
|
2249
|
+
logFunnel("impression_fired", {
|
|
2250
|
+
pixelCount: currentAd.trackingUrls.impression.length
|
|
2251
|
+
});
|
|
2252
|
+
if (currentAd.trackingUrls.impression.length === 0) {
|
|
2253
|
+
console.warn("[HlsAdPlayer] Ad started but VAST contained no <Impression> URLs - GAM will not count it");
|
|
2254
|
+
}
|
|
1963
2255
|
fireTrackingPixels(currentAd.trackingUrls.impression);
|
|
1964
2256
|
fireTrackingPixels(currentAd.trackingUrls.creativeView);
|
|
1965
2257
|
fireTrackingPixels(currentAd.trackingUrls.verificationNotExecuted, {
|
|
@@ -1982,6 +2274,7 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1982
2274
|
sampleViewability();
|
|
1983
2275
|
settleViewability();
|
|
1984
2276
|
trackingFired.complete = true;
|
|
2277
|
+
logFunnel("complete");
|
|
1985
2278
|
fireTrackingPixels(currentAd.trackingUrls.complete);
|
|
1986
2279
|
console.log("[HlsAdPlayer] Ad completed");
|
|
1987
2280
|
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) {
|
|
@@ -1990,16 +2283,41 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
1990
2283
|
handleAdComplete();
|
|
1991
2284
|
};
|
|
1992
2285
|
var onError = function onError(e) {
|
|
2286
|
+
var _adVideoElement_error, _adVideoElement_error1;
|
|
1993
2287
|
if (!adPlaying) return;
|
|
1994
2288
|
console.error("[HlsAdPlayer] Ad video error:", e);
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2289
|
+
var vastErrorCode = toVastMediaErrorCode(adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.error);
|
|
2290
|
+
logFunnel("media_error", {
|
|
2291
|
+
mediaErrorCode: adVideoElement === null || adVideoElement === void 0 ? void 0 : (_adVideoElement_error = adVideoElement.error) === null || _adVideoElement_error === void 0 ? void 0 : _adVideoElement_error.code,
|
|
2292
|
+
errorMessage: adVideoElement === null || adVideoElement === void 0 ? void 0 : (_adVideoElement_error1 = adVideoElement.error) === null || _adVideoElement_error1 === void 0 ? void 0 : _adVideoElement_error1.message,
|
|
2293
|
+
networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
|
|
2294
|
+
readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
|
|
2295
|
+
currentSrc: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.currentSrc,
|
|
2296
|
+
vastErrorCode: vastErrorCode
|
|
2297
|
+
});
|
|
2298
|
+
recoverFromAdFailure(vastErrorCode);
|
|
2299
|
+
};
|
|
2300
|
+
var onMediaDiagnostic = function onMediaDiagnostic(event) {
|
|
2301
|
+
if (!adPlaying || !adVideoElement || trackingFired.impression) return;
|
|
2302
|
+
if (!adVideoElement.currentSrc) return;
|
|
2303
|
+
logFunnel("media_event", {
|
|
2304
|
+
reason: event.type,
|
|
2305
|
+
readyState: adVideoElement.readyState,
|
|
2306
|
+
networkState: adVideoElement.networkState,
|
|
2307
|
+
currentSrc: adVideoElement.currentSrc
|
|
2308
|
+
});
|
|
2000
2309
|
};
|
|
2001
2310
|
var onVolumeChange = function onVolumeChange() {
|
|
2002
2311
|
if (!currentAd || !adVideoElement) return;
|
|
2312
|
+
if (forcedMuteByAutoplay && !adVideoElement.muted) {
|
|
2313
|
+
var userActivation = navigator.userActivation;
|
|
2314
|
+
if (userActivation && !userActivation.isActive) {
|
|
2315
|
+
logFunnel("unexpected_unmute", {
|
|
2316
|
+
paused: adVideoElement.paused
|
|
2317
|
+
});
|
|
2318
|
+
}
|
|
2319
|
+
forcedMuteByAutoplay = false;
|
|
2320
|
+
}
|
|
2003
2321
|
var muted = adVideoElement.muted || adVideoElement.volume === 0;
|
|
2004
2322
|
if (!trackingFired.start) {
|
|
2005
2323
|
trackingFired.lastMuted = muted;
|
|
@@ -2059,6 +2377,22 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2059
2377
|
{
|
|
2060
2378
|
type: "play",
|
|
2061
2379
|
handler: onPlay
|
|
2380
|
+
},
|
|
2381
|
+
{
|
|
2382
|
+
type: "stalled",
|
|
2383
|
+
handler: onMediaDiagnostic
|
|
2384
|
+
},
|
|
2385
|
+
{
|
|
2386
|
+
type: "suspend",
|
|
2387
|
+
handler: onMediaDiagnostic
|
|
2388
|
+
},
|
|
2389
|
+
{
|
|
2390
|
+
type: "abort",
|
|
2391
|
+
handler: onMediaDiagnostic
|
|
2392
|
+
},
|
|
2393
|
+
{
|
|
2394
|
+
type: "emptied",
|
|
2395
|
+
handler: onMediaDiagnostic
|
|
2062
2396
|
}
|
|
2063
2397
|
];
|
|
2064
2398
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -2348,16 +2682,51 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2348
2682
|
function settlePendingPlay() {
|
|
2349
2683
|
pendingPlayPromise = void 0;
|
|
2350
2684
|
}
|
|
2685
|
+
function toVastPlayErrorCode(error) {
|
|
2686
|
+
return (error === null || error === void 0 ? void 0 : error.name) === "NotSupportedError" ? VAST_ERROR_NO_SUPPORTED_MEDIA : VAST_ERROR_MEDIA_DISPLAY;
|
|
2687
|
+
}
|
|
2688
|
+
function failAdPlayback(context, error) {
|
|
2689
|
+
var vastErrorCode = toVastPlayErrorCode(error);
|
|
2690
|
+
console.error("[HlsAdPlayer] Error starting ".concat(context, ":"), error);
|
|
2691
|
+
logFunnel("play_failed", {
|
|
2692
|
+
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
2693
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
2694
|
+
vastErrorCode: vastErrorCode
|
|
2695
|
+
});
|
|
2696
|
+
recoverFromAdFailure(vastErrorCode);
|
|
2697
|
+
}
|
|
2351
2698
|
function startAdPlayback(context) {
|
|
2699
|
+
var isMutedRetry = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
2352
2700
|
if (!adVideoElement) return;
|
|
2701
|
+
var computed = typeof getComputedStyle === "function" && adContainerEl ? getComputedStyle(adContainerEl) : void 0;
|
|
2702
|
+
logFunnel(isMutedRetry ? "muted_retry" : "play_called", {
|
|
2703
|
+
context: context,
|
|
2704
|
+
isConnected: adVideoElement.isConnected,
|
|
2705
|
+
clientWidth: adVideoElement.clientWidth,
|
|
2706
|
+
clientHeight: adVideoElement.clientHeight,
|
|
2707
|
+
containerDisplay: computed === null || computed === void 0 ? void 0 : computed.display,
|
|
2708
|
+
containerVisibility: computed === null || computed === void 0 ? void 0 : computed.visibility
|
|
2709
|
+
});
|
|
2353
2710
|
var playPromise = adVideoElement.play();
|
|
2354
2711
|
pendingPlayPromise = playPromise;
|
|
2355
2712
|
playPromise.catch(function(error) {
|
|
2356
2713
|
if (pendingPlayPromise !== playPromise) {
|
|
2357
2714
|
return;
|
|
2358
2715
|
}
|
|
2359
|
-
|
|
2360
|
-
|
|
2716
|
+
logFunnel("play_rejected", {
|
|
2717
|
+
context: context,
|
|
2718
|
+
errorName: error === null || error === void 0 ? void 0 : error.name,
|
|
2719
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
2720
|
+
});
|
|
2721
|
+
if (!isMutedRetry && (error === null || error === void 0 ? void 0 : error.name) === "NotAllowedError" && adVideoElement && !adVideoElement.muted) {
|
|
2722
|
+
console.warn("[HlsAdPlayer] Unmuted ".concat(context, " blocked by autoplay policy - retrying muted"));
|
|
2723
|
+
originalMutedState = true;
|
|
2724
|
+
forcedMuteByAutoplay = true;
|
|
2725
|
+
adVideoElement.muted = true;
|
|
2726
|
+
startAdPlayback(context, true);
|
|
2727
|
+
return;
|
|
2728
|
+
}
|
|
2729
|
+
failAdPlayback(context, error);
|
|
2361
2730
|
}).finally(function() {
|
|
2362
2731
|
if (pendingPlayPromise === playPromise) {
|
|
2363
2732
|
pendingPlayPromise = void 0;
|
|
@@ -2396,17 +2765,109 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2396
2765
|
adVideoElement.volume = Math.max(0, Math.min(1, originalVolume));
|
|
2397
2766
|
adVideoElement.muted = originalMutedState;
|
|
2398
2767
|
}
|
|
2768
|
+
function clearMediaStartTimer() {
|
|
2769
|
+
if (mediaStartTimerId !== void 0) {
|
|
2770
|
+
clearTimeout(mediaStartTimerId);
|
|
2771
|
+
mediaStartTimerId = void 0;
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
function startMediaStartTimer() {
|
|
2775
|
+
clearMediaStartTimer();
|
|
2776
|
+
if (!(MEDIA_START_TIMEOUT_MS > 0)) return;
|
|
2777
|
+
var startedAt = Date.now();
|
|
2778
|
+
mediaStartTimerId = setTimeout(function() {
|
|
2779
|
+
mediaStartTimerId = void 0;
|
|
2780
|
+
if (!adPlaying || trackingFired.impression) return;
|
|
2781
|
+
console.warn("[HlsAdPlayer] Ad media did not start playing within ".concat(MEDIA_START_TIMEOUT_MS, "ms"));
|
|
2782
|
+
logFunnel("play_resolved_but_never_started", {
|
|
2783
|
+
timeoutMs: MEDIA_START_TIMEOUT_MS,
|
|
2784
|
+
elapsedMs: Date.now() - startedAt,
|
|
2785
|
+
readyState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.readyState,
|
|
2786
|
+
networkState: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.networkState,
|
|
2787
|
+
currentSrc: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.currentSrc,
|
|
2788
|
+
paused: adVideoElement === null || adVideoElement === void 0 ? void 0 : adVideoElement.paused,
|
|
2789
|
+
vastErrorCode: VAST_ERROR_MEDIA_TIMEOUT
|
|
2790
|
+
});
|
|
2791
|
+
recoverFromAdFailure(VAST_ERROR_MEDIA_TIMEOUT);
|
|
2792
|
+
}, MEDIA_START_TIMEOUT_MS);
|
|
2793
|
+
}
|
|
2794
|
+
function resetVideoElementForNextSource() {
|
|
2795
|
+
clearStallWatchdog();
|
|
2796
|
+
if (requiresMediaPipelineResetAfterAds()) {
|
|
2797
|
+
recreateAdVideoElement();
|
|
2798
|
+
setupAdEventListeners();
|
|
2799
|
+
} else {
|
|
2800
|
+
prepareVideoElementForNewSource();
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
function tryNextMediaCandidate() {
|
|
2804
|
+
if (!currentAd || trackingFired.impression) return false;
|
|
2805
|
+
if (mediaCandidateIndex >= mediaCandidates.length - 1) return false;
|
|
2806
|
+
var failedUrl = currentAdMediaFile === null || currentAdMediaFile === void 0 ? void 0 : currentAdMediaFile.url;
|
|
2807
|
+
mediaCandidateIndex++;
|
|
2808
|
+
var next = mediaCandidates[mediaCandidateIndex];
|
|
2809
|
+
if (!next) return false;
|
|
2810
|
+
logFunnel("media_fallback", {
|
|
2811
|
+
failedUrl: failedUrl,
|
|
2812
|
+
nextUrl: next.url,
|
|
2813
|
+
nextType: next.type,
|
|
2814
|
+
candidateIndex: mediaCandidateIndex,
|
|
2815
|
+
candidateCount: mediaCandidates.length
|
|
2816
|
+
});
|
|
2817
|
+
resetVideoElementForNextSource();
|
|
2818
|
+
try {
|
|
2819
|
+
loadMediaCandidate(next);
|
|
2820
|
+
return true;
|
|
2821
|
+
} catch (error) {
|
|
2822
|
+
console.error("[HlsAdPlayer] Failed to load fallback media file:", error);
|
|
2823
|
+
return tryNextMediaCandidate();
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2826
|
+
function recoverFromAdFailure(vastErrorCode) {
|
|
2827
|
+
clearMediaStartTimer();
|
|
2828
|
+
if (tryNextMediaCandidate()) return;
|
|
2829
|
+
reportCurrentAdError(vastErrorCode);
|
|
2830
|
+
if (podIndex < podAds.length - 1 && advanceToNextPodAd()) return;
|
|
2831
|
+
handleAdError();
|
|
2832
|
+
}
|
|
2399
2833
|
function loadCurrentAdMedia() {
|
|
2400
2834
|
if (!adVideoElement || !currentAd) {
|
|
2401
2835
|
throw new Error("No ad video element or ad to load");
|
|
2402
2836
|
}
|
|
2403
|
-
|
|
2837
|
+
mediaCandidates = rankMediaCandidates(currentAd.mediaFiles);
|
|
2838
|
+
mediaCandidateIndex = 0;
|
|
2839
|
+
var mediaFile = mediaCandidates[0];
|
|
2404
2840
|
if (!mediaFile) {
|
|
2405
|
-
|
|
2841
|
+
logFunnel("media_unsupported", {
|
|
2842
|
+
vastErrorCode: VAST_ERROR_NO_SUPPORTED_MEDIA,
|
|
2843
|
+
candidates: currentAd.mediaFiles.length
|
|
2844
|
+
});
|
|
2845
|
+
reportCurrentAdError(VAST_ERROR_NO_SUPPORTED_MEDIA);
|
|
2846
|
+
throw new Error("No media file this browser can play");
|
|
2847
|
+
}
|
|
2848
|
+
try {
|
|
2849
|
+
loadMediaCandidate(mediaFile);
|
|
2850
|
+
} catch (error) {
|
|
2851
|
+
if (tryNextMediaCandidate()) return;
|
|
2852
|
+
reportCurrentAdError(VAST_ERROR_NO_SUPPORTED_MEDIA);
|
|
2853
|
+
throw error;
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
function loadMediaCandidate(mediaFile) {
|
|
2857
|
+
if (!adVideoElement || !currentAd) {
|
|
2858
|
+
throw new Error("No ad video element or ad to load");
|
|
2406
2859
|
}
|
|
2407
2860
|
currentAdMediaFile = mediaFile;
|
|
2408
2861
|
var isHlsAd = isHlsMediaFile(mediaFile);
|
|
2862
|
+
logFunnel("media_selected", {
|
|
2863
|
+
width: mediaFile.width,
|
|
2864
|
+
height: mediaFile.height,
|
|
2865
|
+
bitrate: mediaFile.bitrate,
|
|
2866
|
+
candidateIndex: mediaCandidateIndex,
|
|
2867
|
+
candidates: mediaCandidates.length
|
|
2868
|
+
});
|
|
2409
2869
|
console.log("[HlsAdPlayer] Loading ".concat(isHlsAd ? "HLS" : "progressive", " ad (pod ").concat(podIndex + 1, "/").concat(podAds.length || 1, ") from: ").concat(mediaFile.url));
|
|
2870
|
+
startMediaStartTimer();
|
|
2410
2871
|
if (isHlsAd && import_hls.default.isSupported()) {
|
|
2411
2872
|
if (adHls) {
|
|
2412
2873
|
adHls.destroy();
|
|
@@ -2415,6 +2876,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2415
2876
|
enableWorker: true,
|
|
2416
2877
|
lowLatencyMode: false
|
|
2417
2878
|
});
|
|
2879
|
+
logFunnel("media_load", {
|
|
2880
|
+
pipeline: "hls.js"
|
|
2881
|
+
});
|
|
2418
2882
|
adHls.loadSource(mediaFile.url);
|
|
2419
2883
|
adHls.attachMedia(adVideoElement);
|
|
2420
2884
|
adHls.on(import_hls.default.Events.MANIFEST_PARSED, function() {
|
|
@@ -2424,10 +2888,24 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2424
2888
|
adHls.on(import_hls.default.Events.ERROR, function(_event, data) {
|
|
2425
2889
|
console.error("[HlsAdPlayer] HLS error:", data);
|
|
2426
2890
|
if (data.fatal) {
|
|
2427
|
-
|
|
2891
|
+
var _data_response, _data_response1, _data_frag;
|
|
2892
|
+
var vastErrorCode = data.type === import_hls.default.ErrorTypes.NETWORK_ERROR ? 401 : VAST_ERROR_MEDIA_DISPLAY;
|
|
2893
|
+
logFunnel("hls_fatal", {
|
|
2894
|
+
reason: data.details,
|
|
2895
|
+
errorName: data.type,
|
|
2896
|
+
errorMessage: data.details,
|
|
2897
|
+
responseCode: (_data_response = data.response) === null || _data_response === void 0 ? void 0 : _data_response.code,
|
|
2898
|
+
responseText: (_data_response1 = data.response) === null || _data_response1 === void 0 ? void 0 : _data_response1.text,
|
|
2899
|
+
fragUrl: (_data_frag = data.frag) === null || _data_frag === void 0 ? void 0 : _data_frag.url,
|
|
2900
|
+
vastErrorCode: vastErrorCode
|
|
2901
|
+
});
|
|
2902
|
+
recoverFromAdFailure(vastErrorCode);
|
|
2428
2903
|
}
|
|
2429
2904
|
});
|
|
2430
2905
|
} else if (isHlsAd && adVideoElement.canPlayType("application/vnd.apple.mpegurl")) {
|
|
2906
|
+
logFunnel("media_load", {
|
|
2907
|
+
pipeline: "native-hls"
|
|
2908
|
+
});
|
|
2431
2909
|
adVideoElement.src = mediaFile.url;
|
|
2432
2910
|
startAdPlayback("native HLS ad playback");
|
|
2433
2911
|
} else if (!isHlsAd && isProgressiveMediaFile(mediaFile)) {
|
|
@@ -2435,45 +2913,47 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2435
2913
|
adHls.destroy();
|
|
2436
2914
|
adHls = void 0;
|
|
2437
2915
|
}
|
|
2916
|
+
logFunnel("media_load", {
|
|
2917
|
+
pipeline: "progressive"
|
|
2918
|
+
});
|
|
2438
2919
|
adVideoElement.src = mediaFile.url;
|
|
2439
2920
|
adVideoElement.load();
|
|
2440
2921
|
startAdPlayback("progressive ad playback");
|
|
2441
2922
|
} else {
|
|
2923
|
+
clearMediaStartTimer();
|
|
2924
|
+
logFunnel("media_unsupported", {
|
|
2925
|
+
vastErrorCode: VAST_ERROR_NO_SUPPORTED_MEDIA
|
|
2926
|
+
});
|
|
2442
2927
|
throw new Error("Unsupported ad media file type: ".concat(mediaFile.type));
|
|
2443
2928
|
}
|
|
2444
2929
|
}
|
|
2445
2930
|
function advanceToNextPodAd() {
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
index: podIndex,
|
|
2468
|
-
total: podAds.length
|
|
2469
|
-
});
|
|
2470
|
-
return true;
|
|
2471
|
-
} catch (error) {
|
|
2472
|
-
console.error("[HlsAdPlayer] Failed to load next pod ad:", error);
|
|
2473
|
-
return false;
|
|
2931
|
+
clearMediaStartTimer();
|
|
2932
|
+
while(podIndex < podAds.length - 1){
|
|
2933
|
+
settleViewability();
|
|
2934
|
+
podIndex++;
|
|
2935
|
+
currentAd = podAds[podIndex];
|
|
2936
|
+
currentAdMediaFile = void 0;
|
|
2937
|
+
resetAdTracking();
|
|
2938
|
+
if (currentAd) {
|
|
2939
|
+
console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
|
|
2940
|
+
}
|
|
2941
|
+
resetVideoElementForNextSource();
|
|
2942
|
+
try {
|
|
2943
|
+
loadCurrentAdMedia();
|
|
2944
|
+
emit("pod_ad_started", {
|
|
2945
|
+
index: podIndex,
|
|
2946
|
+
total: podAds.length
|
|
2947
|
+
});
|
|
2948
|
+
return true;
|
|
2949
|
+
} catch (error) {
|
|
2950
|
+
console.error("[HlsAdPlayer] Failed to load next pod ad:", error);
|
|
2951
|
+
}
|
|
2474
2952
|
}
|
|
2953
|
+
return false;
|
|
2475
2954
|
}
|
|
2476
2955
|
function clearStallWatchdog() {
|
|
2956
|
+
clearMediaStartTimer();
|
|
2477
2957
|
if (stallWatchdogId != null) {
|
|
2478
2958
|
clearInterval(stallWatchdogId);
|
|
2479
2959
|
stallWatchdogId = void 0;
|
|
@@ -2489,11 +2969,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2489
2969
|
function handleAdStall() {
|
|
2490
2970
|
console.warn("[HlsAdPlayer] Ad playback stalled (no progress) - recovering to avoid a blank frame");
|
|
2491
2971
|
clearStallWatchdog();
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
handleAdError();
|
|
2972
|
+
logFunnel("stall", {
|
|
2973
|
+
vastErrorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
2974
|
+
});
|
|
2975
|
+
recoverFromAdFailure(VAST_ERROR_MEDIA_DISPLAY);
|
|
2497
2976
|
}
|
|
2498
2977
|
function getDecodedVideoFrameCount(video) {
|
|
2499
2978
|
try {
|
|
@@ -2555,11 +3034,10 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2555
3034
|
function handleVideoDecodeFailure() {
|
|
2556
3035
|
console.warn("[HlsAdPlayer] Ad audio is advancing but no video frames decoded (black screen) - skipping this creative");
|
|
2557
3036
|
clearStallWatchdog();
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
handleAdError();
|
|
3037
|
+
logFunnel("decode_failure", {
|
|
3038
|
+
vastErrorCode: VAST_ERROR_MEDIA_DISPLAY
|
|
3039
|
+
});
|
|
3040
|
+
recoverFromAdFailure(VAST_ERROR_MEDIA_DISPLAY);
|
|
2563
3041
|
}
|
|
2564
3042
|
function startStallWatchdog() {
|
|
2565
3043
|
clearStallWatchdog();
|
|
@@ -2683,6 +3161,15 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2683
3161
|
Promise.reject(new Error("Ad already playing"))
|
|
2684
3162
|
];
|
|
2685
3163
|
}
|
|
3164
|
+
if (destroyed) {
|
|
3165
|
+
return [
|
|
3166
|
+
2,
|
|
3167
|
+
Promise.reject(new Error("Ad player destroyed"))
|
|
3168
|
+
];
|
|
3169
|
+
}
|
|
3170
|
+
currentVastTagUrl = vastTagUrl;
|
|
3171
|
+
pendingRequestAbortReason = void 0;
|
|
3172
|
+
logFunnel("request_sent");
|
|
2686
3173
|
_state.label = 1;
|
|
2687
3174
|
case 1:
|
|
2688
3175
|
_state.trys.push([
|
|
@@ -2717,8 +3204,18 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2717
3204
|
ads = _state.sent();
|
|
2718
3205
|
_state.label = 4;
|
|
2719
3206
|
case 4:
|
|
3207
|
+
if (destroyed) {
|
|
3208
|
+
return [
|
|
3209
|
+
2,
|
|
3210
|
+
Promise.reject(new Error("Ad player destroyed"))
|
|
3211
|
+
];
|
|
3212
|
+
}
|
|
3213
|
+
if (!ads.length && pendingRequestAbortReason) {
|
|
3214
|
+
throw new Error(pendingRequestAbortReason);
|
|
3215
|
+
}
|
|
2720
3216
|
if (!ads.length) {
|
|
2721
3217
|
console.warn("[HlsAdPlayer] No ads available from VAST response");
|
|
3218
|
+
logFunnel("no_fill");
|
|
2722
3219
|
emit("ad_error");
|
|
2723
3220
|
return [
|
|
2724
3221
|
2,
|
|
@@ -2729,6 +3226,23 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2729
3226
|
podIndex = 0;
|
|
2730
3227
|
currentAd = ads[0];
|
|
2731
3228
|
currentAdMediaFile = void 0;
|
|
3229
|
+
logFunnel("vast_received", {
|
|
3230
|
+
adCount: ads.length,
|
|
3231
|
+
durations: ads.map(function(ad) {
|
|
3232
|
+
return ad.duration;
|
|
3233
|
+
}),
|
|
3234
|
+
impressionUrls: ads.map(function(ad) {
|
|
3235
|
+
return ad.trackingUrls.impression.length;
|
|
3236
|
+
})
|
|
3237
|
+
});
|
|
3238
|
+
ads.forEach(function(ad, index) {
|
|
3239
|
+
if (ad.trackingUrls.impression.length === 0) {
|
|
3240
|
+
logFunnel("vast_missing_impression", {
|
|
3241
|
+
adIndex: index,
|
|
3242
|
+
missingAdId: ad.id
|
|
3243
|
+
});
|
|
3244
|
+
}
|
|
3245
|
+
});
|
|
2732
3246
|
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"));
|
|
2733
3247
|
return [
|
|
2734
3248
|
2,
|
|
@@ -2737,6 +3251,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2737
3251
|
case 5:
|
|
2738
3252
|
error = _state.sent();
|
|
2739
3253
|
console.error("[HlsAdPlayer] Error requesting ads:", error);
|
|
3254
|
+
logFunnel("request_failed", {
|
|
3255
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
3256
|
+
});
|
|
2740
3257
|
emit("ad_error");
|
|
2741
3258
|
return [
|
|
2742
3259
|
2,
|
|
@@ -2792,13 +3309,22 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2792
3309
|
adContainerEl.style.pointerEvents = "auto";
|
|
2793
3310
|
}
|
|
2794
3311
|
emit("content_pause");
|
|
2795
|
-
|
|
3312
|
+
try {
|
|
3313
|
+
loadCurrentAdMedia();
|
|
3314
|
+
} catch (loadError) {
|
|
3315
|
+
if (!(podIndex < podAds.length - 1 && advanceToNextPodAd())) {
|
|
3316
|
+
throw loadError;
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
2796
3319
|
return [
|
|
2797
3320
|
2,
|
|
2798
3321
|
Promise.resolve()
|
|
2799
3322
|
];
|
|
2800
3323
|
} catch (error) {
|
|
2801
3324
|
console.error("[HlsAdPlayer] Error playing ad:", error);
|
|
3325
|
+
logFunnel("play_failed", {
|
|
3326
|
+
errorMessage: error === null || error === void 0 ? void 0 : error.message
|
|
3327
|
+
});
|
|
2802
3328
|
handleAdError();
|
|
2803
3329
|
return [
|
|
2804
3330
|
2,
|
|
@@ -2840,6 +3366,9 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2840
3366
|
var previousMutedState;
|
|
2841
3367
|
return _ts_generator(this, function(_state) {
|
|
2842
3368
|
console.log("[HlsAdPlayer] Stopping ad");
|
|
3369
|
+
if (adPlaying && currentAd && !trackingFired.impression) {
|
|
3370
|
+
logFunnel("stopped_before_start");
|
|
3371
|
+
}
|
|
2843
3372
|
settleViewability();
|
|
2844
3373
|
fireNotUsedForUnplayedAds();
|
|
2845
3374
|
clearStallWatchdog();
|
|
@@ -2872,15 +3401,18 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2872
3401
|
},
|
|
2873
3402
|
destroy: function destroy() {
|
|
2874
3403
|
console.log("[HlsAdPlayer] Destroying");
|
|
3404
|
+
if (adPlaying && currentAd && !trackingFired.impression) {
|
|
3405
|
+
logFunnel("stopped_before_start");
|
|
3406
|
+
}
|
|
2875
3407
|
settleViewability();
|
|
2876
3408
|
fireNotUsedForUnplayedAds();
|
|
2877
3409
|
destroyed = true;
|
|
2878
|
-
|
|
3410
|
+
pendingRequestAbortReason = "Ad player destroyed";
|
|
2879
3411
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2880
3412
|
try {
|
|
2881
|
-
for(var _iterator =
|
|
2882
|
-
var
|
|
2883
|
-
|
|
3413
|
+
for(var _iterator = Array.from(pendingVastRequests)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3414
|
+
var controller = _step.value;
|
|
3415
|
+
controller.abort();
|
|
2884
3416
|
}
|
|
2885
3417
|
} catch (err) {
|
|
2886
3418
|
_didIteratorError = true;
|
|
@@ -2896,6 +3428,28 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2896
3428
|
}
|
|
2897
3429
|
}
|
|
2898
3430
|
}
|
|
3431
|
+
pendingVastRequests.clear();
|
|
3432
|
+
clearStallWatchdog();
|
|
3433
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
3434
|
+
try {
|
|
3435
|
+
for(var _iterator1 = pendingTimeouts[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
3436
|
+
var timeoutId = _step1.value;
|
|
3437
|
+
clearTimeout(timeoutId);
|
|
3438
|
+
}
|
|
3439
|
+
} catch (err) {
|
|
3440
|
+
_didIteratorError1 = true;
|
|
3441
|
+
_iteratorError1 = err;
|
|
3442
|
+
} finally{
|
|
3443
|
+
try {
|
|
3444
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
3445
|
+
_iterator1.return();
|
|
3446
|
+
}
|
|
3447
|
+
} finally{
|
|
3448
|
+
if (_didIteratorError1) {
|
|
3449
|
+
throw _iteratorError1;
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
}
|
|
2899
3453
|
pendingTimeouts = [];
|
|
2900
3454
|
adPlaying = false;
|
|
2901
3455
|
setAdPlayingFlag(false);
|
|
@@ -2915,6 +3469,35 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2915
3469
|
isAdPlaying: function isAdPlaying() {
|
|
2916
3470
|
return adPlaying;
|
|
2917
3471
|
},
|
|
3472
|
+
setFunnelContext: function setFunnelContext(context) {
|
|
3473
|
+
funnelContext = _object_spread({}, context);
|
|
3474
|
+
},
|
|
3475
|
+
abortPendingRequest: function abortPendingRequest() {
|
|
3476
|
+
var reason = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "VAST request aborted (timeout)";
|
|
3477
|
+
if (pendingVastRequests.size === 0) return;
|
|
3478
|
+
pendingRequestAbortReason = reason;
|
|
3479
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
3480
|
+
try {
|
|
3481
|
+
for(var _iterator = Array.from(pendingVastRequests)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
3482
|
+
var controller = _step.value;
|
|
3483
|
+
controller.abort();
|
|
3484
|
+
}
|
|
3485
|
+
} catch (err) {
|
|
3486
|
+
_didIteratorError = true;
|
|
3487
|
+
_iteratorError = err;
|
|
3488
|
+
} finally{
|
|
3489
|
+
try {
|
|
3490
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
3491
|
+
_iterator.return();
|
|
3492
|
+
}
|
|
3493
|
+
} finally{
|
|
3494
|
+
if (_didIteratorError) {
|
|
3495
|
+
throw _iteratorError;
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
pendingVastRequests.clear();
|
|
3500
|
+
},
|
|
2918
3501
|
resize: function resize(width, height) {
|
|
2919
3502
|
console.log("[HlsAdPlayer] Resizing to ".concat(width, "x").concat(height));
|
|
2920
3503
|
if (adContainerEl) {
|
|
@@ -2950,6 +3533,13 @@ function createHlsAdPlayer(contentVideo, options) {
|
|
|
2950
3533
|
if (adVideoElement && adPlaying) {
|
|
2951
3534
|
var clamped = Math.max(0, Math.min(1, volume));
|
|
2952
3535
|
adVideoElement.volume = clamped;
|
|
3536
|
+
var userActivation = navigator.userActivation;
|
|
3537
|
+
if (clamped > 0 && forcedMuteByAutoplay && userActivation && !userActivation.isActive) {
|
|
3538
|
+
logFunnel("unmute_blocked_without_gesture", {
|
|
3539
|
+
requestedVolume: clamped
|
|
3540
|
+
});
|
|
3541
|
+
return;
|
|
3542
|
+
}
|
|
2953
3543
|
adVideoElement.muted = clamped === 0;
|
|
2954
3544
|
}
|
|
2955
3545
|
},
|
|
@@ -7019,7 +7609,7 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
7019
7609
|
{
|
|
7020
7610
|
key: "adFitsRemainingBudget",
|
|
7021
7611
|
value: function adFitsRemainingBudget(durationMs) {
|
|
7022
|
-
if (durationMs <= 0) {
|
|
7612
|
+
if (durationMs <= 0 || this.expectedAdBreakDurationMs == null) {
|
|
7023
7613
|
return true;
|
|
7024
7614
|
}
|
|
7025
7615
|
return durationMs <= this.getDurationBudgetRemainingMs();
|
|
@@ -7078,6 +7668,11 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
7078
7668
|
value: function markAdStarted() {
|
|
7079
7669
|
this.currentAdIndex++;
|
|
7080
7670
|
this.totalAdsInBreak = this.currentAdIndex;
|
|
7671
|
+
}
|
|
7672
|
+
},
|
|
7673
|
+
{
|
|
7674
|
+
key: "noteAdRequestSent",
|
|
7675
|
+
value: function noteAdRequestSent() {
|
|
7081
7676
|
this.totalAdRequestsInBreak++;
|
|
7082
7677
|
this.lastAdRequestTime = Date.now();
|
|
7083
7678
|
}
|
|
@@ -7129,6 +7724,9 @@ var AdTimingService = /*#__PURE__*/ function() {
|
|
|
7129
7724
|
if (message.includes("timeout")) {
|
|
7130
7725
|
return true;
|
|
7131
7726
|
}
|
|
7727
|
+
if (message.includes("ad player destroyed") || message.includes("aborted")) {
|
|
7728
|
+
return true;
|
|
7729
|
+
}
|
|
7132
7730
|
if (message.includes("rate limit") || message.includes("too many requests")) {
|
|
7133
7731
|
return true;
|
|
7134
7732
|
}
|
|
@@ -8262,6 +8860,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8262
8860
|
this.adDetectSentForCurrentBreak = false;
|
|
8263
8861
|
this.continuousFetchingActive = false;
|
|
8264
8862
|
this.continuousFetchLoopRunning = false;
|
|
8863
|
+
this.breakFunnel = {};
|
|
8864
|
+
this.controllerCallInFlight = false;
|
|
8865
|
+
this.playbackStartedForCurrentRequest = false;
|
|
8866
|
+
this.opportunityEpoch = -1;
|
|
8265
8867
|
this.adRequestQueue = [];
|
|
8266
8868
|
this.adPodQueue = [];
|
|
8267
8869
|
this.maxPlaceholderDurationMs = 5e3;
|
|
@@ -8314,12 +8916,35 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8314
8916
|
adPlayer.on("ad_interaction", function(event) {
|
|
8315
8917
|
if (event) _this.host.onAdInteraction(event);
|
|
8316
8918
|
});
|
|
8317
|
-
adPlayer.on("
|
|
8318
|
-
|
|
8919
|
+
adPlayer.on("ad_funnel", function(payload) {
|
|
8920
|
+
if (!(payload === null || payload === void 0 ? void 0 : payload.stage)) return;
|
|
8921
|
+
_this.countFunnelStage(payload.stage);
|
|
8922
|
+
if (payload.reason) {
|
|
8923
|
+
_this.countFunnelStage("".concat(payload.stage, ":").concat(payload.reason));
|
|
8924
|
+
}
|
|
8925
|
+
if (payload.stage === "impression_fired" && payload.pixelCount != null) {
|
|
8926
|
+
_this.countFunnelStage("impression_urls", payload.pixelCount);
|
|
8927
|
+
}
|
|
8928
|
+
if (payload.visibilityState === "hidden") {
|
|
8929
|
+
_this.countFunnelStage("while_hidden");
|
|
8930
|
+
}
|
|
8931
|
+
});
|
|
8932
|
+
adPlayer.on("ad_impression", function() {
|
|
8933
|
+
_this.timing.consecutiveFailures = 0;
|
|
8934
|
+
if (!_this.playbackStartedForCurrentRequest) {
|
|
8935
|
+
_this.playbackStartedForCurrentRequest = true;
|
|
8936
|
+
_this.timing.markAdStarted();
|
|
8937
|
+
}
|
|
8938
|
+
sendAdImpressionTracking(_this.host.config.licenseKey, _object_spread_props(_object_spread({
|
|
8319
8939
|
source: "hls",
|
|
8320
|
-
adIndex: _this.timing.currentAdIndex
|
|
8940
|
+
adIndex: _this.timing.currentAdIndex
|
|
8941
|
+
}, _this.currentVastUrl ? {
|
|
8942
|
+
adUrl: _this.currentVastUrl
|
|
8943
|
+
} : {}), {
|
|
8321
8944
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
8322
|
-
}, _this.analyticsContext).catch(function() {});
|
|
8945
|
+
}), _this.analyticsContext).catch(function() {});
|
|
8946
|
+
});
|
|
8947
|
+
adPlayer.on("all_ads_completed", function() {
|
|
8323
8948
|
_this.timing.recordPlayedAdDuration(_this.host.getAdPlayer());
|
|
8324
8949
|
var remaining = _this.timing.getRemainingAdMs();
|
|
8325
8950
|
_this.timing.consecutiveFailures = 0;
|
|
@@ -8353,6 +8978,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8353
8978
|
}
|
|
8354
8979
|
}
|
|
8355
8980
|
console.error("[AD-ERROR]", errorMessage, errorPayload || "");
|
|
8981
|
+
if (_this.controllerCallInFlight) {
|
|
8982
|
+
_this.timing.recordGamNoFill();
|
|
8983
|
+
return;
|
|
8984
|
+
}
|
|
8356
8985
|
_this.handleAdFailure();
|
|
8357
8986
|
});
|
|
8358
8987
|
adPlayer.on("content_pause", function() {
|
|
@@ -8377,11 +9006,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8377
9006
|
}
|
|
8378
9007
|
});
|
|
8379
9008
|
adPlayer.on("content_resume", function() {
|
|
8380
|
-
sendAdImpressionTracking(_this.host.config.licenseKey, {
|
|
8381
|
-
source: "hls",
|
|
8382
|
-
adIndex: _this.timing.currentAdIndex,
|
|
8383
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
8384
|
-
}, _this.analyticsContext).catch(function() {});
|
|
8385
9009
|
if (!_this.host.video.muted) {
|
|
8386
9010
|
_this.host.video.muted = true;
|
|
8387
9011
|
if (_this.debug) {
|
|
@@ -8429,6 +9053,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8429
9053
|
}
|
|
8430
9054
|
var preservedMutedState = adPlayer.getOriginalMutedState();
|
|
8431
9055
|
var preservedVolumeState = adPlayer.getOriginalVolume();
|
|
9056
|
+
this.playbackStartedForCurrentRequest = false;
|
|
8432
9057
|
if (adPlayer) {
|
|
8433
9058
|
try {
|
|
8434
9059
|
adPlayer.destroy();
|
|
@@ -8518,9 +9143,10 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8518
9143
|
if (this.timing.expectedAdBreakDurationMs == null && adBreakDurationMs != null) {
|
|
8519
9144
|
this.timing.expectedAdBreakDurationMs = adBreakDurationMs;
|
|
8520
9145
|
}
|
|
9146
|
+
this.noteOpportunity("scte35", this.cueManager.activeScte35BreakKey);
|
|
8521
9147
|
return [
|
|
8522
9148
|
4,
|
|
8523
|
-
this.startOptimizedPod(baseVastUrl, adBreakDurationMs
|
|
9149
|
+
this.startOptimizedPod(baseVastUrl, adBreakDurationMs)
|
|
8524
9150
|
];
|
|
8525
9151
|
case 1:
|
|
8526
9152
|
podPlayed = _state.sent();
|
|
@@ -8554,7 +9180,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8554
9180
|
value: // ───────────────────────────────────────────────────────────────
|
|
8555
9181
|
// Optimized pod (single multi-ad request)
|
|
8556
9182
|
// ───────────────────────────────────────────────────────────────
|
|
8557
|
-
function startOptimizedPod(baseVastUrl, breakDurationMs
|
|
9183
|
+
function startOptimizedPod(baseVastUrl, breakDurationMs) {
|
|
8558
9184
|
return _async_to_generator(function() {
|
|
8559
9185
|
var podUrl, adPlayer, requestToken, _ref, _adPlayer_getPodAdCount, podCount, error;
|
|
8560
9186
|
return _ts_generator(this, function(_state) {
|
|
@@ -8577,7 +9203,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8577
9203
|
adPlayer = this.host.getAdPlayer();
|
|
8578
9204
|
requestToken = ++this.timing.adRequestTokenCounter;
|
|
8579
9205
|
this.timing.activeAdRequestToken = requestToken;
|
|
8580
|
-
this.
|
|
9206
|
+
this.currentVastUrl = podUrl;
|
|
8581
9207
|
_state.label = 1;
|
|
8582
9208
|
case 1:
|
|
8583
9209
|
_state.trys.push([
|
|
@@ -8592,10 +9218,14 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8592
9218
|
];
|
|
8593
9219
|
case 2:
|
|
8594
9220
|
_state.sent();
|
|
8595
|
-
this.timing.
|
|
9221
|
+
this.timing.startAdRequestWatchdog(requestToken);
|
|
9222
|
+
this.timing.noteAdRequestSent();
|
|
9223
|
+
this.beginFunnelRequest(adPlayer, requestToken);
|
|
8596
9224
|
return [
|
|
8597
9225
|
4,
|
|
8598
|
-
|
|
9226
|
+
this.callController(function() {
|
|
9227
|
+
return adPlayer.requestAds(podUrl);
|
|
9228
|
+
})
|
|
8599
9229
|
];
|
|
8600
9230
|
case 3:
|
|
8601
9231
|
_state.sent();
|
|
@@ -8624,16 +9254,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8624
9254
|
this.timing.startAdFailsafeTimer(requestToken);
|
|
8625
9255
|
return [
|
|
8626
9256
|
4,
|
|
8627
|
-
|
|
9257
|
+
this.callController(function() {
|
|
9258
|
+
return adPlayer.play();
|
|
9259
|
+
})
|
|
8628
9260
|
];
|
|
8629
9261
|
case 4:
|
|
8630
9262
|
_state.sent();
|
|
8631
|
-
this.timing.markAdStarted();
|
|
8632
9263
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
8633
9264
|
this.timing.scheduleAdStopAtBreakBoundary();
|
|
8634
9265
|
}
|
|
8635
|
-
adPlayer.setAdVolume(
|
|
8636
|
-
this.timing.consecutiveFailures = 0;
|
|
9266
|
+
adPlayer.setAdVolume(getAdAudioVolume(adPlayer));
|
|
8637
9267
|
this.continuousFetchingActive = true;
|
|
8638
9268
|
this.startContinuousFetching(baseVastUrl);
|
|
8639
9269
|
return [
|
|
@@ -8998,7 +9628,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
8998
9628
|
];
|
|
8999
9629
|
case 3:
|
|
9000
9630
|
_state.sent();
|
|
9001
|
-
this.timing.consecutiveFailures = 0;
|
|
9002
9631
|
return [
|
|
9003
9632
|
3,
|
|
9004
9633
|
8
|
|
@@ -9011,6 +9640,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9011
9640
|
3,
|
|
9012
9641
|
6
|
|
9013
9642
|
];
|
|
9643
|
+
this.timing.consecutiveFailures++;
|
|
9014
9644
|
return [
|
|
9015
9645
|
4,
|
|
9016
9646
|
this.tryNextAvailableAdWithRateLimit()
|
|
@@ -9080,13 +9710,159 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9080
9710
|
}
|
|
9081
9711
|
},
|
|
9082
9712
|
{
|
|
9083
|
-
|
|
9084
|
-
value: // ───────────────────────────────────────────────────────────────
|
|
9713
|
+
// ───────────────────────────────────────────────────────────────
|
|
9085
9714
|
// Single ad playback
|
|
9086
9715
|
// ───────────────────────────────────────────────────────────────
|
|
9087
|
-
|
|
9716
|
+
key: "withCurrentPodBudget",
|
|
9717
|
+
value: function withCurrentPodBudget(vastTagUrl) {
|
|
9718
|
+
var remaining = Math.min(this.timing.getWallClockRemainingAdMs(), this.timing.getDurationBudgetRemainingMs());
|
|
9719
|
+
if (!(remaining > 0)) return vastTagUrl;
|
|
9720
|
+
try {
|
|
9721
|
+
var url = new URL(vastTagUrl);
|
|
9722
|
+
if (!url.searchParams.has("pmxd")) return vastTagUrl;
|
|
9723
|
+
var maxMs = Math.round(remaining);
|
|
9724
|
+
url.searchParams.set("pmxd", String(maxMs));
|
|
9725
|
+
var minMs = Number(url.searchParams.get("pmnd"));
|
|
9726
|
+
if (Number.isFinite(minMs) && minMs > maxMs) {
|
|
9727
|
+
url.searchParams.set("pmnd", String(maxMs));
|
|
9728
|
+
}
|
|
9729
|
+
return url.toString();
|
|
9730
|
+
} catch (unused) {
|
|
9731
|
+
return vastTagUrl;
|
|
9732
|
+
}
|
|
9733
|
+
}
|
|
9734
|
+
},
|
|
9735
|
+
{
|
|
9736
|
+
key: "countFunnelStage",
|
|
9737
|
+
value: function countFunnelStage(stage) {
|
|
9738
|
+
var amount = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
9739
|
+
var _this_breakFunnel_stage;
|
|
9740
|
+
this.breakFunnel[stage] = ((_this_breakFunnel_stage = this.breakFunnel[stage]) !== null && _this_breakFunnel_stage !== void 0 ? _this_breakFunnel_stage : 0) + amount;
|
|
9741
|
+
}
|
|
9742
|
+
},
|
|
9743
|
+
{
|
|
9744
|
+
key: "logOrchestratorFunnel",
|
|
9745
|
+
value: function logOrchestratorFunnel(stage) {
|
|
9746
|
+
var extra = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
9747
|
+
this.countFunnelStage(stage);
|
|
9748
|
+
console.log("[AdBreak][FUNNEL] ".concat(stage), _object_spread({
|
|
9749
|
+
breakId: this.timing.adBreakEpoch,
|
|
9750
|
+
requestId: this.currentRequestId,
|
|
9751
|
+
visibilityState: typeof document !== "undefined" ? document.visibilityState : void 0
|
|
9752
|
+
}, extra));
|
|
9753
|
+
}
|
|
9754
|
+
},
|
|
9755
|
+
{
|
|
9756
|
+
key: "noteOpportunity",
|
|
9757
|
+
value: function noteOpportunity(source, breakKey) {
|
|
9758
|
+
if (breakKey && breakKey === this.opportunityBreakKey && this.opportunityEpoch === this.timing.adBreakEpoch) {
|
|
9759
|
+
this.logOrchestratorFunnel("duplicate_break_start", {
|
|
9760
|
+
source: source,
|
|
9761
|
+
breakKey: breakKey
|
|
9762
|
+
});
|
|
9763
|
+
return;
|
|
9764
|
+
}
|
|
9765
|
+
this.opportunityBreakKey = breakKey;
|
|
9766
|
+
this.opportunityEpoch = this.timing.adBreakEpoch;
|
|
9767
|
+
this.logOrchestratorFunnel("opportunity_created", {
|
|
9768
|
+
source: source,
|
|
9769
|
+
breakKey: breakKey,
|
|
9770
|
+
expectedDurationMs: this.timing.expectedAdBreakDurationMs
|
|
9771
|
+
});
|
|
9772
|
+
}
|
|
9773
|
+
},
|
|
9774
|
+
{
|
|
9775
|
+
key: "beginFunnelRequest",
|
|
9776
|
+
value: function beginFunnelRequest(adPlayer, requestToken) {
|
|
9777
|
+
var _adPlayer_setFunnelContext;
|
|
9778
|
+
if (this.controllerCallInFlight) {
|
|
9779
|
+
this.logOrchestratorFunnel("duplicate_request_detected", {
|
|
9780
|
+
newRequestId: requestToken
|
|
9781
|
+
});
|
|
9782
|
+
}
|
|
9783
|
+
this.currentRequestId = requestToken;
|
|
9784
|
+
this.requestStartedAt = Date.now();
|
|
9785
|
+
(_adPlayer_setFunnelContext = adPlayer.setFunnelContext) === null || _adPlayer_setFunnelContext === void 0 ? void 0 : _adPlayer_setFunnelContext.call(adPlayer, {
|
|
9786
|
+
breakId: this.timing.adBreakEpoch,
|
|
9787
|
+
requestId: requestToken
|
|
9788
|
+
});
|
|
9789
|
+
}
|
|
9790
|
+
},
|
|
9791
|
+
{
|
|
9792
|
+
key: "isAdLoadingWithoutPlayback",
|
|
9793
|
+
value: function isAdLoadingWithoutPlayback() {
|
|
9794
|
+
return this.host.getAdPlayer().isAdPlaying() && !this.playbackStartedForCurrentRequest;
|
|
9795
|
+
}
|
|
9796
|
+
},
|
|
9797
|
+
{
|
|
9798
|
+
key: "noteStopBeforeStart",
|
|
9799
|
+
value: function noteStopBeforeStart(reason) {
|
|
9800
|
+
if (!this.isAdLoadingWithoutPlayback()) return;
|
|
9801
|
+
this.logOrchestratorFunnel("ad_stopped_before_start", {
|
|
9802
|
+
reason: reason,
|
|
9803
|
+
elapsedSinceRequestMs: this.requestStartedAt != null ? Date.now() - this.requestStartedAt : void 0
|
|
9804
|
+
});
|
|
9805
|
+
}
|
|
9806
|
+
},
|
|
9807
|
+
{
|
|
9808
|
+
key: "handleRequestWatchdogTimeout",
|
|
9809
|
+
value: function handleRequestWatchdogTimeout() {
|
|
9810
|
+
var adPlayer = this.host.getAdPlayer();
|
|
9811
|
+
if (this.controllerCallInFlight && adPlayer.abortPendingRequest) {
|
|
9812
|
+
this.logOrchestratorFunnel("request_aborted_timeout", {
|
|
9813
|
+
elapsedSinceRequestMs: this.requestStartedAt != null ? Date.now() - this.requestStartedAt : void 0
|
|
9814
|
+
});
|
|
9815
|
+
adPlayer.abortPendingRequest("VAST request aborted after request watchdog timeout");
|
|
9816
|
+
return;
|
|
9817
|
+
}
|
|
9818
|
+
this.handleAdFailure();
|
|
9819
|
+
}
|
|
9820
|
+
},
|
|
9821
|
+
{
|
|
9822
|
+
key: "callController",
|
|
9823
|
+
value: function callController(call) {
|
|
9088
9824
|
return _async_to_generator(function() {
|
|
9089
|
-
|
|
9825
|
+
return _ts_generator(this, function(_state) {
|
|
9826
|
+
switch(_state.label){
|
|
9827
|
+
case 0:
|
|
9828
|
+
this.controllerCallInFlight = true;
|
|
9829
|
+
_state.label = 1;
|
|
9830
|
+
case 1:
|
|
9831
|
+
_state.trys.push([
|
|
9832
|
+
1,
|
|
9833
|
+
,
|
|
9834
|
+
3,
|
|
9835
|
+
4
|
|
9836
|
+
]);
|
|
9837
|
+
return [
|
|
9838
|
+
4,
|
|
9839
|
+
call()
|
|
9840
|
+
];
|
|
9841
|
+
case 2:
|
|
9842
|
+
_state.sent();
|
|
9843
|
+
return [
|
|
9844
|
+
3,
|
|
9845
|
+
4
|
|
9846
|
+
];
|
|
9847
|
+
case 3:
|
|
9848
|
+
this.controllerCallInFlight = false;
|
|
9849
|
+
return [
|
|
9850
|
+
7
|
|
9851
|
+
];
|
|
9852
|
+
case 4:
|
|
9853
|
+
return [
|
|
9854
|
+
2
|
|
9855
|
+
];
|
|
9856
|
+
}
|
|
9857
|
+
});
|
|
9858
|
+
}).call(this);
|
|
9859
|
+
}
|
|
9860
|
+
},
|
|
9861
|
+
{
|
|
9862
|
+
key: "playSingleAd",
|
|
9863
|
+
value: function playSingleAd(vastTagUrl) {
|
|
9864
|
+
return _async_to_generator(function() {
|
|
9865
|
+
var adPlayer, requestToken, ap, requestUrl, _ap_getLoadedAdDuration, adDurationS, remainingMs, playError, error, errorMessage;
|
|
9090
9866
|
return _ts_generator(this, function(_state) {
|
|
9091
9867
|
switch(_state.label){
|
|
9092
9868
|
case 0:
|
|
@@ -9113,7 +9889,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9113
9889
|
this.recreateAdController();
|
|
9114
9890
|
requestToken = ++this.timing.adRequestTokenCounter;
|
|
9115
9891
|
this.timing.activeAdRequestToken = requestToken;
|
|
9116
|
-
this.timing.startAdRequestWatchdog(requestToken);
|
|
9117
9892
|
_state.label = 1;
|
|
9118
9893
|
case 1:
|
|
9119
9894
|
_state.trys.push([
|
|
@@ -9128,17 +9903,23 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9128
9903
|
];
|
|
9129
9904
|
case 2:
|
|
9130
9905
|
_state.sent();
|
|
9131
|
-
this.timing.
|
|
9906
|
+
this.timing.startAdRequestWatchdog(requestToken);
|
|
9907
|
+
this.timing.noteAdRequestSent();
|
|
9132
9908
|
ap = this.host.getAdPlayer();
|
|
9909
|
+
requestUrl = this.withCurrentPodBudget(vastTagUrl);
|
|
9910
|
+
this.currentVastUrl = requestUrl;
|
|
9911
|
+
this.beginFunnelRequest(ap, requestToken);
|
|
9133
9912
|
return [
|
|
9134
9913
|
4,
|
|
9135
|
-
|
|
9914
|
+
this.callController(function() {
|
|
9915
|
+
return ap.requestAds(requestUrl);
|
|
9916
|
+
})
|
|
9136
9917
|
];
|
|
9137
9918
|
case 3:
|
|
9138
9919
|
_state.sent();
|
|
9139
9920
|
sendAdLoadedTracking(this.host.config.licenseKey, {
|
|
9140
9921
|
source: "hls",
|
|
9141
|
-
vastUrl:
|
|
9922
|
+
vastUrl: requestUrl,
|
|
9142
9923
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
9143
9924
|
}, this.analyticsContext).catch(function() {});
|
|
9144
9925
|
this.timing.clearAdRequestWatchdog();
|
|
@@ -9146,6 +9927,14 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9146
9927
|
2
|
|
9147
9928
|
];
|
|
9148
9929
|
if (!this.timing.ensureLoadedAdFitsBudget(ap)) {
|
|
9930
|
+
;
|
|
9931
|
+
adDurationS = (_ap_getLoadedAdDuration = ap.getLoadedAdDuration) === null || _ap_getLoadedAdDuration === void 0 ? void 0 : _ap_getLoadedAdDuration.call(ap);
|
|
9932
|
+
remainingMs = Math.min(this.timing.getWallClockRemainingAdMs(), this.timing.getDurationBudgetRemainingMs());
|
|
9933
|
+
this.logOrchestratorFunnel("discarded_budget", {
|
|
9934
|
+
vastUrl: requestUrl,
|
|
9935
|
+
adDurationMs: adDurationS != null ? adDurationS * 1e3 : void 0,
|
|
9936
|
+
remainingMs: remainingMs
|
|
9937
|
+
});
|
|
9149
9938
|
this.timing.rejectLoadedAdForDuration(ap);
|
|
9150
9939
|
this.recreateAdController();
|
|
9151
9940
|
throw new Error("ad_duration_exceeds_budget");
|
|
@@ -9161,16 +9950,16 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9161
9950
|
this.timing.startAdFailsafeTimer(requestToken);
|
|
9162
9951
|
return [
|
|
9163
9952
|
4,
|
|
9164
|
-
|
|
9953
|
+
this.callController(function() {
|
|
9954
|
+
return ap.play();
|
|
9955
|
+
})
|
|
9165
9956
|
];
|
|
9166
9957
|
case 5:
|
|
9167
9958
|
_state.sent();
|
|
9168
|
-
this.timing.markAdStarted();
|
|
9169
9959
|
if (this.timing.expectedAdBreakDurationMs != null && this.timing.getAdBreakEndWallClockMs() == null) {
|
|
9170
9960
|
this.timing.scheduleAdStopAtBreakBoundary();
|
|
9171
9961
|
}
|
|
9172
9962
|
ap.setAdVolume(getAdAudioVolume(ap));
|
|
9173
|
-
this.timing.consecutiveFailures = 0;
|
|
9174
9963
|
this.timing.temporaryFailureUrls.delete(vastTagUrl);
|
|
9175
9964
|
return [
|
|
9176
9965
|
3,
|
|
@@ -9334,7 +10123,6 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9334
10123
|
];
|
|
9335
10124
|
case 5:
|
|
9336
10125
|
_state.sent();
|
|
9337
|
-
this.timing.consecutiveFailures = 0;
|
|
9338
10126
|
return [
|
|
9339
10127
|
3,
|
|
9340
10128
|
10
|
|
@@ -9346,6 +10134,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9346
10134
|
3,
|
|
9347
10135
|
8
|
|
9348
10136
|
];
|
|
10137
|
+
this.timing.consecutiveFailures++;
|
|
9349
10138
|
return [
|
|
9350
10139
|
4,
|
|
9351
10140
|
this.tryNextAvailableAdWithRateLimit()
|
|
@@ -9396,6 +10185,67 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9396
10185
|
// ───────────────────────────────────────────────────────────────
|
|
9397
10186
|
// Ad break completion
|
|
9398
10187
|
// ───────────────────────────────────────────────────────────────
|
|
10188
|
+
key: "logBreakFunnel",
|
|
10189
|
+
value: function logBreakFunnel() {
|
|
10190
|
+
var funnel = this.breakFunnel;
|
|
10191
|
+
this.breakFunnel = {};
|
|
10192
|
+
if (Object.keys(funnel).length === 0) return;
|
|
10193
|
+
var count = function count(stage) {
|
|
10194
|
+
var _funnel_stage;
|
|
10195
|
+
return (_funnel_stage = funnel[stage]) !== null && _funnel_stage !== void 0 ? _funnel_stage : 0;
|
|
10196
|
+
};
|
|
10197
|
+
var breakId = this.opportunityEpoch;
|
|
10198
|
+
if (count("request_sent") > 0 && count("impression_fired") === 0) {
|
|
10199
|
+
console.log("[AdBreak][FUNNEL] break_abandoned_before_start", {
|
|
10200
|
+
breakId: breakId,
|
|
10201
|
+
requests: count("request_sent")
|
|
10202
|
+
});
|
|
10203
|
+
}
|
|
10204
|
+
console.log("[AdBreak][FUNNEL] Break summary", {
|
|
10205
|
+
breakId: breakId,
|
|
10206
|
+
opportunities: count("opportunity_created"),
|
|
10207
|
+
requests: count("request_sent"),
|
|
10208
|
+
duplicates: count("duplicate_request_detected") + count("duplicate_break_start"),
|
|
10209
|
+
filled: count("vast_received"),
|
|
10210
|
+
noFill: count("no_fill"),
|
|
10211
|
+
requestFailed: count("request_failed"),
|
|
10212
|
+
requestAbortedTimeout: count("request_aborted_timeout"),
|
|
10213
|
+
credentialsRetries: count("vast_credentials_retry"),
|
|
10214
|
+
wrapperFailures: count("wrapper_fetch:failure"),
|
|
10215
|
+
noSupportedMedia: count("vast_no_supported_media"),
|
|
10216
|
+
vpaidOnly: count("vast_no_supported_media:vpaid_only"),
|
|
10217
|
+
missingImpression: count("vast_missing_impression"),
|
|
10218
|
+
discardedBudget: count("discarded_budget"),
|
|
10219
|
+
mediaCandidates: count("media_candidate:accepted") + count("media_candidate:rejected"),
|
|
10220
|
+
mediaRejected: count("media_candidate:rejected"),
|
|
10221
|
+
mediaFallbacks: count("media_fallback"),
|
|
10222
|
+
playCalled: count("play_called"),
|
|
10223
|
+
playRejected: count("play_rejected"),
|
|
10224
|
+
mutedRetry: count("muted_retry"),
|
|
10225
|
+
startTimeouts: count("play_resolved_but_never_started"),
|
|
10226
|
+
impressions: count("impression_fired"),
|
|
10227
|
+
impressionUrls: count("impression_urls"),
|
|
10228
|
+
trackingRequests: count("tracking_request_created"),
|
|
10229
|
+
trackingNotLoaded: count("tracking_request_settled:error") + count("tracking_request_settled:timeout"),
|
|
10230
|
+
trackingUnexpandedMacros: count("tracking_url_unexpanded_macro"),
|
|
10231
|
+
trackingInvalidUrls: count("tracking_url_invalid"),
|
|
10232
|
+
vastAdFallbacks: count("vast_ad_fallback"),
|
|
10233
|
+
mediaEvents: count("media_event"),
|
|
10234
|
+
quartile25: count("first_quartile"),
|
|
10235
|
+
quartile50: count("midpoint"),
|
|
10236
|
+
quartile75: count("third_quartile"),
|
|
10237
|
+
complete: count("complete"),
|
|
10238
|
+
stoppedBeforeStart: count("stopped_before_start"),
|
|
10239
|
+
stoppedBeforeStartByBreakEnd: count("ad_stopped_before_start"),
|
|
10240
|
+
unexpectedUnmutes: count("unexpected_unmute"),
|
|
10241
|
+
unmuteBlocked: count("unmute_blocked_without_gesture"),
|
|
10242
|
+
visibilityHidden: count("while_hidden"),
|
|
10243
|
+
playbackFailures: count("play_failed") + count("media_error") + count("hls_fatal") + count("stall") + count("decode_failure") + count("media_unsupported"),
|
|
10244
|
+
stages: funnel
|
|
10245
|
+
});
|
|
10246
|
+
}
|
|
10247
|
+
},
|
|
10248
|
+
{
|
|
9399
10249
|
key: "handleAdPodComplete",
|
|
9400
10250
|
value: function handleAdPodComplete() {
|
|
9401
10251
|
if (this.debug) {
|
|
@@ -9416,6 +10266,7 @@ var AdBreakOrchestrator = /*#__PURE__*/ function() {
|
|
|
9416
10266
|
this.adPodQueue = [];
|
|
9417
10267
|
this.showAds = false;
|
|
9418
10268
|
this.host.getAdPlayer().stop().catch(function() {});
|
|
10269
|
+
this.logBreakFunnel();
|
|
9419
10270
|
var restoredMuted = this.host.getAdPlayer().getOriginalMutedState();
|
|
9420
10271
|
var restoredVolume = this.host.getAdPlayer().getOriginalVolume();
|
|
9421
10272
|
if (this.host.video.muted !== restoredMuted) {
|
|
@@ -9767,7 +10618,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9767
10618
|
_this.startScte35AdBreak(marker, cueKey, marker.durationSeconds != null ? marker.durationSeconds * 1e3 : _this.timing.expectedAdBreakDurationMs);
|
|
9768
10619
|
},
|
|
9769
10620
|
onWatchdogTimeout: function onWatchdogTimeout() {
|
|
9770
|
-
return _this.adBreak.
|
|
10621
|
+
return _this.adBreak.handleRequestWatchdogTimeout();
|
|
9771
10622
|
},
|
|
9772
10623
|
onFailsafeTimeout: function onFailsafeTimeout() {
|
|
9773
10624
|
return _this.adBreak.handleAdFailure();
|
|
@@ -9872,6 +10723,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
9872
10723
|
licenseKey: this.config.licenseKey
|
|
9873
10724
|
} : {}, ((_this_hlsEngine = this.hlsEngine) === null || _this_hlsEngine === void 0 ? void 0 : _this_hlsEngine.hls) ? {
|
|
9874
10725
|
mainHlsInstance: this.hlsEngine.hls
|
|
10726
|
+
} : {}, this.config.adMediaStartTimeoutMs != null ? {
|
|
10727
|
+
mediaStartTimeoutMs: this.config.adMediaStartTimeoutMs
|
|
9875
10728
|
} : {}));
|
|
9876
10729
|
}
|
|
9877
10730
|
},
|
|
@@ -10226,6 +11079,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
10226
11079
|
this.timing.clearAdStartTimer();
|
|
10227
11080
|
this.timing.clearAdStopTimer();
|
|
10228
11081
|
if (adPlaying) {
|
|
11082
|
+
this.adBreak.noteStopBeforeStart("scte_end");
|
|
10229
11083
|
this.adPlayer.stop().catch(function() {});
|
|
10230
11084
|
}
|
|
10231
11085
|
this.adBreak.handleAdPodComplete();
|
|
@@ -10265,6 +11119,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
10265
11119
|
console.log("[StormcloudVideoPlayer] Ad break boundary reached (overrun=".concat(overrunMs, "ms) - hard-stopping ads and resuming stream"));
|
|
10266
11120
|
}
|
|
10267
11121
|
if (adPlaying) {
|
|
11122
|
+
this.adBreak.noteStopBeforeStart("break_boundary");
|
|
10268
11123
|
this.adPlayer.stop().catch(function() {});
|
|
10269
11124
|
}
|
|
10270
11125
|
this.adBreak.handleAdPodComplete();
|
|
@@ -10393,6 +11248,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
10393
11248
|
this.adBreak.showAds = true;
|
|
10394
11249
|
this.adBreak.inAdBreak = true;
|
|
10395
11250
|
this.timing.currentAdBreakStartWallClockMs = Date.now();
|
|
11251
|
+
if (durationMs > 0) {
|
|
11252
|
+
this.timing.setAdBreakDurationBoundary(durationMs);
|
|
11253
|
+
}
|
|
11254
|
+
this.adBreak.noteOpportunity("vmap", key);
|
|
10396
11255
|
_state.label = 1;
|
|
10397
11256
|
case 1:
|
|
10398
11257
|
_state.trys.push([
|