stormcloud-video-player 0.3.19 → 0.3.21
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 +1 -1
- package/lib/index.cjs +8075 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.cts +3872 -0
- package/lib/index.d.ts +3872 -0
- package/lib/index.js +7881 -0
- package/lib/index.js.map +1 -0
- package/lib/player/StormcloudVideoPlayer.cjs +17 -718
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +0 -17
- package/lib/players/FilePlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +17 -706
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +17 -706
- package/lib/players/index.cjs.map +1 -1
- package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
- package/lib/sdk/ima.cjs +11 -4
- package/lib/sdk/ima.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +17 -718
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/utils/browserCompat.cjs.map +1 -1
- package/lib/utils/polyfills.cjs.map +1 -1
- package/lib/utils/tracking.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -7,9 +7,6 @@ function _array_like_to_array(arr, len) {
|
|
|
7
7
|
function _array_with_holes(arr) {
|
|
8
8
|
if (Array.isArray(arr)) return arr;
|
|
9
9
|
}
|
|
10
|
-
function _array_without_holes(arr) {
|
|
11
|
-
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
12
|
-
}
|
|
13
10
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
14
11
|
try {
|
|
15
12
|
var info = gen[key](arg);
|
|
@@ -78,9 +75,6 @@ function _instanceof(left, right) {
|
|
|
78
75
|
return left instanceof right;
|
|
79
76
|
}
|
|
80
77
|
}
|
|
81
|
-
function _iterable_to_array(iter) {
|
|
82
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
83
|
-
}
|
|
84
78
|
function _iterable_to_array_limit(arr, i) {
|
|
85
79
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
86
80
|
if (_i == null) return;
|
|
@@ -108,9 +102,6 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
108
102
|
function _non_iterable_rest() {
|
|
109
103
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
110
104
|
}
|
|
111
|
-
function _non_iterable_spread() {
|
|
112
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
113
|
-
}
|
|
114
105
|
function _object_spread(target) {
|
|
115
106
|
for(var i = 1; i < arguments.length; i++){
|
|
116
107
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -180,9 +171,6 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
180
171
|
function _sliced_to_array(arr, i) {
|
|
181
172
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
182
173
|
}
|
|
183
|
-
function _to_consumable_array(arr) {
|
|
184
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
185
|
-
}
|
|
186
174
|
function _type_of(obj) {
|
|
187
175
|
"@swc/helpers - typeof";
|
|
188
176
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
@@ -687,10 +675,17 @@ function createImaController(video, options) {
|
|
|
687
675
|
var adsLoadedReject;
|
|
688
676
|
function makeAdsRequest(google, vastTagUrl) {
|
|
689
677
|
var adsRequest = new google.ima.AdsRequest();
|
|
690
|
-
|
|
691
|
-
|
|
678
|
+
var preloadedXml = preloadedVast.get(vastTagUrl);
|
|
679
|
+
if (preloadedXml) {
|
|
680
|
+
console.log("[IMA] \uD83D\uDCE6 Using preloaded VAST response");
|
|
681
|
+
adsRequest.adsResponse = preloadedXml;
|
|
682
|
+
preloadedVast.delete(vastTagUrl);
|
|
683
|
+
} else {
|
|
684
|
+
console.log("[IMA] \uD83D\uDCE1 Requesting VAST from URL (letting IMA fetch fresh)");
|
|
685
|
+
adsRequest.adTagUrl = vastTagUrl;
|
|
686
|
+
}
|
|
692
687
|
var videoWidth = video.offsetWidth || video.clientWidth || 640;
|
|
693
|
-
var videoHeight = video.offsetHeight || video.clientHeight ||
|
|
688
|
+
var videoHeight = video.offsetHeight || video.clientHeight || 480;
|
|
694
689
|
adsRequest.linearAdSlotWidth = videoWidth;
|
|
695
690
|
adsRequest.linearAdSlotHeight = videoHeight;
|
|
696
691
|
adsRequest.nonLinearAdSlotWidth = videoWidth;
|
|
@@ -1139,7 +1134,7 @@ function createImaController(video, options) {
|
|
|
1139
1134
|
}
|
|
1140
1135
|
try {
|
|
1141
1136
|
width = video.clientWidth || 640;
|
|
1142
|
-
height = video.clientHeight ||
|
|
1137
|
+
height = video.clientHeight || 480;
|
|
1143
1138
|
adsManager.init(width, height, window.google.ima.ViewMode.NORMAL);
|
|
1144
1139
|
adPlaying = true;
|
|
1145
1140
|
adVolume = originalMutedState ? 0 : originalVolume;
|
|
@@ -2767,18 +2762,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2767
2762
|
this.bufferedSegmentsCount = 0;
|
|
2768
2763
|
this.shouldAutoplayAfterBuffering = false;
|
|
2769
2764
|
this.hasInitialBufferCompleted = false;
|
|
2770
|
-
this.adPodAllUrls = [];
|
|
2771
|
-
this.preloadingAdUrls = /* @__PURE__ */ new Set();
|
|
2772
|
-
this.vastToMediaUrlMap = /* @__PURE__ */ new Map();
|
|
2773
|
-
this.preloadedMediaUrls = /* @__PURE__ */ new Set();
|
|
2774
|
-
this.preloadingMediaUrls = /* @__PURE__ */ new Set();
|
|
2775
2765
|
this.adRequestTokenCounter = 0;
|
|
2776
2766
|
this.activeAdRequestToken = null;
|
|
2777
2767
|
this.adRequestWatchdogToken = null;
|
|
2778
2768
|
this.adFailsafeToken = null;
|
|
2779
|
-
this.fetchedAdDurations = /* @__PURE__ */ new Map();
|
|
2780
|
-
this.targetAdBreakDurationMs = null;
|
|
2781
|
-
this.isAdaptiveMode = false;
|
|
2782
2769
|
this.failedVastUrls = /* @__PURE__ */ new Set();
|
|
2783
2770
|
this.continuousFetchingActive = false;
|
|
2784
2771
|
this.adRequestQueue = [];
|
|
@@ -3283,25 +3270,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3283
3270
|
}
|
|
3284
3271
|
});
|
|
3285
3272
|
this.ima.on("ad_error", function(errorPayload) {
|
|
3286
|
-
var remaining = _this.getRemainingAdMs();
|
|
3287
3273
|
console.error("[AD-ERROR] Ad playback failed", errorPayload || "");
|
|
3288
|
-
|
|
3289
|
-
if (remaining > 500 && _this.adPodQueue.length > 0) {
|
|
3290
|
-
var nextPreloaded = _this.findNextPreloadedAd();
|
|
3291
|
-
if (nextPreloaded) {
|
|
3292
|
-
_this.currentAdIndex++;
|
|
3293
|
-
_this.playSingleAd(nextPreloaded).catch(function() {
|
|
3294
|
-
_this.handleAdFailure();
|
|
3295
|
-
});
|
|
3296
|
-
} else {
|
|
3297
|
-
_this.handleAdFailure();
|
|
3298
|
-
}
|
|
3299
|
-
} else {
|
|
3300
|
-
_this.handleAdFailure();
|
|
3301
|
-
}
|
|
3302
|
-
} else {
|
|
3303
|
-
_this.handleAdFailure();
|
|
3304
|
-
}
|
|
3274
|
+
_this.handleAdFailure();
|
|
3305
3275
|
});
|
|
3306
3276
|
this.ima.on("content_pause", function() {
|
|
3307
3277
|
_this.clearAdFailsafeTimer();
|
|
@@ -4032,7 +4002,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4032
4002
|
key: "handleAdStart",
|
|
4033
4003
|
value: function handleAdStart(_marker) {
|
|
4034
4004
|
return _async_to_generator(function() {
|
|
4035
|
-
var scheduled, tags, baseVastUrl, adBreakDurationMs, currentMuted, currentVolume, firstAdUrlArray, firstAdUrl, error;
|
|
4005
|
+
var scheduled, tags, baseVastUrl, adBreakDurationMs, mode, currentMuted, currentVolume, firstAdUrlArray, firstAdUrl, error;
|
|
4036
4006
|
return _ts_generator(this, function(_state) {
|
|
4037
4007
|
switch(_state.label){
|
|
4038
4008
|
case 0:
|
|
@@ -4048,26 +4018,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4048
4018
|
];
|
|
4049
4019
|
}
|
|
4050
4020
|
adBreakDurationMs = _marker.durationSeconds != null ? _marker.durationSeconds * 1e3 : scheduled === null || scheduled === void 0 ? void 0 : scheduled.durationMs;
|
|
4051
|
-
if (this.
|
|
4052
|
-
this.
|
|
4053
|
-
|
|
4054
|
-
this.fetchedAdDurations.clear();
|
|
4055
|
-
if (this.config.debugAdTiming) {
|
|
4056
|
-
console.log("[CONTINUOUS-FETCH] \uD83D\uDCFA LIVE MODE: Target duration=".concat(adBreakDurationMs, "ms | Will continuously fetch ads during break"));
|
|
4057
|
-
}
|
|
4058
|
-
} else {
|
|
4059
|
-
this.isAdaptiveMode = false;
|
|
4060
|
-
this.targetAdBreakDurationMs = null;
|
|
4061
|
-
this.fetchedAdDurations.clear();
|
|
4062
|
-
if (this.config.debugAdTiming) {
|
|
4063
|
-
console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC VOD MODE: Using fixed ad strategy");
|
|
4064
|
-
}
|
|
4021
|
+
if (this.config.debugAdTiming) {
|
|
4022
|
+
mode = this.isLiveStream ? "LIVE" : "VOD";
|
|
4023
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDCFA ".concat(mode, " MODE: Target duration=").concat(adBreakDurationMs, "ms"));
|
|
4065
4024
|
}
|
|
4066
|
-
this.adPodAllUrls = [];
|
|
4067
|
-
this.preloadingAdUrls.clear();
|
|
4068
|
-
this.vastToMediaUrlMap.clear();
|
|
4069
|
-
this.preloadedMediaUrls.clear();
|
|
4070
|
-
this.preloadingMediaUrls.clear();
|
|
4071
4025
|
this.failedVastUrls.clear();
|
|
4072
4026
|
this.adRequestQueue = [];
|
|
4073
4027
|
this.successfulAdRequests = [];
|
|
@@ -4871,10 +4825,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4871
4825
|
this.isShowingPlaceholder = false;
|
|
4872
4826
|
this.placeholderStartTimeMs = null;
|
|
4873
4827
|
}
|
|
4874
|
-
this.preloadingAdUrls.clear();
|
|
4875
|
-
this.vastToMediaUrlMap.clear();
|
|
4876
|
-
this.preloadedMediaUrls.clear();
|
|
4877
|
-
this.preloadingMediaUrls.clear();
|
|
4878
4828
|
this.adRequestQueue = [];
|
|
4879
4829
|
this.successfulAdRequests = [];
|
|
4880
4830
|
this.inAdBreak = false;
|
|
@@ -4883,7 +4833,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4883
4833
|
this.clearAdStartTimer();
|
|
4884
4834
|
this.clearAdStopTimer();
|
|
4885
4835
|
this.adPodQueue = [];
|
|
4886
|
-
this.adPodAllUrls = [];
|
|
4887
4836
|
this.showAds = false;
|
|
4888
4837
|
this.currentAdIndex = 0;
|
|
4889
4838
|
this.totalAdsInBreak = 0;
|
|
@@ -5038,651 +4987,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5038
4987
|
}, extra));
|
|
5039
4988
|
}
|
|
5040
4989
|
},
|
|
5041
|
-
{
|
|
5042
|
-
key: "fetchAndParseVastXml",
|
|
5043
|
-
value: function fetchAndParseVastXml(vastTagUrl) {
|
|
5044
|
-
return _async_to_generator(function() {
|
|
5045
|
-
var response, xmlText, error;
|
|
5046
|
-
return _ts_generator(this, function(_state) {
|
|
5047
|
-
switch(_state.label){
|
|
5048
|
-
case 0:
|
|
5049
|
-
_state.trys.push([
|
|
5050
|
-
0,
|
|
5051
|
-
3,
|
|
5052
|
-
,
|
|
5053
|
-
4
|
|
5054
|
-
]);
|
|
5055
|
-
return [
|
|
5056
|
-
4,
|
|
5057
|
-
fetch(vastTagUrl, {
|
|
5058
|
-
mode: "cors",
|
|
5059
|
-
credentials: "include",
|
|
5060
|
-
headers: {
|
|
5061
|
-
"Accept": "application/xml, text/xml, */*"
|
|
5062
|
-
},
|
|
5063
|
-
referrerPolicy: "no-referrer-when-downgrade"
|
|
5064
|
-
})
|
|
5065
|
-
];
|
|
5066
|
-
case 1:
|
|
5067
|
-
response = _state.sent();
|
|
5068
|
-
if (!response.ok) {
|
|
5069
|
-
throw new Error("Failed to fetch VAST: ".concat(response.status));
|
|
5070
|
-
}
|
|
5071
|
-
return [
|
|
5072
|
-
4,
|
|
5073
|
-
response.text()
|
|
5074
|
-
];
|
|
5075
|
-
case 2:
|
|
5076
|
-
xmlText = _state.sent();
|
|
5077
|
-
return [
|
|
5078
|
-
2,
|
|
5079
|
-
this.extractMediaUrlsFromVast(xmlText)
|
|
5080
|
-
];
|
|
5081
|
-
case 3:
|
|
5082
|
-
error = _state.sent();
|
|
5083
|
-
if (this.config.debugAdTiming) {
|
|
5084
|
-
console.warn("[StormcloudVideoPlayer] Failed to fetch/parse VAST XML: ".concat(vastTagUrl), error);
|
|
5085
|
-
}
|
|
5086
|
-
return [
|
|
5087
|
-
2,
|
|
5088
|
-
[]
|
|
5089
|
-
];
|
|
5090
|
-
case 4:
|
|
5091
|
-
return [
|
|
5092
|
-
2
|
|
5093
|
-
];
|
|
5094
|
-
}
|
|
5095
|
-
});
|
|
5096
|
-
}).call(this);
|
|
5097
|
-
}
|
|
5098
|
-
},
|
|
5099
|
-
{
|
|
5100
|
-
key: "extractMediaUrlsFromVast",
|
|
5101
|
-
value: function extractMediaUrlsFromVast(xmlText) {
|
|
5102
|
-
var mediaUrls = [];
|
|
5103
|
-
try {
|
|
5104
|
-
var parser = new DOMParser();
|
|
5105
|
-
var xmlDoc = parser.parseFromString(xmlText, "text/xml");
|
|
5106
|
-
var mediaFileElements = xmlDoc.querySelectorAll("MediaFile");
|
|
5107
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5108
|
-
try {
|
|
5109
|
-
for(var _iterator = Array.from(mediaFileElements)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5110
|
-
var mediaFile = _step.value;
|
|
5111
|
-
var _mediaFile_textContent;
|
|
5112
|
-
var url = (_mediaFile_textContent = mediaFile.textContent) === null || _mediaFile_textContent === void 0 ? void 0 : _mediaFile_textContent.trim();
|
|
5113
|
-
if (url) {
|
|
5114
|
-
var lowerUrl = url.toLowerCase();
|
|
5115
|
-
if (lowerUrl.endsWith(".mp4") || lowerUrl.endsWith(".webm") || lowerUrl.endsWith(".mov") || lowerUrl.endsWith(".avi") || lowerUrl.includes(".mp4?") || lowerUrl.includes(".webm?") || lowerUrl.includes("/mp4/") || lowerUrl.includes("type=video")) {
|
|
5116
|
-
mediaUrls.push(url);
|
|
5117
|
-
}
|
|
5118
|
-
}
|
|
5119
|
-
}
|
|
5120
|
-
} catch (err) {
|
|
5121
|
-
_didIteratorError = true;
|
|
5122
|
-
_iteratorError = err;
|
|
5123
|
-
} finally{
|
|
5124
|
-
try {
|
|
5125
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5126
|
-
_iterator.return();
|
|
5127
|
-
}
|
|
5128
|
-
} finally{
|
|
5129
|
-
if (_didIteratorError) {
|
|
5130
|
-
throw _iteratorError;
|
|
5131
|
-
}
|
|
5132
|
-
}
|
|
5133
|
-
}
|
|
5134
|
-
if (this.config.debugAdTiming && mediaUrls.length > 0) {
|
|
5135
|
-
console.log("[StormcloudVideoPlayer] Extracted ".concat(mediaUrls.length, " media URLs from VAST:"), mediaUrls);
|
|
5136
|
-
}
|
|
5137
|
-
} catch (error) {
|
|
5138
|
-
if (this.config.debugAdTiming) {
|
|
5139
|
-
console.warn("[StormcloudVideoPlayer] Failed to parse VAST XML:", error);
|
|
5140
|
-
}
|
|
5141
|
-
}
|
|
5142
|
-
return mediaUrls;
|
|
5143
|
-
}
|
|
5144
|
-
},
|
|
5145
|
-
{
|
|
5146
|
-
key: "fetchVastDuration",
|
|
5147
|
-
value: function fetchVastDuration(vastTagUrl) {
|
|
5148
|
-
return _async_to_generator(function() {
|
|
5149
|
-
var _xmlDoc_querySelector, response, xmlText, parser, xmlDoc, durationText, durationParts, durationSeconds, error;
|
|
5150
|
-
return _ts_generator(this, function(_state) {
|
|
5151
|
-
switch(_state.label){
|
|
5152
|
-
case 0:
|
|
5153
|
-
_state.trys.push([
|
|
5154
|
-
0,
|
|
5155
|
-
3,
|
|
5156
|
-
,
|
|
5157
|
-
4
|
|
5158
|
-
]);
|
|
5159
|
-
return [
|
|
5160
|
-
4,
|
|
5161
|
-
fetch(vastTagUrl, {
|
|
5162
|
-
mode: "cors",
|
|
5163
|
-
credentials: "include",
|
|
5164
|
-
headers: {
|
|
5165
|
-
"Accept": "application/xml, text/xml, */*"
|
|
5166
|
-
},
|
|
5167
|
-
referrerPolicy: "no-referrer-when-downgrade"
|
|
5168
|
-
})
|
|
5169
|
-
];
|
|
5170
|
-
case 1:
|
|
5171
|
-
response = _state.sent();
|
|
5172
|
-
if (!response.ok) {
|
|
5173
|
-
if (this.config.debugAdTiming) {
|
|
5174
|
-
console.warn("[ADAPTIVE-POD] Failed to fetch VAST: ".concat(response.status));
|
|
5175
|
-
}
|
|
5176
|
-
return [
|
|
5177
|
-
2,
|
|
5178
|
-
null
|
|
5179
|
-
];
|
|
5180
|
-
}
|
|
5181
|
-
return [
|
|
5182
|
-
4,
|
|
5183
|
-
response.text()
|
|
5184
|
-
];
|
|
5185
|
-
case 2:
|
|
5186
|
-
xmlText = _state.sent();
|
|
5187
|
-
parser = new DOMParser();
|
|
5188
|
-
xmlDoc = parser.parseFromString(xmlText, "text/xml");
|
|
5189
|
-
durationText = (_xmlDoc_querySelector = xmlDoc.querySelector("Duration")) === null || _xmlDoc_querySelector === void 0 ? void 0 : _xmlDoc_querySelector.textContent;
|
|
5190
|
-
if (!durationText) {
|
|
5191
|
-
if (this.config.debugAdTiming) {
|
|
5192
|
-
console.warn("[ADAPTIVE-POD] No Duration element found in VAST");
|
|
5193
|
-
}
|
|
5194
|
-
return [
|
|
5195
|
-
2,
|
|
5196
|
-
null
|
|
5197
|
-
];
|
|
5198
|
-
}
|
|
5199
|
-
durationParts = durationText.split(":");
|
|
5200
|
-
durationSeconds = parseInt(durationParts[0] || "0", 10) * 3600 + parseInt(durationParts[1] || "0", 10) * 60 + parseInt(durationParts[2] || "0", 10);
|
|
5201
|
-
return [
|
|
5202
|
-
2,
|
|
5203
|
-
durationSeconds
|
|
5204
|
-
];
|
|
5205
|
-
case 3:
|
|
5206
|
-
error = _state.sent();
|
|
5207
|
-
if (this.config.debugAdTiming) {
|
|
5208
|
-
console.warn("[ADAPTIVE-POD] Error fetching VAST duration from ".concat(vastTagUrl, ":"), error);
|
|
5209
|
-
}
|
|
5210
|
-
return [
|
|
5211
|
-
2,
|
|
5212
|
-
null
|
|
5213
|
-
];
|
|
5214
|
-
case 4:
|
|
5215
|
-
return [
|
|
5216
|
-
2
|
|
5217
|
-
];
|
|
5218
|
-
}
|
|
5219
|
-
});
|
|
5220
|
-
}).call(this);
|
|
5221
|
-
}
|
|
5222
|
-
},
|
|
5223
|
-
{
|
|
5224
|
-
key: "calculateAdditionalAdsNeeded",
|
|
5225
|
-
value: function calculateAdditionalAdsNeeded() {
|
|
5226
|
-
if (!this.isAdaptiveMode || this.targetAdBreakDurationMs === null) {
|
|
5227
|
-
return 0;
|
|
5228
|
-
}
|
|
5229
|
-
var totalFetchedDurationMs = 0;
|
|
5230
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5231
|
-
try {
|
|
5232
|
-
for(var _iterator = this.fetchedAdDurations.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5233
|
-
var duration = _step.value;
|
|
5234
|
-
totalFetchedDurationMs += duration * 1e3;
|
|
5235
|
-
}
|
|
5236
|
-
} catch (err) {
|
|
5237
|
-
_didIteratorError = true;
|
|
5238
|
-
_iteratorError = err;
|
|
5239
|
-
} finally{
|
|
5240
|
-
try {
|
|
5241
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5242
|
-
_iterator.return();
|
|
5243
|
-
}
|
|
5244
|
-
} finally{
|
|
5245
|
-
if (_didIteratorError) {
|
|
5246
|
-
throw _iteratorError;
|
|
5247
|
-
}
|
|
5248
|
-
}
|
|
5249
|
-
}
|
|
5250
|
-
var fetchedCount = this.fetchedAdDurations.size;
|
|
5251
|
-
var averageDurationMs = fetchedCount > 0 ? totalFetchedDurationMs / fetchedCount : 30 * 1e3;
|
|
5252
|
-
var queuedButNotFetched = this.adPodAllUrls.length - fetchedCount;
|
|
5253
|
-
var estimatedQueuedDurationMs = queuedButNotFetched * averageDurationMs;
|
|
5254
|
-
var estimatedTotalDurationMs = totalFetchedDurationMs + estimatedQueuedDurationMs;
|
|
5255
|
-
var remainingTimeMs = this.targetAdBreakDurationMs - estimatedTotalDurationMs;
|
|
5256
|
-
if (remainingTimeMs <= 0) {
|
|
5257
|
-
if (this.config.debugAdTiming) {
|
|
5258
|
-
console.log("[ADAPTIVE-POD] ✅ Target duration met: Fetched=".concat(totalFetchedDurationMs, "ms + Queued(").concat(queuedButNotFetched, " ads)=").concat(estimatedQueuedDurationMs, "ms = ").concat(estimatedTotalDurationMs, "ms / Target=").concat(this.targetAdBreakDurationMs, "ms"));
|
|
5259
|
-
}
|
|
5260
|
-
return 0;
|
|
5261
|
-
}
|
|
5262
|
-
var additionalAds = Math.ceil(remainingTimeMs / averageDurationMs);
|
|
5263
|
-
if (this.config.debugAdTiming) {
|
|
5264
|
-
console.log("[ADAPTIVE-POD] \uD83D\uDCCA Need ".concat(additionalAds, " more ads | Fetched: ").concat(totalFetchedDurationMs, "ms (").concat(fetchedCount, " ads) | Queued: ").concat(estimatedQueuedDurationMs, "ms (").concat(queuedButNotFetched, " ads) | Target: ").concat(this.targetAdBreakDurationMs, "ms | Remaining: ").concat(remainingTimeMs, "ms | Avg duration: ").concat(averageDurationMs, "ms"));
|
|
5265
|
-
}
|
|
5266
|
-
return additionalAds;
|
|
5267
|
-
}
|
|
5268
|
-
},
|
|
5269
|
-
{
|
|
5270
|
-
key: "addAdaptiveAdsToQueue",
|
|
5271
|
-
value: function addAdaptiveAdsToQueue() {
|
|
5272
|
-
return _async_to_generator(function() {
|
|
5273
|
-
var _this_adPodAllUrls, _this_adPodQueue, additionalAds, newUrls;
|
|
5274
|
-
return _ts_generator(this, function(_state) {
|
|
5275
|
-
if (!this.isAdaptiveMode || !this.apiVastTagUrl) {
|
|
5276
|
-
return [
|
|
5277
|
-
2
|
|
5278
|
-
];
|
|
5279
|
-
}
|
|
5280
|
-
additionalAds = this.calculateAdditionalAdsNeeded();
|
|
5281
|
-
if (additionalAds <= 0) {
|
|
5282
|
-
return [
|
|
5283
|
-
2
|
|
5284
|
-
];
|
|
5285
|
-
}
|
|
5286
|
-
newUrls = this.generateVastUrlsWithCorrelators(this.apiVastTagUrl, additionalAds);
|
|
5287
|
-
if (this.config.debugAdTiming) {
|
|
5288
|
-
console.log("[ADAPTIVE-POD] \uD83D\uDD04 Adding ".concat(newUrls.length, " additional VAST URLs to queue (will be preloaded sequentially)"));
|
|
5289
|
-
}
|
|
5290
|
-
(_this_adPodAllUrls = this.adPodAllUrls).push.apply(_this_adPodAllUrls, _to_consumable_array(newUrls));
|
|
5291
|
-
(_this_adPodQueue = this.adPodQueue).push.apply(_this_adPodQueue, _to_consumable_array(newUrls));
|
|
5292
|
-
this.totalAdsInBreak += newUrls.length;
|
|
5293
|
-
return [
|
|
5294
|
-
2
|
|
5295
|
-
];
|
|
5296
|
-
});
|
|
5297
|
-
}).call(this);
|
|
5298
|
-
}
|
|
5299
|
-
},
|
|
5300
|
-
{
|
|
5301
|
-
key: "preloadMediaFile",
|
|
5302
|
-
value: function preloadMediaFile(mediaUrl) {
|
|
5303
|
-
return _async_to_generator(function() {
|
|
5304
|
-
var response, error;
|
|
5305
|
-
return _ts_generator(this, function(_state) {
|
|
5306
|
-
switch(_state.label){
|
|
5307
|
-
case 0:
|
|
5308
|
-
if (this.preloadedMediaUrls.has(mediaUrl)) {
|
|
5309
|
-
return [
|
|
5310
|
-
2
|
|
5311
|
-
];
|
|
5312
|
-
}
|
|
5313
|
-
if (this.preloadingMediaUrls.has(mediaUrl)) {
|
|
5314
|
-
return [
|
|
5315
|
-
2
|
|
5316
|
-
];
|
|
5317
|
-
}
|
|
5318
|
-
this.preloadingMediaUrls.add(mediaUrl);
|
|
5319
|
-
_state.label = 1;
|
|
5320
|
-
case 1:
|
|
5321
|
-
_state.trys.push([
|
|
5322
|
-
1,
|
|
5323
|
-
3,
|
|
5324
|
-
4,
|
|
5325
|
-
5
|
|
5326
|
-
]);
|
|
5327
|
-
if (this.config.debugAdTiming) {
|
|
5328
|
-
console.log("[StormcloudVideoPlayer] Preloading video file: ".concat(mediaUrl));
|
|
5329
|
-
}
|
|
5330
|
-
return [
|
|
5331
|
-
4,
|
|
5332
|
-
fetch(mediaUrl, {
|
|
5333
|
-
mode: "cors",
|
|
5334
|
-
credentials: "include",
|
|
5335
|
-
method: "GET",
|
|
5336
|
-
headers: {
|
|
5337
|
-
Range: "bytes=0-1048576"
|
|
5338
|
-
},
|
|
5339
|
-
referrerPolicy: "no-referrer-when-downgrade"
|
|
5340
|
-
})
|
|
5341
|
-
];
|
|
5342
|
-
case 2:
|
|
5343
|
-
response = _state.sent();
|
|
5344
|
-
if (response.ok || response.status === 206) {
|
|
5345
|
-
this.preloadedMediaUrls.add(mediaUrl);
|
|
5346
|
-
if (this.config.debugAdTiming) {
|
|
5347
|
-
console.log("[StormcloudVideoPlayer] Successfully preloaded video file: ".concat(mediaUrl));
|
|
5348
|
-
}
|
|
5349
|
-
}
|
|
5350
|
-
return [
|
|
5351
|
-
3,
|
|
5352
|
-
5
|
|
5353
|
-
];
|
|
5354
|
-
case 3:
|
|
5355
|
-
error = _state.sent();
|
|
5356
|
-
if (this.config.debugAdTiming) {
|
|
5357
|
-
console.warn("[StormcloudVideoPlayer] Failed to preload video file: ".concat(mediaUrl), error);
|
|
5358
|
-
}
|
|
5359
|
-
return [
|
|
5360
|
-
3,
|
|
5361
|
-
5
|
|
5362
|
-
];
|
|
5363
|
-
case 4:
|
|
5364
|
-
this.preloadingMediaUrls.delete(mediaUrl);
|
|
5365
|
-
return [
|
|
5366
|
-
7
|
|
5367
|
-
];
|
|
5368
|
-
case 5:
|
|
5369
|
-
return [
|
|
5370
|
-
2
|
|
5371
|
-
];
|
|
5372
|
-
}
|
|
5373
|
-
});
|
|
5374
|
-
}).call(this);
|
|
5375
|
-
}
|
|
5376
|
-
},
|
|
5377
|
-
{
|
|
5378
|
-
key: "preloadAllAdsInBackground",
|
|
5379
|
-
value: function preloadAllAdsInBackground() {
|
|
5380
|
-
return _async_to_generator(function() {
|
|
5381
|
-
var _this, processedUrls, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, url, _this_ima_hasPreloadedAd, _this_ima, nextUrl, error, preloadPromises;
|
|
5382
|
-
return _ts_generator(this, function(_state) {
|
|
5383
|
-
switch(_state.label){
|
|
5384
|
-
case 0:
|
|
5385
|
-
_this = this;
|
|
5386
|
-
if (this.adPodAllUrls.length === 0) {
|
|
5387
|
-
return [
|
|
5388
|
-
2
|
|
5389
|
-
];
|
|
5390
|
-
}
|
|
5391
|
-
if (!this.isAdaptiveMode) return [
|
|
5392
|
-
3,
|
|
5393
|
-
7
|
|
5394
|
-
];
|
|
5395
|
-
if (this.config.debugAdTiming) {
|
|
5396
|
-
console.log("[ADAPTIVE-POD] \uD83D\uDD04 Starting sequential preload of remaining ads");
|
|
5397
|
-
}
|
|
5398
|
-
processedUrls = /* @__PURE__ */ new Set();
|
|
5399
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5400
|
-
try {
|
|
5401
|
-
for(_iterator = this.adPodAllUrls[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5402
|
-
url = _step.value;
|
|
5403
|
-
;
|
|
5404
|
-
if (((_this_ima_hasPreloadedAd = (_this_ima = this.ima).hasPreloadedAd) === null || _this_ima_hasPreloadedAd === void 0 ? void 0 : _this_ima_hasPreloadedAd.call(_this_ima, url)) || this.fetchedAdDurations.has(url)) {
|
|
5405
|
-
processedUrls.add(url);
|
|
5406
|
-
}
|
|
5407
|
-
}
|
|
5408
|
-
} catch (err) {
|
|
5409
|
-
_didIteratorError = true;
|
|
5410
|
-
_iteratorError = err;
|
|
5411
|
-
} finally{
|
|
5412
|
-
try {
|
|
5413
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5414
|
-
_iterator.return();
|
|
5415
|
-
}
|
|
5416
|
-
} finally{
|
|
5417
|
-
if (_didIteratorError) {
|
|
5418
|
-
throw _iteratorError;
|
|
5419
|
-
}
|
|
5420
|
-
}
|
|
5421
|
-
}
|
|
5422
|
-
if (this.config.debugAdTiming && processedUrls.size > 0) {
|
|
5423
|
-
console.log("[ADAPTIVE-POD] \uD83D\uDCE6 Skipping ".concat(processedUrls.size, " already-preloaded ads"));
|
|
5424
|
-
}
|
|
5425
|
-
_state.label = 1;
|
|
5426
|
-
case 1:
|
|
5427
|
-
if (!true) return [
|
|
5428
|
-
3,
|
|
5429
|
-
6
|
|
5430
|
-
];
|
|
5431
|
-
nextUrl = this.adPodAllUrls.find(function(url) {
|
|
5432
|
-
return !processedUrls.has(url);
|
|
5433
|
-
});
|
|
5434
|
-
if (!nextUrl) {
|
|
5435
|
-
if (this.config.debugAdTiming) {
|
|
5436
|
-
console.log("[ADAPTIVE-POD] ✅ All queued ads processed (".concat(processedUrls.size, " total)"));
|
|
5437
|
-
}
|
|
5438
|
-
return [
|
|
5439
|
-
3,
|
|
5440
|
-
6
|
|
5441
|
-
];
|
|
5442
|
-
}
|
|
5443
|
-
processedUrls.add(nextUrl);
|
|
5444
|
-
if (this.config.debugAdTiming) {
|
|
5445
|
-
console.log("[ADAPTIVE-POD] \uD83D\uDCE5 Preloading ad ".concat(processedUrls.size, "/").concat(this.adPodAllUrls.length, "..."));
|
|
5446
|
-
}
|
|
5447
|
-
_state.label = 2;
|
|
5448
|
-
case 2:
|
|
5449
|
-
_state.trys.push([
|
|
5450
|
-
2,
|
|
5451
|
-
4,
|
|
5452
|
-
,
|
|
5453
|
-
5
|
|
5454
|
-
]);
|
|
5455
|
-
return [
|
|
5456
|
-
4,
|
|
5457
|
-
this.preloadSingleAd(nextUrl)
|
|
5458
|
-
];
|
|
5459
|
-
case 3:
|
|
5460
|
-
_state.sent();
|
|
5461
|
-
return [
|
|
5462
|
-
3,
|
|
5463
|
-
5
|
|
5464
|
-
];
|
|
5465
|
-
case 4:
|
|
5466
|
-
error = _state.sent();
|
|
5467
|
-
if (this.config.debugAdTiming) {
|
|
5468
|
-
console.warn("[ADAPTIVE-POD] ⚠️ Preload failed for ad ".concat(processedUrls.size, ":"), error);
|
|
5469
|
-
}
|
|
5470
|
-
return [
|
|
5471
|
-
3,
|
|
5472
|
-
5
|
|
5473
|
-
];
|
|
5474
|
-
case 5:
|
|
5475
|
-
if (this.calculateAdditionalAdsNeeded() === 0) {
|
|
5476
|
-
if (this.config.debugAdTiming) {
|
|
5477
|
-
console.log("[ADAPTIVE-POD] ✅ Target duration reached (".concat(processedUrls.size, " ads preloaded), stopping"));
|
|
5478
|
-
}
|
|
5479
|
-
return [
|
|
5480
|
-
3,
|
|
5481
|
-
6
|
|
5482
|
-
];
|
|
5483
|
-
}
|
|
5484
|
-
return [
|
|
5485
|
-
3,
|
|
5486
|
-
1
|
|
5487
|
-
];
|
|
5488
|
-
case 6:
|
|
5489
|
-
if (this.config.debugAdTiming) {
|
|
5490
|
-
console.log("[ADAPTIVE-POD] ✅ Sequential preloading completed (".concat(processedUrls.size, " ads ready)"));
|
|
5491
|
-
}
|
|
5492
|
-
return [
|
|
5493
|
-
3,
|
|
5494
|
-
9
|
|
5495
|
-
];
|
|
5496
|
-
case 7:
|
|
5497
|
-
if (this.config.debugAdTiming) {
|
|
5498
|
-
console.log("[StormcloudVideoPlayer] Starting parallel preload of ".concat(this.adPodAllUrls.length, " ads"));
|
|
5499
|
-
}
|
|
5500
|
-
preloadPromises = this.adPodAllUrls.map(function(vastTagUrl) {
|
|
5501
|
-
return _this.preloadSingleAd(vastTagUrl).catch(function(error) {
|
|
5502
|
-
if (_this.config.debugAdTiming) {
|
|
5503
|
-
console.warn("[StormcloudVideoPlayer] Preload failed for ".concat(vastTagUrl, ":"), error);
|
|
5504
|
-
}
|
|
5505
|
-
});
|
|
5506
|
-
});
|
|
5507
|
-
return [
|
|
5508
|
-
4,
|
|
5509
|
-
Promise.all(preloadPromises)
|
|
5510
|
-
];
|
|
5511
|
-
case 8:
|
|
5512
|
-
_state.sent();
|
|
5513
|
-
if (this.config.debugAdTiming) {
|
|
5514
|
-
console.log("[StormcloudVideoPlayer] Background preloading completed for all ads");
|
|
5515
|
-
}
|
|
5516
|
-
_state.label = 9;
|
|
5517
|
-
case 9:
|
|
5518
|
-
return [
|
|
5519
|
-
2
|
|
5520
|
-
];
|
|
5521
|
-
}
|
|
5522
|
-
});
|
|
5523
|
-
}).call(this);
|
|
5524
|
-
}
|
|
5525
|
-
},
|
|
5526
|
-
{
|
|
5527
|
-
key: "preloadSingleAd",
|
|
5528
|
-
value: function preloadSingleAd(vastTagUrl) {
|
|
5529
|
-
return _async_to_generator(function() {
|
|
5530
|
-
var _this, duration, mediaUrls, primaryMediaUrl, error;
|
|
5531
|
-
return _ts_generator(this, function(_state) {
|
|
5532
|
-
switch(_state.label){
|
|
5533
|
-
case 0:
|
|
5534
|
-
_this = this;
|
|
5535
|
-
if (!vastTagUrl) return [
|
|
5536
|
-
2
|
|
5537
|
-
];
|
|
5538
|
-
_state.label = 1;
|
|
5539
|
-
case 1:
|
|
5540
|
-
_state.trys.push([
|
|
5541
|
-
1,
|
|
5542
|
-
11,
|
|
5543
|
-
,
|
|
5544
|
-
12
|
|
5545
|
-
]);
|
|
5546
|
-
if (!(this.isAdaptiveMode && !this.fetchedAdDurations.has(vastTagUrl))) return [
|
|
5547
|
-
3,
|
|
5548
|
-
4
|
|
5549
|
-
];
|
|
5550
|
-
return [
|
|
5551
|
-
4,
|
|
5552
|
-
this.fetchVastDuration(vastTagUrl)
|
|
5553
|
-
];
|
|
5554
|
-
case 2:
|
|
5555
|
-
duration = _state.sent();
|
|
5556
|
-
if (!(duration !== null)) return [
|
|
5557
|
-
3,
|
|
5558
|
-
4
|
|
5559
|
-
];
|
|
5560
|
-
this.fetchedAdDurations.set(vastTagUrl, duration);
|
|
5561
|
-
if (this.config.debugAdTiming) {
|
|
5562
|
-
console.log("[ADAPTIVE-POD] ✓ Fetched ad duration: ".concat(duration, "s (").concat(this.fetchedAdDurations.size, " ads fetched so far)"));
|
|
5563
|
-
}
|
|
5564
|
-
return [
|
|
5565
|
-
4,
|
|
5566
|
-
this.addAdaptiveAdsToQueue()
|
|
5567
|
-
];
|
|
5568
|
-
case 3:
|
|
5569
|
-
_state.sent();
|
|
5570
|
-
_state.label = 4;
|
|
5571
|
-
case 4:
|
|
5572
|
-
if (!(this.ima.preloadAds && !this.ima.hasPreloadedAd(vastTagUrl))) return [
|
|
5573
|
-
3,
|
|
5574
|
-
6
|
|
5575
|
-
];
|
|
5576
|
-
if (!!this.preloadingAdUrls.has(vastTagUrl)) return [
|
|
5577
|
-
3,
|
|
5578
|
-
6
|
|
5579
|
-
];
|
|
5580
|
-
if (this.config.debugAdTiming) {
|
|
5581
|
-
console.log("[StormcloudVideoPlayer] Preloading VAST: ".concat(vastTagUrl));
|
|
5582
|
-
}
|
|
5583
|
-
this.preloadingAdUrls.add(vastTagUrl);
|
|
5584
|
-
return [
|
|
5585
|
-
4,
|
|
5586
|
-
this.ima.preloadAds(vastTagUrl).then(function() {
|
|
5587
|
-
if (_this.config.debugAdTiming) {
|
|
5588
|
-
console.log("[StormcloudVideoPlayer] IMA VAST preload complete: ".concat(vastTagUrl));
|
|
5589
|
-
}
|
|
5590
|
-
}).catch(function(error) {
|
|
5591
|
-
if (_this.config.debugAdTiming) {
|
|
5592
|
-
console.warn("[StormcloudVideoPlayer] IMA VAST preload failed: ".concat(vastTagUrl), error);
|
|
5593
|
-
}
|
|
5594
|
-
}).finally(function() {
|
|
5595
|
-
_this.preloadingAdUrls.delete(vastTagUrl);
|
|
5596
|
-
})
|
|
5597
|
-
];
|
|
5598
|
-
case 5:
|
|
5599
|
-
_state.sent();
|
|
5600
|
-
_state.label = 6;
|
|
5601
|
-
case 6:
|
|
5602
|
-
mediaUrls = this.vastToMediaUrlMap.get(vastTagUrl);
|
|
5603
|
-
if (!!mediaUrls) return [
|
|
5604
|
-
3,
|
|
5605
|
-
8
|
|
5606
|
-
];
|
|
5607
|
-
if (this.config.debugAdTiming) {
|
|
5608
|
-
console.log("[StormcloudVideoPlayer] Fetching and parsing VAST to extract media URLs: ".concat(vastTagUrl));
|
|
5609
|
-
}
|
|
5610
|
-
return [
|
|
5611
|
-
4,
|
|
5612
|
-
this.fetchAndParseVastXml(vastTagUrl)
|
|
5613
|
-
];
|
|
5614
|
-
case 7:
|
|
5615
|
-
mediaUrls = _state.sent();
|
|
5616
|
-
if (this.config.debugAdTiming) {
|
|
5617
|
-
console.log("[StormcloudVideoPlayer] Extracted ".concat(mediaUrls.length, " media URLs:"), mediaUrls);
|
|
5618
|
-
}
|
|
5619
|
-
if (mediaUrls.length > 0) {
|
|
5620
|
-
this.vastToMediaUrlMap.set(vastTagUrl, mediaUrls);
|
|
5621
|
-
}
|
|
5622
|
-
_state.label = 8;
|
|
5623
|
-
case 8:
|
|
5624
|
-
if (!(mediaUrls && mediaUrls.length > 0)) return [
|
|
5625
|
-
3,
|
|
5626
|
-
10
|
|
5627
|
-
];
|
|
5628
|
-
primaryMediaUrl = mediaUrls[0];
|
|
5629
|
-
if (!(primaryMediaUrl && !this.preloadedMediaUrls.has(primaryMediaUrl))) return [
|
|
5630
|
-
3,
|
|
5631
|
-
10
|
|
5632
|
-
];
|
|
5633
|
-
return [
|
|
5634
|
-
4,
|
|
5635
|
-
this.preloadMediaFile(primaryMediaUrl)
|
|
5636
|
-
];
|
|
5637
|
-
case 9:
|
|
5638
|
-
_state.sent();
|
|
5639
|
-
_state.label = 10;
|
|
5640
|
-
case 10:
|
|
5641
|
-
return [
|
|
5642
|
-
3,
|
|
5643
|
-
12
|
|
5644
|
-
];
|
|
5645
|
-
case 11:
|
|
5646
|
-
error = _state.sent();
|
|
5647
|
-
if (this.config.debugAdTiming) {
|
|
5648
|
-
console.warn("[StormcloudVideoPlayer] Failed to preload ad: ".concat(vastTagUrl), error);
|
|
5649
|
-
}
|
|
5650
|
-
return [
|
|
5651
|
-
3,
|
|
5652
|
-
12
|
|
5653
|
-
];
|
|
5654
|
-
case 12:
|
|
5655
|
-
return [
|
|
5656
|
-
2
|
|
5657
|
-
];
|
|
5658
|
-
}
|
|
5659
|
-
});
|
|
5660
|
-
}).call(this);
|
|
5661
|
-
}
|
|
5662
|
-
},
|
|
5663
|
-
{
|
|
5664
|
-
key: "findNextPreloadedAd",
|
|
5665
|
-
value: function findNextPreloadedAd() {
|
|
5666
|
-
for(var i = 0; i < this.adPodQueue.length; i++){
|
|
5667
|
-
var _this_ima_hasPreloadedAd, _this_ima;
|
|
5668
|
-
var vastTagUrl = this.adPodQueue[i];
|
|
5669
|
-
if (!vastTagUrl) continue;
|
|
5670
|
-
if (this.failedVastUrls.has(vastTagUrl)) {
|
|
5671
|
-
console.warn("[AD-ERROR] Skipping failed URL in queue");
|
|
5672
|
-
continue;
|
|
5673
|
-
}
|
|
5674
|
-
var _this_ima_hasPreloadedAd1;
|
|
5675
|
-
var hasImaPreload = (_this_ima_hasPreloadedAd1 = (_this_ima_hasPreloadedAd = (_this_ima = this.ima).hasPreloadedAd) === null || _this_ima_hasPreloadedAd === void 0 ? void 0 : _this_ima_hasPreloadedAd.call(_this_ima, vastTagUrl)) !== null && _this_ima_hasPreloadedAd1 !== void 0 ? _this_ima_hasPreloadedAd1 : false;
|
|
5676
|
-
var mediaUrls = this.vastToMediaUrlMap.get(vastTagUrl);
|
|
5677
|
-
var hasMediaPreload = mediaUrls && mediaUrls.length > 0 ? this.preloadedMediaUrls.has(mediaUrls[0]) : false;
|
|
5678
|
-
if (hasImaPreload || hasMediaPreload) {
|
|
5679
|
-
this.adPodQueue.splice(0, i + 1);
|
|
5680
|
-
return vastTagUrl;
|
|
5681
|
-
}
|
|
5682
|
-
}
|
|
5683
|
-
return void 0;
|
|
5684
|
-
}
|
|
5685
|
-
},
|
|
5686
4990
|
{
|
|
5687
4991
|
key: "getRemainingAdMs",
|
|
5688
4992
|
value: function getRemainingAdMs() {
|
|
@@ -5869,7 +5173,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5869
5173
|
}
|
|
5870
5174
|
if (this.ima && this.ima.isAdPlaying()) {
|
|
5871
5175
|
var width = this.video.clientWidth || 640;
|
|
5872
|
-
var height = this.video.clientHeight ||
|
|
5176
|
+
var height = this.video.clientHeight || 480;
|
|
5873
5177
|
if (this.config.debugAdTiming) {
|
|
5874
5178
|
console.log("[StormcloudVideoPlayer] Resizing ads manager to ".concat(width, "x").concat(height));
|
|
5875
5179
|
}
|
|
@@ -5900,11 +5204,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5900
5204
|
}
|
|
5901
5205
|
(_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
|
|
5902
5206
|
(_this_ima = this.ima) === null || _this_ima === void 0 ? void 0 : _this_ima.destroy();
|
|
5903
|
-
this.preloadingAdUrls.clear();
|
|
5904
|
-
this.vastToMediaUrlMap.clear();
|
|
5905
|
-
this.preloadedMediaUrls.clear();
|
|
5906
|
-
this.preloadingMediaUrls.clear();
|
|
5907
|
-
this.adPodAllUrls = [];
|
|
5908
5207
|
this.adRequestQueue = [];
|
|
5909
5208
|
this.successfulAdRequests = [];
|
|
5910
5209
|
}
|