stormcloud-video-player 0.3.20 → 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 +17 -706
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +0 -17
- package/lib/index.d.ts +0 -17
- package/lib/index.js +17 -706
- package/lib/index.js.map +1 -1
- 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] : {};
|
|
@@ -153,9 +144,6 @@ function _object_spread_props(target, source) {
|
|
|
153
144
|
function _sliced_to_array(arr, i) {
|
|
154
145
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
155
146
|
}
|
|
156
|
-
function _to_consumable_array(arr) {
|
|
157
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
158
|
-
}
|
|
159
147
|
function _type_of(obj) {
|
|
160
148
|
"@swc/helpers - typeof";
|
|
161
149
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
@@ -658,10 +646,17 @@ function createImaController(video, options) {
|
|
|
658
646
|
var adsLoadedReject;
|
|
659
647
|
function makeAdsRequest(google, vastTagUrl) {
|
|
660
648
|
var adsRequest = new google.ima.AdsRequest();
|
|
661
|
-
|
|
662
|
-
|
|
649
|
+
var preloadedXml = preloadedVast.get(vastTagUrl);
|
|
650
|
+
if (preloadedXml) {
|
|
651
|
+
console.log("[IMA] \uD83D\uDCE6 Using preloaded VAST response");
|
|
652
|
+
adsRequest.adsResponse = preloadedXml;
|
|
653
|
+
preloadedVast.delete(vastTagUrl);
|
|
654
|
+
} else {
|
|
655
|
+
console.log("[IMA] \uD83D\uDCE1 Requesting VAST from URL (letting IMA fetch fresh)");
|
|
656
|
+
adsRequest.adTagUrl = vastTagUrl;
|
|
657
|
+
}
|
|
663
658
|
var videoWidth = video.offsetWidth || video.clientWidth || 640;
|
|
664
|
-
var videoHeight = video.offsetHeight || video.clientHeight ||
|
|
659
|
+
var videoHeight = video.offsetHeight || video.clientHeight || 480;
|
|
665
660
|
adsRequest.linearAdSlotWidth = videoWidth;
|
|
666
661
|
adsRequest.linearAdSlotHeight = videoHeight;
|
|
667
662
|
adsRequest.nonLinearAdSlotWidth = videoWidth;
|
|
@@ -1110,7 +1105,7 @@ function createImaController(video, options) {
|
|
|
1110
1105
|
}
|
|
1111
1106
|
try {
|
|
1112
1107
|
width = video.clientWidth || 640;
|
|
1113
|
-
height = video.clientHeight ||
|
|
1108
|
+
height = video.clientHeight || 480;
|
|
1114
1109
|
adsManager.init(width, height, window.google.ima.ViewMode.NORMAL);
|
|
1115
1110
|
adPlaying = true;
|
|
1116
1111
|
adVolume = originalMutedState ? 0 : originalVolume;
|
|
@@ -2738,18 +2733,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
2738
2733
|
this.bufferedSegmentsCount = 0;
|
|
2739
2734
|
this.shouldAutoplayAfterBuffering = false;
|
|
2740
2735
|
this.hasInitialBufferCompleted = false;
|
|
2741
|
-
this.adPodAllUrls = [];
|
|
2742
|
-
this.preloadingAdUrls = /* @__PURE__ */ new Set();
|
|
2743
|
-
this.vastToMediaUrlMap = /* @__PURE__ */ new Map();
|
|
2744
|
-
this.preloadedMediaUrls = /* @__PURE__ */ new Set();
|
|
2745
|
-
this.preloadingMediaUrls = /* @__PURE__ */ new Set();
|
|
2746
2736
|
this.adRequestTokenCounter = 0;
|
|
2747
2737
|
this.activeAdRequestToken = null;
|
|
2748
2738
|
this.adRequestWatchdogToken = null;
|
|
2749
2739
|
this.adFailsafeToken = null;
|
|
2750
|
-
this.fetchedAdDurations = /* @__PURE__ */ new Map();
|
|
2751
|
-
this.targetAdBreakDurationMs = null;
|
|
2752
|
-
this.isAdaptiveMode = false;
|
|
2753
2740
|
this.failedVastUrls = /* @__PURE__ */ new Set();
|
|
2754
2741
|
this.continuousFetchingActive = false;
|
|
2755
2742
|
this.adRequestQueue = [];
|
|
@@ -3254,25 +3241,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
3254
3241
|
}
|
|
3255
3242
|
});
|
|
3256
3243
|
this.ima.on("ad_error", function(errorPayload) {
|
|
3257
|
-
var remaining = _this.getRemainingAdMs();
|
|
3258
3244
|
console.error("[AD-ERROR] Ad playback failed", errorPayload || "");
|
|
3259
|
-
|
|
3260
|
-
if (remaining > 500 && _this.adPodQueue.length > 0) {
|
|
3261
|
-
var nextPreloaded = _this.findNextPreloadedAd();
|
|
3262
|
-
if (nextPreloaded) {
|
|
3263
|
-
_this.currentAdIndex++;
|
|
3264
|
-
_this.playSingleAd(nextPreloaded).catch(function() {
|
|
3265
|
-
_this.handleAdFailure();
|
|
3266
|
-
});
|
|
3267
|
-
} else {
|
|
3268
|
-
_this.handleAdFailure();
|
|
3269
|
-
}
|
|
3270
|
-
} else {
|
|
3271
|
-
_this.handleAdFailure();
|
|
3272
|
-
}
|
|
3273
|
-
} else {
|
|
3274
|
-
_this.handleAdFailure();
|
|
3275
|
-
}
|
|
3245
|
+
_this.handleAdFailure();
|
|
3276
3246
|
});
|
|
3277
3247
|
this.ima.on("content_pause", function() {
|
|
3278
3248
|
_this.clearAdFailsafeTimer();
|
|
@@ -4003,7 +3973,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4003
3973
|
key: "handleAdStart",
|
|
4004
3974
|
value: function handleAdStart(_marker) {
|
|
4005
3975
|
return _async_to_generator(function() {
|
|
4006
|
-
var scheduled, tags, baseVastUrl, adBreakDurationMs, currentMuted, currentVolume, firstAdUrlArray, firstAdUrl, error;
|
|
3976
|
+
var scheduled, tags, baseVastUrl, adBreakDurationMs, mode, currentMuted, currentVolume, firstAdUrlArray, firstAdUrl, error;
|
|
4007
3977
|
return _ts_generator(this, function(_state) {
|
|
4008
3978
|
switch(_state.label){
|
|
4009
3979
|
case 0:
|
|
@@ -4019,26 +3989,10 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4019
3989
|
];
|
|
4020
3990
|
}
|
|
4021
3991
|
adBreakDurationMs = _marker.durationSeconds != null ? _marker.durationSeconds * 1e3 : scheduled === null || scheduled === void 0 ? void 0 : scheduled.durationMs;
|
|
4022
|
-
if (this.
|
|
4023
|
-
this.
|
|
4024
|
-
|
|
4025
|
-
this.fetchedAdDurations.clear();
|
|
4026
|
-
if (this.config.debugAdTiming) {
|
|
4027
|
-
console.log("[CONTINUOUS-FETCH] \uD83D\uDCFA LIVE MODE: Target duration=".concat(adBreakDurationMs, "ms | Will continuously fetch ads during break"));
|
|
4028
|
-
}
|
|
4029
|
-
} else {
|
|
4030
|
-
this.isAdaptiveMode = false;
|
|
4031
|
-
this.targetAdBreakDurationMs = null;
|
|
4032
|
-
this.fetchedAdDurations.clear();
|
|
4033
|
-
if (this.config.debugAdTiming) {
|
|
4034
|
-
console.log("[CONTINUOUS-FETCH] \uD83C\uDFAC VOD MODE: Using fixed ad strategy");
|
|
4035
|
-
}
|
|
3992
|
+
if (this.config.debugAdTiming) {
|
|
3993
|
+
mode = this.isLiveStream ? "LIVE" : "VOD";
|
|
3994
|
+
console.log("[CONTINUOUS-FETCH] \uD83D\uDCFA ".concat(mode, " MODE: Target duration=").concat(adBreakDurationMs, "ms"));
|
|
4036
3995
|
}
|
|
4037
|
-
this.adPodAllUrls = [];
|
|
4038
|
-
this.preloadingAdUrls.clear();
|
|
4039
|
-
this.vastToMediaUrlMap.clear();
|
|
4040
|
-
this.preloadedMediaUrls.clear();
|
|
4041
|
-
this.preloadingMediaUrls.clear();
|
|
4042
3996
|
this.failedVastUrls.clear();
|
|
4043
3997
|
this.adRequestQueue = [];
|
|
4044
3998
|
this.successfulAdRequests = [];
|
|
@@ -4842,10 +4796,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4842
4796
|
this.isShowingPlaceholder = false;
|
|
4843
4797
|
this.placeholderStartTimeMs = null;
|
|
4844
4798
|
}
|
|
4845
|
-
this.preloadingAdUrls.clear();
|
|
4846
|
-
this.vastToMediaUrlMap.clear();
|
|
4847
|
-
this.preloadedMediaUrls.clear();
|
|
4848
|
-
this.preloadingMediaUrls.clear();
|
|
4849
4799
|
this.adRequestQueue = [];
|
|
4850
4800
|
this.successfulAdRequests = [];
|
|
4851
4801
|
this.inAdBreak = false;
|
|
@@ -4854,7 +4804,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
4854
4804
|
this.clearAdStartTimer();
|
|
4855
4805
|
this.clearAdStopTimer();
|
|
4856
4806
|
this.adPodQueue = [];
|
|
4857
|
-
this.adPodAllUrls = [];
|
|
4858
4807
|
this.showAds = false;
|
|
4859
4808
|
this.currentAdIndex = 0;
|
|
4860
4809
|
this.totalAdsInBreak = 0;
|
|
@@ -5009,651 +4958,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5009
4958
|
}, extra));
|
|
5010
4959
|
}
|
|
5011
4960
|
},
|
|
5012
|
-
{
|
|
5013
|
-
key: "fetchAndParseVastXml",
|
|
5014
|
-
value: function fetchAndParseVastXml(vastTagUrl) {
|
|
5015
|
-
return _async_to_generator(function() {
|
|
5016
|
-
var response, xmlText, error;
|
|
5017
|
-
return _ts_generator(this, function(_state) {
|
|
5018
|
-
switch(_state.label){
|
|
5019
|
-
case 0:
|
|
5020
|
-
_state.trys.push([
|
|
5021
|
-
0,
|
|
5022
|
-
3,
|
|
5023
|
-
,
|
|
5024
|
-
4
|
|
5025
|
-
]);
|
|
5026
|
-
return [
|
|
5027
|
-
4,
|
|
5028
|
-
fetch(vastTagUrl, {
|
|
5029
|
-
mode: "cors",
|
|
5030
|
-
credentials: "include",
|
|
5031
|
-
headers: {
|
|
5032
|
-
"Accept": "application/xml, text/xml, */*"
|
|
5033
|
-
},
|
|
5034
|
-
referrerPolicy: "no-referrer-when-downgrade"
|
|
5035
|
-
})
|
|
5036
|
-
];
|
|
5037
|
-
case 1:
|
|
5038
|
-
response = _state.sent();
|
|
5039
|
-
if (!response.ok) {
|
|
5040
|
-
throw new Error("Failed to fetch VAST: ".concat(response.status));
|
|
5041
|
-
}
|
|
5042
|
-
return [
|
|
5043
|
-
4,
|
|
5044
|
-
response.text()
|
|
5045
|
-
];
|
|
5046
|
-
case 2:
|
|
5047
|
-
xmlText = _state.sent();
|
|
5048
|
-
return [
|
|
5049
|
-
2,
|
|
5050
|
-
this.extractMediaUrlsFromVast(xmlText)
|
|
5051
|
-
];
|
|
5052
|
-
case 3:
|
|
5053
|
-
error = _state.sent();
|
|
5054
|
-
if (this.config.debugAdTiming) {
|
|
5055
|
-
console.warn("[StormcloudVideoPlayer] Failed to fetch/parse VAST XML: ".concat(vastTagUrl), error);
|
|
5056
|
-
}
|
|
5057
|
-
return [
|
|
5058
|
-
2,
|
|
5059
|
-
[]
|
|
5060
|
-
];
|
|
5061
|
-
case 4:
|
|
5062
|
-
return [
|
|
5063
|
-
2
|
|
5064
|
-
];
|
|
5065
|
-
}
|
|
5066
|
-
});
|
|
5067
|
-
}).call(this);
|
|
5068
|
-
}
|
|
5069
|
-
},
|
|
5070
|
-
{
|
|
5071
|
-
key: "extractMediaUrlsFromVast",
|
|
5072
|
-
value: function extractMediaUrlsFromVast(xmlText) {
|
|
5073
|
-
var mediaUrls = [];
|
|
5074
|
-
try {
|
|
5075
|
-
var parser = new DOMParser();
|
|
5076
|
-
var xmlDoc = parser.parseFromString(xmlText, "text/xml");
|
|
5077
|
-
var mediaFileElements = xmlDoc.querySelectorAll("MediaFile");
|
|
5078
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5079
|
-
try {
|
|
5080
|
-
for(var _iterator = Array.from(mediaFileElements)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5081
|
-
var mediaFile = _step.value;
|
|
5082
|
-
var _mediaFile_textContent;
|
|
5083
|
-
var url = (_mediaFile_textContent = mediaFile.textContent) === null || _mediaFile_textContent === void 0 ? void 0 : _mediaFile_textContent.trim();
|
|
5084
|
-
if (url) {
|
|
5085
|
-
var lowerUrl = url.toLowerCase();
|
|
5086
|
-
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")) {
|
|
5087
|
-
mediaUrls.push(url);
|
|
5088
|
-
}
|
|
5089
|
-
}
|
|
5090
|
-
}
|
|
5091
|
-
} catch (err) {
|
|
5092
|
-
_didIteratorError = true;
|
|
5093
|
-
_iteratorError = err;
|
|
5094
|
-
} finally{
|
|
5095
|
-
try {
|
|
5096
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5097
|
-
_iterator.return();
|
|
5098
|
-
}
|
|
5099
|
-
} finally{
|
|
5100
|
-
if (_didIteratorError) {
|
|
5101
|
-
throw _iteratorError;
|
|
5102
|
-
}
|
|
5103
|
-
}
|
|
5104
|
-
}
|
|
5105
|
-
if (this.config.debugAdTiming && mediaUrls.length > 0) {
|
|
5106
|
-
console.log("[StormcloudVideoPlayer] Extracted ".concat(mediaUrls.length, " media URLs from VAST:"), mediaUrls);
|
|
5107
|
-
}
|
|
5108
|
-
} catch (error) {
|
|
5109
|
-
if (this.config.debugAdTiming) {
|
|
5110
|
-
console.warn("[StormcloudVideoPlayer] Failed to parse VAST XML:", error);
|
|
5111
|
-
}
|
|
5112
|
-
}
|
|
5113
|
-
return mediaUrls;
|
|
5114
|
-
}
|
|
5115
|
-
},
|
|
5116
|
-
{
|
|
5117
|
-
key: "fetchVastDuration",
|
|
5118
|
-
value: function fetchVastDuration(vastTagUrl) {
|
|
5119
|
-
return _async_to_generator(function() {
|
|
5120
|
-
var _xmlDoc_querySelector, response, xmlText, parser, xmlDoc, durationText, durationParts, durationSeconds, error;
|
|
5121
|
-
return _ts_generator(this, function(_state) {
|
|
5122
|
-
switch(_state.label){
|
|
5123
|
-
case 0:
|
|
5124
|
-
_state.trys.push([
|
|
5125
|
-
0,
|
|
5126
|
-
3,
|
|
5127
|
-
,
|
|
5128
|
-
4
|
|
5129
|
-
]);
|
|
5130
|
-
return [
|
|
5131
|
-
4,
|
|
5132
|
-
fetch(vastTagUrl, {
|
|
5133
|
-
mode: "cors",
|
|
5134
|
-
credentials: "include",
|
|
5135
|
-
headers: {
|
|
5136
|
-
"Accept": "application/xml, text/xml, */*"
|
|
5137
|
-
},
|
|
5138
|
-
referrerPolicy: "no-referrer-when-downgrade"
|
|
5139
|
-
})
|
|
5140
|
-
];
|
|
5141
|
-
case 1:
|
|
5142
|
-
response = _state.sent();
|
|
5143
|
-
if (!response.ok) {
|
|
5144
|
-
if (this.config.debugAdTiming) {
|
|
5145
|
-
console.warn("[ADAPTIVE-POD] Failed to fetch VAST: ".concat(response.status));
|
|
5146
|
-
}
|
|
5147
|
-
return [
|
|
5148
|
-
2,
|
|
5149
|
-
null
|
|
5150
|
-
];
|
|
5151
|
-
}
|
|
5152
|
-
return [
|
|
5153
|
-
4,
|
|
5154
|
-
response.text()
|
|
5155
|
-
];
|
|
5156
|
-
case 2:
|
|
5157
|
-
xmlText = _state.sent();
|
|
5158
|
-
parser = new DOMParser();
|
|
5159
|
-
xmlDoc = parser.parseFromString(xmlText, "text/xml");
|
|
5160
|
-
durationText = (_xmlDoc_querySelector = xmlDoc.querySelector("Duration")) === null || _xmlDoc_querySelector === void 0 ? void 0 : _xmlDoc_querySelector.textContent;
|
|
5161
|
-
if (!durationText) {
|
|
5162
|
-
if (this.config.debugAdTiming) {
|
|
5163
|
-
console.warn("[ADAPTIVE-POD] No Duration element found in VAST");
|
|
5164
|
-
}
|
|
5165
|
-
return [
|
|
5166
|
-
2,
|
|
5167
|
-
null
|
|
5168
|
-
];
|
|
5169
|
-
}
|
|
5170
|
-
durationParts = durationText.split(":");
|
|
5171
|
-
durationSeconds = parseInt(durationParts[0] || "0", 10) * 3600 + parseInt(durationParts[1] || "0", 10) * 60 + parseInt(durationParts[2] || "0", 10);
|
|
5172
|
-
return [
|
|
5173
|
-
2,
|
|
5174
|
-
durationSeconds
|
|
5175
|
-
];
|
|
5176
|
-
case 3:
|
|
5177
|
-
error = _state.sent();
|
|
5178
|
-
if (this.config.debugAdTiming) {
|
|
5179
|
-
console.warn("[ADAPTIVE-POD] Error fetching VAST duration from ".concat(vastTagUrl, ":"), error);
|
|
5180
|
-
}
|
|
5181
|
-
return [
|
|
5182
|
-
2,
|
|
5183
|
-
null
|
|
5184
|
-
];
|
|
5185
|
-
case 4:
|
|
5186
|
-
return [
|
|
5187
|
-
2
|
|
5188
|
-
];
|
|
5189
|
-
}
|
|
5190
|
-
});
|
|
5191
|
-
}).call(this);
|
|
5192
|
-
}
|
|
5193
|
-
},
|
|
5194
|
-
{
|
|
5195
|
-
key: "calculateAdditionalAdsNeeded",
|
|
5196
|
-
value: function calculateAdditionalAdsNeeded() {
|
|
5197
|
-
if (!this.isAdaptiveMode || this.targetAdBreakDurationMs === null) {
|
|
5198
|
-
return 0;
|
|
5199
|
-
}
|
|
5200
|
-
var totalFetchedDurationMs = 0;
|
|
5201
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5202
|
-
try {
|
|
5203
|
-
for(var _iterator = this.fetchedAdDurations.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5204
|
-
var duration = _step.value;
|
|
5205
|
-
totalFetchedDurationMs += duration * 1e3;
|
|
5206
|
-
}
|
|
5207
|
-
} catch (err) {
|
|
5208
|
-
_didIteratorError = true;
|
|
5209
|
-
_iteratorError = err;
|
|
5210
|
-
} finally{
|
|
5211
|
-
try {
|
|
5212
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5213
|
-
_iterator.return();
|
|
5214
|
-
}
|
|
5215
|
-
} finally{
|
|
5216
|
-
if (_didIteratorError) {
|
|
5217
|
-
throw _iteratorError;
|
|
5218
|
-
}
|
|
5219
|
-
}
|
|
5220
|
-
}
|
|
5221
|
-
var fetchedCount = this.fetchedAdDurations.size;
|
|
5222
|
-
var averageDurationMs = fetchedCount > 0 ? totalFetchedDurationMs / fetchedCount : 30 * 1e3;
|
|
5223
|
-
var queuedButNotFetched = this.adPodAllUrls.length - fetchedCount;
|
|
5224
|
-
var estimatedQueuedDurationMs = queuedButNotFetched * averageDurationMs;
|
|
5225
|
-
var estimatedTotalDurationMs = totalFetchedDurationMs + estimatedQueuedDurationMs;
|
|
5226
|
-
var remainingTimeMs = this.targetAdBreakDurationMs - estimatedTotalDurationMs;
|
|
5227
|
-
if (remainingTimeMs <= 0) {
|
|
5228
|
-
if (this.config.debugAdTiming) {
|
|
5229
|
-
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"));
|
|
5230
|
-
}
|
|
5231
|
-
return 0;
|
|
5232
|
-
}
|
|
5233
|
-
var additionalAds = Math.ceil(remainingTimeMs / averageDurationMs);
|
|
5234
|
-
if (this.config.debugAdTiming) {
|
|
5235
|
-
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"));
|
|
5236
|
-
}
|
|
5237
|
-
return additionalAds;
|
|
5238
|
-
}
|
|
5239
|
-
},
|
|
5240
|
-
{
|
|
5241
|
-
key: "addAdaptiveAdsToQueue",
|
|
5242
|
-
value: function addAdaptiveAdsToQueue() {
|
|
5243
|
-
return _async_to_generator(function() {
|
|
5244
|
-
var _this_adPodAllUrls, _this_adPodQueue, additionalAds, newUrls;
|
|
5245
|
-
return _ts_generator(this, function(_state) {
|
|
5246
|
-
if (!this.isAdaptiveMode || !this.apiVastTagUrl) {
|
|
5247
|
-
return [
|
|
5248
|
-
2
|
|
5249
|
-
];
|
|
5250
|
-
}
|
|
5251
|
-
additionalAds = this.calculateAdditionalAdsNeeded();
|
|
5252
|
-
if (additionalAds <= 0) {
|
|
5253
|
-
return [
|
|
5254
|
-
2
|
|
5255
|
-
];
|
|
5256
|
-
}
|
|
5257
|
-
newUrls = this.generateVastUrlsWithCorrelators(this.apiVastTagUrl, additionalAds);
|
|
5258
|
-
if (this.config.debugAdTiming) {
|
|
5259
|
-
console.log("[ADAPTIVE-POD] \uD83D\uDD04 Adding ".concat(newUrls.length, " additional VAST URLs to queue (will be preloaded sequentially)"));
|
|
5260
|
-
}
|
|
5261
|
-
(_this_adPodAllUrls = this.adPodAllUrls).push.apply(_this_adPodAllUrls, _to_consumable_array(newUrls));
|
|
5262
|
-
(_this_adPodQueue = this.adPodQueue).push.apply(_this_adPodQueue, _to_consumable_array(newUrls));
|
|
5263
|
-
this.totalAdsInBreak += newUrls.length;
|
|
5264
|
-
return [
|
|
5265
|
-
2
|
|
5266
|
-
];
|
|
5267
|
-
});
|
|
5268
|
-
}).call(this);
|
|
5269
|
-
}
|
|
5270
|
-
},
|
|
5271
|
-
{
|
|
5272
|
-
key: "preloadMediaFile",
|
|
5273
|
-
value: function preloadMediaFile(mediaUrl) {
|
|
5274
|
-
return _async_to_generator(function() {
|
|
5275
|
-
var response, error;
|
|
5276
|
-
return _ts_generator(this, function(_state) {
|
|
5277
|
-
switch(_state.label){
|
|
5278
|
-
case 0:
|
|
5279
|
-
if (this.preloadedMediaUrls.has(mediaUrl)) {
|
|
5280
|
-
return [
|
|
5281
|
-
2
|
|
5282
|
-
];
|
|
5283
|
-
}
|
|
5284
|
-
if (this.preloadingMediaUrls.has(mediaUrl)) {
|
|
5285
|
-
return [
|
|
5286
|
-
2
|
|
5287
|
-
];
|
|
5288
|
-
}
|
|
5289
|
-
this.preloadingMediaUrls.add(mediaUrl);
|
|
5290
|
-
_state.label = 1;
|
|
5291
|
-
case 1:
|
|
5292
|
-
_state.trys.push([
|
|
5293
|
-
1,
|
|
5294
|
-
3,
|
|
5295
|
-
4,
|
|
5296
|
-
5
|
|
5297
|
-
]);
|
|
5298
|
-
if (this.config.debugAdTiming) {
|
|
5299
|
-
console.log("[StormcloudVideoPlayer] Preloading video file: ".concat(mediaUrl));
|
|
5300
|
-
}
|
|
5301
|
-
return [
|
|
5302
|
-
4,
|
|
5303
|
-
fetch(mediaUrl, {
|
|
5304
|
-
mode: "cors",
|
|
5305
|
-
credentials: "include",
|
|
5306
|
-
method: "GET",
|
|
5307
|
-
headers: {
|
|
5308
|
-
Range: "bytes=0-1048576"
|
|
5309
|
-
},
|
|
5310
|
-
referrerPolicy: "no-referrer-when-downgrade"
|
|
5311
|
-
})
|
|
5312
|
-
];
|
|
5313
|
-
case 2:
|
|
5314
|
-
response = _state.sent();
|
|
5315
|
-
if (response.ok || response.status === 206) {
|
|
5316
|
-
this.preloadedMediaUrls.add(mediaUrl);
|
|
5317
|
-
if (this.config.debugAdTiming) {
|
|
5318
|
-
console.log("[StormcloudVideoPlayer] Successfully preloaded video file: ".concat(mediaUrl));
|
|
5319
|
-
}
|
|
5320
|
-
}
|
|
5321
|
-
return [
|
|
5322
|
-
3,
|
|
5323
|
-
5
|
|
5324
|
-
];
|
|
5325
|
-
case 3:
|
|
5326
|
-
error = _state.sent();
|
|
5327
|
-
if (this.config.debugAdTiming) {
|
|
5328
|
-
console.warn("[StormcloudVideoPlayer] Failed to preload video file: ".concat(mediaUrl), error);
|
|
5329
|
-
}
|
|
5330
|
-
return [
|
|
5331
|
-
3,
|
|
5332
|
-
5
|
|
5333
|
-
];
|
|
5334
|
-
case 4:
|
|
5335
|
-
this.preloadingMediaUrls.delete(mediaUrl);
|
|
5336
|
-
return [
|
|
5337
|
-
7
|
|
5338
|
-
];
|
|
5339
|
-
case 5:
|
|
5340
|
-
return [
|
|
5341
|
-
2
|
|
5342
|
-
];
|
|
5343
|
-
}
|
|
5344
|
-
});
|
|
5345
|
-
}).call(this);
|
|
5346
|
-
}
|
|
5347
|
-
},
|
|
5348
|
-
{
|
|
5349
|
-
key: "preloadAllAdsInBackground",
|
|
5350
|
-
value: function preloadAllAdsInBackground() {
|
|
5351
|
-
return _async_to_generator(function() {
|
|
5352
|
-
var _this, processedUrls, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, url, _this_ima_hasPreloadedAd, _this_ima, nextUrl, error, preloadPromises;
|
|
5353
|
-
return _ts_generator(this, function(_state) {
|
|
5354
|
-
switch(_state.label){
|
|
5355
|
-
case 0:
|
|
5356
|
-
_this = this;
|
|
5357
|
-
if (this.adPodAllUrls.length === 0) {
|
|
5358
|
-
return [
|
|
5359
|
-
2
|
|
5360
|
-
];
|
|
5361
|
-
}
|
|
5362
|
-
if (!this.isAdaptiveMode) return [
|
|
5363
|
-
3,
|
|
5364
|
-
7
|
|
5365
|
-
];
|
|
5366
|
-
if (this.config.debugAdTiming) {
|
|
5367
|
-
console.log("[ADAPTIVE-POD] \uD83D\uDD04 Starting sequential preload of remaining ads");
|
|
5368
|
-
}
|
|
5369
|
-
processedUrls = /* @__PURE__ */ new Set();
|
|
5370
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5371
|
-
try {
|
|
5372
|
-
for(_iterator = this.adPodAllUrls[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
5373
|
-
url = _step.value;
|
|
5374
|
-
;
|
|
5375
|
-
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)) {
|
|
5376
|
-
processedUrls.add(url);
|
|
5377
|
-
}
|
|
5378
|
-
}
|
|
5379
|
-
} catch (err) {
|
|
5380
|
-
_didIteratorError = true;
|
|
5381
|
-
_iteratorError = err;
|
|
5382
|
-
} finally{
|
|
5383
|
-
try {
|
|
5384
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5385
|
-
_iterator.return();
|
|
5386
|
-
}
|
|
5387
|
-
} finally{
|
|
5388
|
-
if (_didIteratorError) {
|
|
5389
|
-
throw _iteratorError;
|
|
5390
|
-
}
|
|
5391
|
-
}
|
|
5392
|
-
}
|
|
5393
|
-
if (this.config.debugAdTiming && processedUrls.size > 0) {
|
|
5394
|
-
console.log("[ADAPTIVE-POD] \uD83D\uDCE6 Skipping ".concat(processedUrls.size, " already-preloaded ads"));
|
|
5395
|
-
}
|
|
5396
|
-
_state.label = 1;
|
|
5397
|
-
case 1:
|
|
5398
|
-
if (!true) return [
|
|
5399
|
-
3,
|
|
5400
|
-
6
|
|
5401
|
-
];
|
|
5402
|
-
nextUrl = this.adPodAllUrls.find(function(url) {
|
|
5403
|
-
return !processedUrls.has(url);
|
|
5404
|
-
});
|
|
5405
|
-
if (!nextUrl) {
|
|
5406
|
-
if (this.config.debugAdTiming) {
|
|
5407
|
-
console.log("[ADAPTIVE-POD] ✅ All queued ads processed (".concat(processedUrls.size, " total)"));
|
|
5408
|
-
}
|
|
5409
|
-
return [
|
|
5410
|
-
3,
|
|
5411
|
-
6
|
|
5412
|
-
];
|
|
5413
|
-
}
|
|
5414
|
-
processedUrls.add(nextUrl);
|
|
5415
|
-
if (this.config.debugAdTiming) {
|
|
5416
|
-
console.log("[ADAPTIVE-POD] \uD83D\uDCE5 Preloading ad ".concat(processedUrls.size, "/").concat(this.adPodAllUrls.length, "..."));
|
|
5417
|
-
}
|
|
5418
|
-
_state.label = 2;
|
|
5419
|
-
case 2:
|
|
5420
|
-
_state.trys.push([
|
|
5421
|
-
2,
|
|
5422
|
-
4,
|
|
5423
|
-
,
|
|
5424
|
-
5
|
|
5425
|
-
]);
|
|
5426
|
-
return [
|
|
5427
|
-
4,
|
|
5428
|
-
this.preloadSingleAd(nextUrl)
|
|
5429
|
-
];
|
|
5430
|
-
case 3:
|
|
5431
|
-
_state.sent();
|
|
5432
|
-
return [
|
|
5433
|
-
3,
|
|
5434
|
-
5
|
|
5435
|
-
];
|
|
5436
|
-
case 4:
|
|
5437
|
-
error = _state.sent();
|
|
5438
|
-
if (this.config.debugAdTiming) {
|
|
5439
|
-
console.warn("[ADAPTIVE-POD] ⚠️ Preload failed for ad ".concat(processedUrls.size, ":"), error);
|
|
5440
|
-
}
|
|
5441
|
-
return [
|
|
5442
|
-
3,
|
|
5443
|
-
5
|
|
5444
|
-
];
|
|
5445
|
-
case 5:
|
|
5446
|
-
if (this.calculateAdditionalAdsNeeded() === 0) {
|
|
5447
|
-
if (this.config.debugAdTiming) {
|
|
5448
|
-
console.log("[ADAPTIVE-POD] ✅ Target duration reached (".concat(processedUrls.size, " ads preloaded), stopping"));
|
|
5449
|
-
}
|
|
5450
|
-
return [
|
|
5451
|
-
3,
|
|
5452
|
-
6
|
|
5453
|
-
];
|
|
5454
|
-
}
|
|
5455
|
-
return [
|
|
5456
|
-
3,
|
|
5457
|
-
1
|
|
5458
|
-
];
|
|
5459
|
-
case 6:
|
|
5460
|
-
if (this.config.debugAdTiming) {
|
|
5461
|
-
console.log("[ADAPTIVE-POD] ✅ Sequential preloading completed (".concat(processedUrls.size, " ads ready)"));
|
|
5462
|
-
}
|
|
5463
|
-
return [
|
|
5464
|
-
3,
|
|
5465
|
-
9
|
|
5466
|
-
];
|
|
5467
|
-
case 7:
|
|
5468
|
-
if (this.config.debugAdTiming) {
|
|
5469
|
-
console.log("[StormcloudVideoPlayer] Starting parallel preload of ".concat(this.adPodAllUrls.length, " ads"));
|
|
5470
|
-
}
|
|
5471
|
-
preloadPromises = this.adPodAllUrls.map(function(vastTagUrl) {
|
|
5472
|
-
return _this.preloadSingleAd(vastTagUrl).catch(function(error) {
|
|
5473
|
-
if (_this.config.debugAdTiming) {
|
|
5474
|
-
console.warn("[StormcloudVideoPlayer] Preload failed for ".concat(vastTagUrl, ":"), error);
|
|
5475
|
-
}
|
|
5476
|
-
});
|
|
5477
|
-
});
|
|
5478
|
-
return [
|
|
5479
|
-
4,
|
|
5480
|
-
Promise.all(preloadPromises)
|
|
5481
|
-
];
|
|
5482
|
-
case 8:
|
|
5483
|
-
_state.sent();
|
|
5484
|
-
if (this.config.debugAdTiming) {
|
|
5485
|
-
console.log("[StormcloudVideoPlayer] Background preloading completed for all ads");
|
|
5486
|
-
}
|
|
5487
|
-
_state.label = 9;
|
|
5488
|
-
case 9:
|
|
5489
|
-
return [
|
|
5490
|
-
2
|
|
5491
|
-
];
|
|
5492
|
-
}
|
|
5493
|
-
});
|
|
5494
|
-
}).call(this);
|
|
5495
|
-
}
|
|
5496
|
-
},
|
|
5497
|
-
{
|
|
5498
|
-
key: "preloadSingleAd",
|
|
5499
|
-
value: function preloadSingleAd(vastTagUrl) {
|
|
5500
|
-
return _async_to_generator(function() {
|
|
5501
|
-
var _this, duration, mediaUrls, primaryMediaUrl, error;
|
|
5502
|
-
return _ts_generator(this, function(_state) {
|
|
5503
|
-
switch(_state.label){
|
|
5504
|
-
case 0:
|
|
5505
|
-
_this = this;
|
|
5506
|
-
if (!vastTagUrl) return [
|
|
5507
|
-
2
|
|
5508
|
-
];
|
|
5509
|
-
_state.label = 1;
|
|
5510
|
-
case 1:
|
|
5511
|
-
_state.trys.push([
|
|
5512
|
-
1,
|
|
5513
|
-
11,
|
|
5514
|
-
,
|
|
5515
|
-
12
|
|
5516
|
-
]);
|
|
5517
|
-
if (!(this.isAdaptiveMode && !this.fetchedAdDurations.has(vastTagUrl))) return [
|
|
5518
|
-
3,
|
|
5519
|
-
4
|
|
5520
|
-
];
|
|
5521
|
-
return [
|
|
5522
|
-
4,
|
|
5523
|
-
this.fetchVastDuration(vastTagUrl)
|
|
5524
|
-
];
|
|
5525
|
-
case 2:
|
|
5526
|
-
duration = _state.sent();
|
|
5527
|
-
if (!(duration !== null)) return [
|
|
5528
|
-
3,
|
|
5529
|
-
4
|
|
5530
|
-
];
|
|
5531
|
-
this.fetchedAdDurations.set(vastTagUrl, duration);
|
|
5532
|
-
if (this.config.debugAdTiming) {
|
|
5533
|
-
console.log("[ADAPTIVE-POD] ✓ Fetched ad duration: ".concat(duration, "s (").concat(this.fetchedAdDurations.size, " ads fetched so far)"));
|
|
5534
|
-
}
|
|
5535
|
-
return [
|
|
5536
|
-
4,
|
|
5537
|
-
this.addAdaptiveAdsToQueue()
|
|
5538
|
-
];
|
|
5539
|
-
case 3:
|
|
5540
|
-
_state.sent();
|
|
5541
|
-
_state.label = 4;
|
|
5542
|
-
case 4:
|
|
5543
|
-
if (!(this.ima.preloadAds && !this.ima.hasPreloadedAd(vastTagUrl))) return [
|
|
5544
|
-
3,
|
|
5545
|
-
6
|
|
5546
|
-
];
|
|
5547
|
-
if (!!this.preloadingAdUrls.has(vastTagUrl)) return [
|
|
5548
|
-
3,
|
|
5549
|
-
6
|
|
5550
|
-
];
|
|
5551
|
-
if (this.config.debugAdTiming) {
|
|
5552
|
-
console.log("[StormcloudVideoPlayer] Preloading VAST: ".concat(vastTagUrl));
|
|
5553
|
-
}
|
|
5554
|
-
this.preloadingAdUrls.add(vastTagUrl);
|
|
5555
|
-
return [
|
|
5556
|
-
4,
|
|
5557
|
-
this.ima.preloadAds(vastTagUrl).then(function() {
|
|
5558
|
-
if (_this.config.debugAdTiming) {
|
|
5559
|
-
console.log("[StormcloudVideoPlayer] IMA VAST preload complete: ".concat(vastTagUrl));
|
|
5560
|
-
}
|
|
5561
|
-
}).catch(function(error) {
|
|
5562
|
-
if (_this.config.debugAdTiming) {
|
|
5563
|
-
console.warn("[StormcloudVideoPlayer] IMA VAST preload failed: ".concat(vastTagUrl), error);
|
|
5564
|
-
}
|
|
5565
|
-
}).finally(function() {
|
|
5566
|
-
_this.preloadingAdUrls.delete(vastTagUrl);
|
|
5567
|
-
})
|
|
5568
|
-
];
|
|
5569
|
-
case 5:
|
|
5570
|
-
_state.sent();
|
|
5571
|
-
_state.label = 6;
|
|
5572
|
-
case 6:
|
|
5573
|
-
mediaUrls = this.vastToMediaUrlMap.get(vastTagUrl);
|
|
5574
|
-
if (!!mediaUrls) return [
|
|
5575
|
-
3,
|
|
5576
|
-
8
|
|
5577
|
-
];
|
|
5578
|
-
if (this.config.debugAdTiming) {
|
|
5579
|
-
console.log("[StormcloudVideoPlayer] Fetching and parsing VAST to extract media URLs: ".concat(vastTagUrl));
|
|
5580
|
-
}
|
|
5581
|
-
return [
|
|
5582
|
-
4,
|
|
5583
|
-
this.fetchAndParseVastXml(vastTagUrl)
|
|
5584
|
-
];
|
|
5585
|
-
case 7:
|
|
5586
|
-
mediaUrls = _state.sent();
|
|
5587
|
-
if (this.config.debugAdTiming) {
|
|
5588
|
-
console.log("[StormcloudVideoPlayer] Extracted ".concat(mediaUrls.length, " media URLs:"), mediaUrls);
|
|
5589
|
-
}
|
|
5590
|
-
if (mediaUrls.length > 0) {
|
|
5591
|
-
this.vastToMediaUrlMap.set(vastTagUrl, mediaUrls);
|
|
5592
|
-
}
|
|
5593
|
-
_state.label = 8;
|
|
5594
|
-
case 8:
|
|
5595
|
-
if (!(mediaUrls && mediaUrls.length > 0)) return [
|
|
5596
|
-
3,
|
|
5597
|
-
10
|
|
5598
|
-
];
|
|
5599
|
-
primaryMediaUrl = mediaUrls[0];
|
|
5600
|
-
if (!(primaryMediaUrl && !this.preloadedMediaUrls.has(primaryMediaUrl))) return [
|
|
5601
|
-
3,
|
|
5602
|
-
10
|
|
5603
|
-
];
|
|
5604
|
-
return [
|
|
5605
|
-
4,
|
|
5606
|
-
this.preloadMediaFile(primaryMediaUrl)
|
|
5607
|
-
];
|
|
5608
|
-
case 9:
|
|
5609
|
-
_state.sent();
|
|
5610
|
-
_state.label = 10;
|
|
5611
|
-
case 10:
|
|
5612
|
-
return [
|
|
5613
|
-
3,
|
|
5614
|
-
12
|
|
5615
|
-
];
|
|
5616
|
-
case 11:
|
|
5617
|
-
error = _state.sent();
|
|
5618
|
-
if (this.config.debugAdTiming) {
|
|
5619
|
-
console.warn("[StormcloudVideoPlayer] Failed to preload ad: ".concat(vastTagUrl), error);
|
|
5620
|
-
}
|
|
5621
|
-
return [
|
|
5622
|
-
3,
|
|
5623
|
-
12
|
|
5624
|
-
];
|
|
5625
|
-
case 12:
|
|
5626
|
-
return [
|
|
5627
|
-
2
|
|
5628
|
-
];
|
|
5629
|
-
}
|
|
5630
|
-
});
|
|
5631
|
-
}).call(this);
|
|
5632
|
-
}
|
|
5633
|
-
},
|
|
5634
|
-
{
|
|
5635
|
-
key: "findNextPreloadedAd",
|
|
5636
|
-
value: function findNextPreloadedAd() {
|
|
5637
|
-
for(var i = 0; i < this.adPodQueue.length; i++){
|
|
5638
|
-
var _this_ima_hasPreloadedAd, _this_ima;
|
|
5639
|
-
var vastTagUrl = this.adPodQueue[i];
|
|
5640
|
-
if (!vastTagUrl) continue;
|
|
5641
|
-
if (this.failedVastUrls.has(vastTagUrl)) {
|
|
5642
|
-
console.warn("[AD-ERROR] Skipping failed URL in queue");
|
|
5643
|
-
continue;
|
|
5644
|
-
}
|
|
5645
|
-
var _this_ima_hasPreloadedAd1;
|
|
5646
|
-
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;
|
|
5647
|
-
var mediaUrls = this.vastToMediaUrlMap.get(vastTagUrl);
|
|
5648
|
-
var hasMediaPreload = mediaUrls && mediaUrls.length > 0 ? this.preloadedMediaUrls.has(mediaUrls[0]) : false;
|
|
5649
|
-
if (hasImaPreload || hasMediaPreload) {
|
|
5650
|
-
this.adPodQueue.splice(0, i + 1);
|
|
5651
|
-
return vastTagUrl;
|
|
5652
|
-
}
|
|
5653
|
-
}
|
|
5654
|
-
return void 0;
|
|
5655
|
-
}
|
|
5656
|
-
},
|
|
5657
4961
|
{
|
|
5658
4962
|
key: "getRemainingAdMs",
|
|
5659
4963
|
value: function getRemainingAdMs() {
|
|
@@ -5840,7 +5144,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5840
5144
|
}
|
|
5841
5145
|
if (this.ima && this.ima.isAdPlaying()) {
|
|
5842
5146
|
var width = this.video.clientWidth || 640;
|
|
5843
|
-
var height = this.video.clientHeight ||
|
|
5147
|
+
var height = this.video.clientHeight || 480;
|
|
5844
5148
|
if (this.config.debugAdTiming) {
|
|
5845
5149
|
console.log("[StormcloudVideoPlayer] Resizing ads manager to ".concat(width, "x").concat(height));
|
|
5846
5150
|
}
|
|
@@ -5871,11 +5175,6 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
|
|
|
5871
5175
|
}
|
|
5872
5176
|
(_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : _this_hls.destroy();
|
|
5873
5177
|
(_this_ima = this.ima) === null || _this_ima === void 0 ? void 0 : _this_ima.destroy();
|
|
5874
|
-
this.preloadingAdUrls.clear();
|
|
5875
|
-
this.vastToMediaUrlMap.clear();
|
|
5876
|
-
this.preloadedMediaUrls.clear();
|
|
5877
|
-
this.preloadingMediaUrls.clear();
|
|
5878
|
-
this.adPodAllUrls = [];
|
|
5879
5178
|
this.adRequestQueue = [];
|
|
5880
5179
|
this.successfulAdRequests = [];
|
|
5881
5180
|
}
|