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
package/lib/players/index.cjs
CHANGED
|
@@ -2130,6 +2130,7 @@ var StormcloudVideoPlayer = class {
|
|
|
2130
2130
|
this.fetchedAdDurations = /* @__PURE__ */ new Map();
|
|
2131
2131
|
this.targetAdBreakDurationMs = null;
|
|
2132
2132
|
this.isAdaptiveMode = false;
|
|
2133
|
+
this.failedVastUrls = /* @__PURE__ */ new Set();
|
|
2133
2134
|
initializePolyfills();
|
|
2134
2135
|
const browserOverrides = getBrowserConfigOverrides();
|
|
2135
2136
|
this.config = { ...config, ...browserOverrides };
|
|
@@ -3109,6 +3110,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3109
3110
|
this.vastToMediaUrlMap.clear();
|
|
3110
3111
|
this.preloadedMediaUrls.clear();
|
|
3111
3112
|
this.preloadingMediaUrls.clear();
|
|
3113
|
+
this.failedVastUrls.clear();
|
|
3112
3114
|
const currentMuted = this.video.muted;
|
|
3113
3115
|
const currentVolume = this.video.volume;
|
|
3114
3116
|
this.ima.updateOriginalMutedState(currentMuted, currentVolume);
|
|
@@ -3309,6 +3311,11 @@ var StormcloudVideoPlayer = class {
|
|
|
3309
3311
|
if (this.ima.isAdPlaying()) {
|
|
3310
3312
|
return;
|
|
3311
3313
|
}
|
|
3314
|
+
if (this.failedVastUrls.has(vastTagUrl)) {
|
|
3315
|
+
console.warn("[AD-ERROR] Skipping already-failed VAST URL:", vastTagUrl.substring(0, 60));
|
|
3316
|
+
this.handleAdFailure();
|
|
3317
|
+
return;
|
|
3318
|
+
}
|
|
3312
3319
|
const requestToken = ++this.adRequestTokenCounter;
|
|
3313
3320
|
this.activeAdRequestToken = requestToken;
|
|
3314
3321
|
this.startAdRequestWatchdog(requestToken);
|
|
@@ -3323,6 +3330,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3323
3330
|
await this.ima.play();
|
|
3324
3331
|
} catch (playError) {
|
|
3325
3332
|
console.error("[AD-ERROR] Failed to play ad:", playError);
|
|
3333
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
3326
3334
|
this.clearAdFailsafeTimer();
|
|
3327
3335
|
if (this.activeAdRequestToken === requestToken) {
|
|
3328
3336
|
this.activeAdRequestToken = null;
|
|
@@ -3332,6 +3340,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3332
3340
|
}
|
|
3333
3341
|
} catch (error) {
|
|
3334
3342
|
console.error("[AD-ERROR] Ad request failed:", error == null ? void 0 : error.message);
|
|
3343
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
3335
3344
|
this.clearAdRequestWatchdog();
|
|
3336
3345
|
this.clearAdFailsafeTimer();
|
|
3337
3346
|
if (this.activeAdRequestToken === requestToken) {
|
|
@@ -3376,7 +3385,8 @@ var StormcloudVideoPlayer = class {
|
|
|
3376
3385
|
}
|
|
3377
3386
|
handleAdFailure() {
|
|
3378
3387
|
const remaining = this.getRemainingAdMs();
|
|
3379
|
-
|
|
3388
|
+
const availableAds = this.adPodQueue.filter((url) => !this.failedVastUrls.has(url)).length;
|
|
3389
|
+
if (remaining > 500 && availableAds > 0) {
|
|
3380
3390
|
if (this.isAdaptiveMode && this.currentAdIndex <= 1) {
|
|
3381
3391
|
console.log("[ADAPTIVE-POD] \u23F3 First ad failed, waiting for sequential preload to catch up...");
|
|
3382
3392
|
setTimeout(() => {
|
|
@@ -3393,6 +3403,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3393
3403
|
return;
|
|
3394
3404
|
}
|
|
3395
3405
|
}
|
|
3406
|
+
console.error("[AD-ERROR] All ads failed or time expired. Failed URLs:", this.failedVastUrls.size);
|
|
3396
3407
|
this.handleAdPodComplete();
|
|
3397
3408
|
}
|
|
3398
3409
|
tryNextAdWithRetry(retryCount) {
|
|
@@ -3848,6 +3859,10 @@ var StormcloudVideoPlayer = class {
|
|
|
3848
3859
|
for (let i = 0; i < this.adPodQueue.length; i++) {
|
|
3849
3860
|
const vastTagUrl = this.adPodQueue[i];
|
|
3850
3861
|
if (!vastTagUrl) continue;
|
|
3862
|
+
if (this.failedVastUrls.has(vastTagUrl)) {
|
|
3863
|
+
console.warn("[AD-ERROR] Skipping failed URL in queue");
|
|
3864
|
+
continue;
|
|
3865
|
+
}
|
|
3851
3866
|
const hasImaPreload = (_c = (_b = (_a = this.ima).hasPreloadedAd) == null ? void 0 : _b.call(_a, vastTagUrl)) != null ? _c : false;
|
|
3852
3867
|
const mediaUrls = this.vastToMediaUrlMap.get(vastTagUrl);
|
|
3853
3868
|
const hasMediaPreload = mediaUrls && mediaUrls.length > 0 ? this.preloadedMediaUrls.has(mediaUrls[0]) : false;
|