stormcloud-video-player 0.3.2 → 0.3.3
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 +49 -12
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +49 -12
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +49 -12
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +49 -12
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +49 -12
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +49 -12
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -3251,15 +3251,35 @@ var StormcloudVideoPlayer = class {
|
|
|
3251
3251
|
this.currentAdIndex = 0;
|
|
3252
3252
|
this.totalAdsInBreak = vastTagUrls.length;
|
|
3253
3253
|
this.adPodQueue = [...vastTagUrls];
|
|
3254
|
-
this.
|
|
3254
|
+
if (this.isAdaptiveMode) {
|
|
3255
3255
|
if (this.config.debugAdTiming) {
|
|
3256
|
-
console.
|
|
3257
|
-
"[StormcloudVideoPlayer] Error in background preloading:",
|
|
3258
|
-
error
|
|
3259
|
-
);
|
|
3256
|
+
console.log("[ADAPTIVE-POD] Waiting for sequential preloading to complete...");
|
|
3260
3257
|
}
|
|
3261
|
-
|
|
3262
|
-
|
|
3258
|
+
try {
|
|
3259
|
+
await this.preloadAllAdsInBackground();
|
|
3260
|
+
if (this.config.debugAdTiming) {
|
|
3261
|
+
console.log("[ADAPTIVE-POD] Preloading complete, starting playback");
|
|
3262
|
+
}
|
|
3263
|
+
} catch (error) {
|
|
3264
|
+
if (this.config.debugAdTiming) {
|
|
3265
|
+
console.warn(
|
|
3266
|
+
"[ADAPTIVE-POD] Error in preloading:",
|
|
3267
|
+
error
|
|
3268
|
+
);
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
await this.playAdPod();
|
|
3272
|
+
} else {
|
|
3273
|
+
this.preloadAllAdsInBackground().catch((error) => {
|
|
3274
|
+
if (this.config.debugAdTiming) {
|
|
3275
|
+
console.warn(
|
|
3276
|
+
"[StormcloudVideoPlayer] Error in background preloading:",
|
|
3277
|
+
error
|
|
3278
|
+
);
|
|
3279
|
+
}
|
|
3280
|
+
});
|
|
3281
|
+
await this.playAdPod();
|
|
3282
|
+
}
|
|
3263
3283
|
}
|
|
3264
3284
|
if (this.expectedAdBreakDurationMs == null && (scheduled == null ? void 0 : scheduled.durationMs) != null) {
|
|
3265
3285
|
this.expectedAdBreakDurationMs = scheduled.durationMs;
|
|
@@ -3272,20 +3292,28 @@ var StormcloudVideoPlayer = class {
|
|
|
3272
3292
|
console.log("[DEBUG-POD] \u26A0\uFE0F No ads in pod");
|
|
3273
3293
|
return;
|
|
3274
3294
|
}
|
|
3275
|
-
const waitTime = this.isAdaptiveMode ?
|
|
3295
|
+
const waitTime = this.isAdaptiveMode ? 100 : 500;
|
|
3276
3296
|
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
3297
|
+
if (this.config.debugAdTiming) {
|
|
3298
|
+
console.log(
|
|
3299
|
+
`[DEBUG-POD] \u{1F50D} Looking for preloaded ad in queue of ${this.adPodQueue.length} URLs`
|
|
3300
|
+
);
|
|
3301
|
+
}
|
|
3277
3302
|
const firstPreloaded = this.findNextPreloadedAd();
|
|
3278
3303
|
if (!firstPreloaded) {
|
|
3279
|
-
console.log("[DEBUG-POD] \u26A0\uFE0F No preloaded ads
|
|
3304
|
+
console.log("[DEBUG-POD] \u26A0\uFE0F No preloaded ads found, trying first ad from queue");
|
|
3280
3305
|
const firstAd = this.adPodQueue.shift();
|
|
3281
3306
|
if (firstAd) {
|
|
3282
3307
|
this.currentAdIndex++;
|
|
3308
|
+
console.log(`[DEBUG-POD] \u{1F3AC} Attempting to play first ad (not preloaded): ${firstAd.substring(0, 60)}...`);
|
|
3283
3309
|
try {
|
|
3284
3310
|
await this.playSingleAd(firstAd);
|
|
3285
3311
|
} catch (error) {
|
|
3286
3312
|
console.log("[DEBUG-POD] \u26A0\uFE0F First ad failed, error handler will retry");
|
|
3287
3313
|
return;
|
|
3288
3314
|
}
|
|
3315
|
+
} else {
|
|
3316
|
+
console.log("[DEBUG-POD] \u274C No ads available in queue");
|
|
3289
3317
|
}
|
|
3290
3318
|
return;
|
|
3291
3319
|
}
|
|
@@ -3960,17 +3988,26 @@ var StormcloudVideoPlayer = class {
|
|
|
3960
3988
|
}
|
|
3961
3989
|
findNextPreloadedAd() {
|
|
3962
3990
|
var _a, _b, _c;
|
|
3991
|
+
if (this.config.debugAdTiming) {
|
|
3992
|
+
console.log(
|
|
3993
|
+
`[DEBUG-POD] \u{1F50E} Searching for preloaded ad in queue (${this.adPodQueue.length} URLs, ${this.preloadedMediaUrls.size} media preloaded, ${this.vastToMediaUrlMap.size} VAST mappings)`
|
|
3994
|
+
);
|
|
3995
|
+
}
|
|
3963
3996
|
for (let i = 0; i < this.adPodQueue.length; i++) {
|
|
3964
3997
|
const vastTagUrl = this.adPodQueue[i];
|
|
3965
3998
|
if (!vastTagUrl) continue;
|
|
3966
3999
|
const hasImaPreload = (_c = (_b = (_a = this.ima).hasPreloadedAd) == null ? void 0 : _b.call(_a, vastTagUrl)) != null ? _c : false;
|
|
3967
4000
|
const mediaUrls = this.vastToMediaUrlMap.get(vastTagUrl);
|
|
3968
4001
|
const hasMediaPreload = mediaUrls && mediaUrls.length > 0 ? this.preloadedMediaUrls.has(mediaUrls[0]) : false;
|
|
4002
|
+
if (this.config.debugAdTiming) {
|
|
4003
|
+
console.log(
|
|
4004
|
+
`[DEBUG-POD] Ad ${i}: IMA=${hasImaPreload}, Media=${hasMediaPreload}, MediaURLs=${(mediaUrls == null ? void 0 : mediaUrls.length) || 0}, URL=${vastTagUrl.substring(0, 60)}...`
|
|
4005
|
+
);
|
|
4006
|
+
}
|
|
3969
4007
|
if (hasImaPreload || hasMediaPreload) {
|
|
3970
4008
|
if (this.config.debugAdTiming) {
|
|
3971
4009
|
console.log(
|
|
3972
|
-
`[
|
|
3973
|
-
{ hasImaPreload, hasMediaPreload }
|
|
4010
|
+
`[DEBUG-POD] \u2705 Found preloaded ad at index ${i}`
|
|
3974
4011
|
);
|
|
3975
4012
|
}
|
|
3976
4013
|
this.adPodQueue.splice(0, i + 1);
|
|
@@ -3979,7 +4016,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3979
4016
|
}
|
|
3980
4017
|
if (this.config.debugAdTiming) {
|
|
3981
4018
|
console.log(
|
|
3982
|
-
|
|
4019
|
+
`[DEBUG-POD] \u274C No preloaded ads found in queue`
|
|
3983
4020
|
);
|
|
3984
4021
|
}
|
|
3985
4022
|
return void 0;
|