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/players/index.cjs
CHANGED
|
@@ -3226,15 +3226,35 @@ var StormcloudVideoPlayer = class {
|
|
|
3226
3226
|
this.currentAdIndex = 0;
|
|
3227
3227
|
this.totalAdsInBreak = vastTagUrls.length;
|
|
3228
3228
|
this.adPodQueue = [...vastTagUrls];
|
|
3229
|
-
this.
|
|
3229
|
+
if (this.isAdaptiveMode) {
|
|
3230
3230
|
if (this.config.debugAdTiming) {
|
|
3231
|
-
console.
|
|
3232
|
-
"[StormcloudVideoPlayer] Error in background preloading:",
|
|
3233
|
-
error
|
|
3234
|
-
);
|
|
3231
|
+
console.log("[ADAPTIVE-POD] Waiting for sequential preloading to complete...");
|
|
3235
3232
|
}
|
|
3236
|
-
|
|
3237
|
-
|
|
3233
|
+
try {
|
|
3234
|
+
await this.preloadAllAdsInBackground();
|
|
3235
|
+
if (this.config.debugAdTiming) {
|
|
3236
|
+
console.log("[ADAPTIVE-POD] Preloading complete, starting playback");
|
|
3237
|
+
}
|
|
3238
|
+
} catch (error) {
|
|
3239
|
+
if (this.config.debugAdTiming) {
|
|
3240
|
+
console.warn(
|
|
3241
|
+
"[ADAPTIVE-POD] Error in preloading:",
|
|
3242
|
+
error
|
|
3243
|
+
);
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3246
|
+
await this.playAdPod();
|
|
3247
|
+
} else {
|
|
3248
|
+
this.preloadAllAdsInBackground().catch((error) => {
|
|
3249
|
+
if (this.config.debugAdTiming) {
|
|
3250
|
+
console.warn(
|
|
3251
|
+
"[StormcloudVideoPlayer] Error in background preloading:",
|
|
3252
|
+
error
|
|
3253
|
+
);
|
|
3254
|
+
}
|
|
3255
|
+
});
|
|
3256
|
+
await this.playAdPod();
|
|
3257
|
+
}
|
|
3238
3258
|
}
|
|
3239
3259
|
if (this.expectedAdBreakDurationMs == null && (scheduled == null ? void 0 : scheduled.durationMs) != null) {
|
|
3240
3260
|
this.expectedAdBreakDurationMs = scheduled.durationMs;
|
|
@@ -3247,20 +3267,28 @@ var StormcloudVideoPlayer = class {
|
|
|
3247
3267
|
console.log("[DEBUG-POD] \u26A0\uFE0F No ads in pod");
|
|
3248
3268
|
return;
|
|
3249
3269
|
}
|
|
3250
|
-
const waitTime = this.isAdaptiveMode ?
|
|
3270
|
+
const waitTime = this.isAdaptiveMode ? 100 : 500;
|
|
3251
3271
|
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
3272
|
+
if (this.config.debugAdTiming) {
|
|
3273
|
+
console.log(
|
|
3274
|
+
`[DEBUG-POD] \u{1F50D} Looking for preloaded ad in queue of ${this.adPodQueue.length} URLs`
|
|
3275
|
+
);
|
|
3276
|
+
}
|
|
3252
3277
|
const firstPreloaded = this.findNextPreloadedAd();
|
|
3253
3278
|
if (!firstPreloaded) {
|
|
3254
|
-
console.log("[DEBUG-POD] \u26A0\uFE0F No preloaded ads
|
|
3279
|
+
console.log("[DEBUG-POD] \u26A0\uFE0F No preloaded ads found, trying first ad from queue");
|
|
3255
3280
|
const firstAd = this.adPodQueue.shift();
|
|
3256
3281
|
if (firstAd) {
|
|
3257
3282
|
this.currentAdIndex++;
|
|
3283
|
+
console.log(`[DEBUG-POD] \u{1F3AC} Attempting to play first ad (not preloaded): ${firstAd.substring(0, 60)}...`);
|
|
3258
3284
|
try {
|
|
3259
3285
|
await this.playSingleAd(firstAd);
|
|
3260
3286
|
} catch (error) {
|
|
3261
3287
|
console.log("[DEBUG-POD] \u26A0\uFE0F First ad failed, error handler will retry");
|
|
3262
3288
|
return;
|
|
3263
3289
|
}
|
|
3290
|
+
} else {
|
|
3291
|
+
console.log("[DEBUG-POD] \u274C No ads available in queue");
|
|
3264
3292
|
}
|
|
3265
3293
|
return;
|
|
3266
3294
|
}
|
|
@@ -3935,17 +3963,26 @@ var StormcloudVideoPlayer = class {
|
|
|
3935
3963
|
}
|
|
3936
3964
|
findNextPreloadedAd() {
|
|
3937
3965
|
var _a, _b, _c;
|
|
3966
|
+
if (this.config.debugAdTiming) {
|
|
3967
|
+
console.log(
|
|
3968
|
+
`[DEBUG-POD] \u{1F50E} Searching for preloaded ad in queue (${this.adPodQueue.length} URLs, ${this.preloadedMediaUrls.size} media preloaded, ${this.vastToMediaUrlMap.size} VAST mappings)`
|
|
3969
|
+
);
|
|
3970
|
+
}
|
|
3938
3971
|
for (let i = 0; i < this.adPodQueue.length; i++) {
|
|
3939
3972
|
const vastTagUrl = this.adPodQueue[i];
|
|
3940
3973
|
if (!vastTagUrl) continue;
|
|
3941
3974
|
const hasImaPreload = (_c = (_b = (_a = this.ima).hasPreloadedAd) == null ? void 0 : _b.call(_a, vastTagUrl)) != null ? _c : false;
|
|
3942
3975
|
const mediaUrls = this.vastToMediaUrlMap.get(vastTagUrl);
|
|
3943
3976
|
const hasMediaPreload = mediaUrls && mediaUrls.length > 0 ? this.preloadedMediaUrls.has(mediaUrls[0]) : false;
|
|
3977
|
+
if (this.config.debugAdTiming) {
|
|
3978
|
+
console.log(
|
|
3979
|
+
`[DEBUG-POD] Ad ${i}: IMA=${hasImaPreload}, Media=${hasMediaPreload}, MediaURLs=${(mediaUrls == null ? void 0 : mediaUrls.length) || 0}, URL=${vastTagUrl.substring(0, 60)}...`
|
|
3980
|
+
);
|
|
3981
|
+
}
|
|
3944
3982
|
if (hasImaPreload || hasMediaPreload) {
|
|
3945
3983
|
if (this.config.debugAdTiming) {
|
|
3946
3984
|
console.log(
|
|
3947
|
-
`[
|
|
3948
|
-
{ hasImaPreload, hasMediaPreload }
|
|
3985
|
+
`[DEBUG-POD] \u2705 Found preloaded ad at index ${i}`
|
|
3949
3986
|
);
|
|
3950
3987
|
}
|
|
3951
3988
|
this.adPodQueue.splice(0, i + 1);
|
|
@@ -3954,7 +3991,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3954
3991
|
}
|
|
3955
3992
|
if (this.config.debugAdTiming) {
|
|
3956
3993
|
console.log(
|
|
3957
|
-
|
|
3994
|
+
`[DEBUG-POD] \u274C No preloaded ads found in queue`
|
|
3958
3995
|
);
|
|
3959
3996
|
}
|
|
3960
3997
|
return void 0;
|