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
|
@@ -3187,15 +3187,35 @@ var StormcloudVideoPlayer = class {
|
|
|
3187
3187
|
this.currentAdIndex = 0;
|
|
3188
3188
|
this.totalAdsInBreak = vastTagUrls.length;
|
|
3189
3189
|
this.adPodQueue = [...vastTagUrls];
|
|
3190
|
-
this.
|
|
3190
|
+
if (this.isAdaptiveMode) {
|
|
3191
3191
|
if (this.config.debugAdTiming) {
|
|
3192
|
-
console.
|
|
3193
|
-
"[StormcloudVideoPlayer] Error in background preloading:",
|
|
3194
|
-
error
|
|
3195
|
-
);
|
|
3192
|
+
console.log("[ADAPTIVE-POD] Waiting for sequential preloading to complete...");
|
|
3196
3193
|
}
|
|
3197
|
-
|
|
3198
|
-
|
|
3194
|
+
try {
|
|
3195
|
+
await this.preloadAllAdsInBackground();
|
|
3196
|
+
if (this.config.debugAdTiming) {
|
|
3197
|
+
console.log("[ADAPTIVE-POD] Preloading complete, starting playback");
|
|
3198
|
+
}
|
|
3199
|
+
} catch (error) {
|
|
3200
|
+
if (this.config.debugAdTiming) {
|
|
3201
|
+
console.warn(
|
|
3202
|
+
"[ADAPTIVE-POD] Error in preloading:",
|
|
3203
|
+
error
|
|
3204
|
+
);
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
await this.playAdPod();
|
|
3208
|
+
} else {
|
|
3209
|
+
this.preloadAllAdsInBackground().catch((error) => {
|
|
3210
|
+
if (this.config.debugAdTiming) {
|
|
3211
|
+
console.warn(
|
|
3212
|
+
"[StormcloudVideoPlayer] Error in background preloading:",
|
|
3213
|
+
error
|
|
3214
|
+
);
|
|
3215
|
+
}
|
|
3216
|
+
});
|
|
3217
|
+
await this.playAdPod();
|
|
3218
|
+
}
|
|
3199
3219
|
}
|
|
3200
3220
|
if (this.expectedAdBreakDurationMs == null && (scheduled == null ? void 0 : scheduled.durationMs) != null) {
|
|
3201
3221
|
this.expectedAdBreakDurationMs = scheduled.durationMs;
|
|
@@ -3208,20 +3228,28 @@ var StormcloudVideoPlayer = class {
|
|
|
3208
3228
|
console.log("[DEBUG-POD] \u26A0\uFE0F No ads in pod");
|
|
3209
3229
|
return;
|
|
3210
3230
|
}
|
|
3211
|
-
const waitTime = this.isAdaptiveMode ?
|
|
3231
|
+
const waitTime = this.isAdaptiveMode ? 100 : 500;
|
|
3212
3232
|
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
3233
|
+
if (this.config.debugAdTiming) {
|
|
3234
|
+
console.log(
|
|
3235
|
+
`[DEBUG-POD] \u{1F50D} Looking for preloaded ad in queue of ${this.adPodQueue.length} URLs`
|
|
3236
|
+
);
|
|
3237
|
+
}
|
|
3213
3238
|
const firstPreloaded = this.findNextPreloadedAd();
|
|
3214
3239
|
if (!firstPreloaded) {
|
|
3215
|
-
console.log("[DEBUG-POD] \u26A0\uFE0F No preloaded ads
|
|
3240
|
+
console.log("[DEBUG-POD] \u26A0\uFE0F No preloaded ads found, trying first ad from queue");
|
|
3216
3241
|
const firstAd = this.adPodQueue.shift();
|
|
3217
3242
|
if (firstAd) {
|
|
3218
3243
|
this.currentAdIndex++;
|
|
3244
|
+
console.log(`[DEBUG-POD] \u{1F3AC} Attempting to play first ad (not preloaded): ${firstAd.substring(0, 60)}...`);
|
|
3219
3245
|
try {
|
|
3220
3246
|
await this.playSingleAd(firstAd);
|
|
3221
3247
|
} catch (error) {
|
|
3222
3248
|
console.log("[DEBUG-POD] \u26A0\uFE0F First ad failed, error handler will retry");
|
|
3223
3249
|
return;
|
|
3224
3250
|
}
|
|
3251
|
+
} else {
|
|
3252
|
+
console.log("[DEBUG-POD] \u274C No ads available in queue");
|
|
3225
3253
|
}
|
|
3226
3254
|
return;
|
|
3227
3255
|
}
|
|
@@ -3896,17 +3924,26 @@ var StormcloudVideoPlayer = class {
|
|
|
3896
3924
|
}
|
|
3897
3925
|
findNextPreloadedAd() {
|
|
3898
3926
|
var _a, _b, _c;
|
|
3927
|
+
if (this.config.debugAdTiming) {
|
|
3928
|
+
console.log(
|
|
3929
|
+
`[DEBUG-POD] \u{1F50E} Searching for preloaded ad in queue (${this.adPodQueue.length} URLs, ${this.preloadedMediaUrls.size} media preloaded, ${this.vastToMediaUrlMap.size} VAST mappings)`
|
|
3930
|
+
);
|
|
3931
|
+
}
|
|
3899
3932
|
for (let i = 0; i < this.adPodQueue.length; i++) {
|
|
3900
3933
|
const vastTagUrl = this.adPodQueue[i];
|
|
3901
3934
|
if (!vastTagUrl) continue;
|
|
3902
3935
|
const hasImaPreload = (_c = (_b = (_a = this.ima).hasPreloadedAd) == null ? void 0 : _b.call(_a, vastTagUrl)) != null ? _c : false;
|
|
3903
3936
|
const mediaUrls = this.vastToMediaUrlMap.get(vastTagUrl);
|
|
3904
3937
|
const hasMediaPreload = mediaUrls && mediaUrls.length > 0 ? this.preloadedMediaUrls.has(mediaUrls[0]) : false;
|
|
3938
|
+
if (this.config.debugAdTiming) {
|
|
3939
|
+
console.log(
|
|
3940
|
+
`[DEBUG-POD] Ad ${i}: IMA=${hasImaPreload}, Media=${hasMediaPreload}, MediaURLs=${(mediaUrls == null ? void 0 : mediaUrls.length) || 0}, URL=${vastTagUrl.substring(0, 60)}...`
|
|
3941
|
+
);
|
|
3942
|
+
}
|
|
3905
3943
|
if (hasImaPreload || hasMediaPreload) {
|
|
3906
3944
|
if (this.config.debugAdTiming) {
|
|
3907
3945
|
console.log(
|
|
3908
|
-
`[
|
|
3909
|
-
{ hasImaPreload, hasMediaPreload }
|
|
3946
|
+
`[DEBUG-POD] \u2705 Found preloaded ad at index ${i}`
|
|
3910
3947
|
);
|
|
3911
3948
|
}
|
|
3912
3949
|
this.adPodQueue.splice(0, i + 1);
|
|
@@ -3915,7 +3952,7 @@ var StormcloudVideoPlayer = class {
|
|
|
3915
3952
|
}
|
|
3916
3953
|
if (this.config.debugAdTiming) {
|
|
3917
3954
|
console.log(
|
|
3918
|
-
|
|
3955
|
+
`[DEBUG-POD] \u274C No preloaded ads found in queue`
|
|
3919
3956
|
);
|
|
3920
3957
|
}
|
|
3921
3958
|
return void 0;
|