stormcloud-video-player 0.3.7 → 0.3.8
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 +16 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +16 -1
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +16 -1
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/player/StormcloudVideoPlayer.d.cts +1 -0
- package/lib/players/HlsPlayer.cjs +16 -1
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +16 -1
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +16 -1
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -2088,6 +2088,7 @@ var StormcloudVideoPlayer = class {
|
|
|
2088
2088
|
this.fetchedAdDurations = /* @__PURE__ */ new Map();
|
|
2089
2089
|
this.targetAdBreakDurationMs = null;
|
|
2090
2090
|
this.isAdaptiveMode = false;
|
|
2091
|
+
this.failedVastUrls = /* @__PURE__ */ new Set();
|
|
2091
2092
|
initializePolyfills();
|
|
2092
2093
|
const browserOverrides = getBrowserConfigOverrides();
|
|
2093
2094
|
this.config = { ...config, ...browserOverrides };
|
|
@@ -3067,6 +3068,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3067
3068
|
this.vastToMediaUrlMap.clear();
|
|
3068
3069
|
this.preloadedMediaUrls.clear();
|
|
3069
3070
|
this.preloadingMediaUrls.clear();
|
|
3071
|
+
this.failedVastUrls.clear();
|
|
3070
3072
|
const currentMuted = this.video.muted;
|
|
3071
3073
|
const currentVolume = this.video.volume;
|
|
3072
3074
|
this.ima.updateOriginalMutedState(currentMuted, currentVolume);
|
|
@@ -3267,6 +3269,11 @@ var StormcloudVideoPlayer = class {
|
|
|
3267
3269
|
if (this.ima.isAdPlaying()) {
|
|
3268
3270
|
return;
|
|
3269
3271
|
}
|
|
3272
|
+
if (this.failedVastUrls.has(vastTagUrl)) {
|
|
3273
|
+
console.warn("[AD-ERROR] Skipping already-failed VAST URL:", vastTagUrl.substring(0, 60));
|
|
3274
|
+
this.handleAdFailure();
|
|
3275
|
+
return;
|
|
3276
|
+
}
|
|
3270
3277
|
const requestToken = ++this.adRequestTokenCounter;
|
|
3271
3278
|
this.activeAdRequestToken = requestToken;
|
|
3272
3279
|
this.startAdRequestWatchdog(requestToken);
|
|
@@ -3281,6 +3288,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3281
3288
|
await this.ima.play();
|
|
3282
3289
|
} catch (playError) {
|
|
3283
3290
|
console.error("[AD-ERROR] Failed to play ad:", playError);
|
|
3291
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
3284
3292
|
this.clearAdFailsafeTimer();
|
|
3285
3293
|
if (this.activeAdRequestToken === requestToken) {
|
|
3286
3294
|
this.activeAdRequestToken = null;
|
|
@@ -3290,6 +3298,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3290
3298
|
}
|
|
3291
3299
|
} catch (error) {
|
|
3292
3300
|
console.error("[AD-ERROR] Ad request failed:", error == null ? void 0 : error.message);
|
|
3301
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
3293
3302
|
this.clearAdRequestWatchdog();
|
|
3294
3303
|
this.clearAdFailsafeTimer();
|
|
3295
3304
|
if (this.activeAdRequestToken === requestToken) {
|
|
@@ -3334,7 +3343,8 @@ var StormcloudVideoPlayer = class {
|
|
|
3334
3343
|
}
|
|
3335
3344
|
handleAdFailure() {
|
|
3336
3345
|
const remaining = this.getRemainingAdMs();
|
|
3337
|
-
|
|
3346
|
+
const availableAds = this.adPodQueue.filter((url) => !this.failedVastUrls.has(url)).length;
|
|
3347
|
+
if (remaining > 500 && availableAds > 0) {
|
|
3338
3348
|
if (this.isAdaptiveMode && this.currentAdIndex <= 1) {
|
|
3339
3349
|
console.log("[ADAPTIVE-POD] \u23F3 First ad failed, waiting for sequential preload to catch up...");
|
|
3340
3350
|
setTimeout(() => {
|
|
@@ -3351,6 +3361,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3351
3361
|
return;
|
|
3352
3362
|
}
|
|
3353
3363
|
}
|
|
3364
|
+
console.error("[AD-ERROR] All ads failed or time expired. Failed URLs:", this.failedVastUrls.size);
|
|
3354
3365
|
this.handleAdPodComplete();
|
|
3355
3366
|
}
|
|
3356
3367
|
tryNextAdWithRetry(retryCount) {
|
|
@@ -3806,6 +3817,10 @@ var StormcloudVideoPlayer = class {
|
|
|
3806
3817
|
for (let i = 0; i < this.adPodQueue.length; i++) {
|
|
3807
3818
|
const vastTagUrl = this.adPodQueue[i];
|
|
3808
3819
|
if (!vastTagUrl) continue;
|
|
3820
|
+
if (this.failedVastUrls.has(vastTagUrl)) {
|
|
3821
|
+
console.warn("[AD-ERROR] Skipping failed URL in queue");
|
|
3822
|
+
continue;
|
|
3823
|
+
}
|
|
3809
3824
|
const hasImaPreload = (_c = (_b = (_a = this.ima).hasPreloadedAd) == null ? void 0 : _b.call(_a, vastTagUrl)) != null ? _c : false;
|
|
3810
3825
|
const mediaUrls = this.vastToMediaUrlMap.get(vastTagUrl);
|
|
3811
3826
|
const hasMediaPreload = mediaUrls && mediaUrls.length > 0 ? this.preloadedMediaUrls.has(mediaUrls[0]) : false;
|