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