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/index.cjs
CHANGED
|
@@ -2155,6 +2155,7 @@ var StormcloudVideoPlayer = class {
|
|
|
2155
2155
|
this.fetchedAdDurations = /* @__PURE__ */ new Map();
|
|
2156
2156
|
this.targetAdBreakDurationMs = null;
|
|
2157
2157
|
this.isAdaptiveMode = false;
|
|
2158
|
+
this.failedVastUrls = /* @__PURE__ */ new Set();
|
|
2158
2159
|
initializePolyfills();
|
|
2159
2160
|
const browserOverrides = getBrowserConfigOverrides();
|
|
2160
2161
|
this.config = { ...config, ...browserOverrides };
|
|
@@ -3134,6 +3135,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3134
3135
|
this.vastToMediaUrlMap.clear();
|
|
3135
3136
|
this.preloadedMediaUrls.clear();
|
|
3136
3137
|
this.preloadingMediaUrls.clear();
|
|
3138
|
+
this.failedVastUrls.clear();
|
|
3137
3139
|
const currentMuted = this.video.muted;
|
|
3138
3140
|
const currentVolume = this.video.volume;
|
|
3139
3141
|
this.ima.updateOriginalMutedState(currentMuted, currentVolume);
|
|
@@ -3334,6 +3336,11 @@ var StormcloudVideoPlayer = class {
|
|
|
3334
3336
|
if (this.ima.isAdPlaying()) {
|
|
3335
3337
|
return;
|
|
3336
3338
|
}
|
|
3339
|
+
if (this.failedVastUrls.has(vastTagUrl)) {
|
|
3340
|
+
console.warn("[AD-ERROR] Skipping already-failed VAST URL:", vastTagUrl.substring(0, 60));
|
|
3341
|
+
this.handleAdFailure();
|
|
3342
|
+
return;
|
|
3343
|
+
}
|
|
3337
3344
|
const requestToken = ++this.adRequestTokenCounter;
|
|
3338
3345
|
this.activeAdRequestToken = requestToken;
|
|
3339
3346
|
this.startAdRequestWatchdog(requestToken);
|
|
@@ -3348,6 +3355,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3348
3355
|
await this.ima.play();
|
|
3349
3356
|
} catch (playError) {
|
|
3350
3357
|
console.error("[AD-ERROR] Failed to play ad:", playError);
|
|
3358
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
3351
3359
|
this.clearAdFailsafeTimer();
|
|
3352
3360
|
if (this.activeAdRequestToken === requestToken) {
|
|
3353
3361
|
this.activeAdRequestToken = null;
|
|
@@ -3357,6 +3365,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3357
3365
|
}
|
|
3358
3366
|
} catch (error) {
|
|
3359
3367
|
console.error("[AD-ERROR] Ad request failed:", error == null ? void 0 : error.message);
|
|
3368
|
+
this.failedVastUrls.add(vastTagUrl);
|
|
3360
3369
|
this.clearAdRequestWatchdog();
|
|
3361
3370
|
this.clearAdFailsafeTimer();
|
|
3362
3371
|
if (this.activeAdRequestToken === requestToken) {
|
|
@@ -3401,7 +3410,8 @@ var StormcloudVideoPlayer = class {
|
|
|
3401
3410
|
}
|
|
3402
3411
|
handleAdFailure() {
|
|
3403
3412
|
const remaining = this.getRemainingAdMs();
|
|
3404
|
-
|
|
3413
|
+
const availableAds = this.adPodQueue.filter((url) => !this.failedVastUrls.has(url)).length;
|
|
3414
|
+
if (remaining > 500 && availableAds > 0) {
|
|
3405
3415
|
if (this.isAdaptiveMode && this.currentAdIndex <= 1) {
|
|
3406
3416
|
console.log("[ADAPTIVE-POD] \u23F3 First ad failed, waiting for sequential preload to catch up...");
|
|
3407
3417
|
setTimeout(() => {
|
|
@@ -3418,6 +3428,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3418
3428
|
return;
|
|
3419
3429
|
}
|
|
3420
3430
|
}
|
|
3431
|
+
console.error("[AD-ERROR] All ads failed or time expired. Failed URLs:", this.failedVastUrls.size);
|
|
3421
3432
|
this.handleAdPodComplete();
|
|
3422
3433
|
}
|
|
3423
3434
|
tryNextAdWithRetry(retryCount) {
|
|
@@ -3873,6 +3884,10 @@ var StormcloudVideoPlayer = class {
|
|
|
3873
3884
|
for (let i = 0; i < this.adPodQueue.length; i++) {
|
|
3874
3885
|
const vastTagUrl = this.adPodQueue[i];
|
|
3875
3886
|
if (!vastTagUrl) continue;
|
|
3887
|
+
if (this.failedVastUrls.has(vastTagUrl)) {
|
|
3888
|
+
console.warn("[AD-ERROR] Skipping failed URL in queue");
|
|
3889
|
+
continue;
|
|
3890
|
+
}
|
|
3876
3891
|
const hasImaPreload = (_c = (_b = (_a = this.ima).hasPreloadedAd) == null ? void 0 : _b.call(_a, vastTagUrl)) != null ? _c : false;
|
|
3877
3892
|
const mediaUrls = this.vastToMediaUrlMap.get(vastTagUrl);
|
|
3878
3893
|
const hasMediaPreload = mediaUrls && mediaUrls.length > 0 ? this.preloadedMediaUrls.has(mediaUrls[0]) : false;
|