stormcloud-video-player 0.3.5 → 0.3.6
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 +34 -6
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +34 -6
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +34 -6
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +34 -6
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +34 -6
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +34 -6
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
package/lib/players/index.cjs
CHANGED
|
@@ -3230,21 +3230,38 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3230
3230
|
this.adPodQueue = [...vastTagUrls];
|
|
3231
3231
|
if (this.isAdaptiveMode) {
|
|
3232
3232
|
if (this.config.debugAdTiming) {
|
|
3233
|
-
console.log("[ADAPTIVE-POD]
|
|
3233
|
+
console.log("[ADAPTIVE-POD] \u{1F680} Preloading first 2 ads before starting playback...");
|
|
3234
3234
|
}
|
|
3235
3235
|
try {
|
|
3236
|
-
|
|
3236
|
+
const adsToPreloadBeforeStart = Math.min(2, this.adPodAllUrls.length);
|
|
3237
|
+
for (let i = 0; i < adsToPreloadBeforeStart; i++) {
|
|
3238
|
+
const url = this.adPodAllUrls[i];
|
|
3239
|
+
if (url) {
|
|
3240
|
+
await this.preloadSingleAd(url);
|
|
3241
|
+
if (this.config.debugAdTiming) {
|
|
3242
|
+
console.log(`[ADAPTIVE-POD] \u2705 Preloaded ad ${i + 1}/${adsToPreloadBeforeStart}`);
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
}
|
|
3237
3246
|
if (this.config.debugAdTiming) {
|
|
3238
|
-
console.log("[ADAPTIVE-POD]
|
|
3247
|
+
console.log("[ADAPTIVE-POD] \u{1F3AC} First ads preloaded, starting playback immediately");
|
|
3239
3248
|
}
|
|
3240
3249
|
} catch (error) {
|
|
3241
3250
|
if (this.config.debugAdTiming) {
|
|
3242
3251
|
console.warn(
|
|
3243
|
-
"[ADAPTIVE-POD] Error
|
|
3252
|
+
"[ADAPTIVE-POD] \u26A0\uFE0F Error preloading initial ads:",
|
|
3244
3253
|
error
|
|
3245
3254
|
);
|
|
3246
3255
|
}
|
|
3247
3256
|
}
|
|
3257
|
+
this.preloadAllAdsInBackground().catch((error) => {
|
|
3258
|
+
if (this.config.debugAdTiming) {
|
|
3259
|
+
console.warn(
|
|
3260
|
+
"[ADAPTIVE-POD] Error in background preloading:",
|
|
3261
|
+
error
|
|
3262
|
+
);
|
|
3263
|
+
}
|
|
3264
|
+
});
|
|
3248
3265
|
await this.playAdPod();
|
|
3249
3266
|
} else {
|
|
3250
3267
|
this.preloadAllAdsInBackground().catch((error) => {
|
|
@@ -3269,7 +3286,7 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3269
3286
|
console.log("[DEBUG-POD] \u26A0\uFE0F No ads in pod");
|
|
3270
3287
|
return;
|
|
3271
3288
|
}
|
|
3272
|
-
const waitTime = this.isAdaptiveMode ?
|
|
3289
|
+
const waitTime = this.isAdaptiveMode ? 50 : 500;
|
|
3273
3290
|
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
3274
3291
|
if (this.config.debugAdTiming) {
|
|
3275
3292
|
console.log(
|
|
@@ -3835,16 +3852,27 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3835
3852
|
}
|
|
3836
3853
|
}
|
|
3837
3854
|
async preloadAllAdsInBackground() {
|
|
3855
|
+
var _a, _b;
|
|
3838
3856
|
if (this.adPodAllUrls.length === 0) {
|
|
3839
3857
|
return;
|
|
3840
3858
|
}
|
|
3841
3859
|
if (this.isAdaptiveMode) {
|
|
3842
3860
|
if (this.config.debugAdTiming) {
|
|
3843
3861
|
console.log(
|
|
3844
|
-
`[ADAPTIVE-POD] \u{1F504} Starting sequential preload of
|
|
3862
|
+
`[ADAPTIVE-POD] \u{1F504} Starting sequential preload of remaining ads`
|
|
3845
3863
|
);
|
|
3846
3864
|
}
|
|
3847
3865
|
const processedUrls = /* @__PURE__ */ new Set();
|
|
3866
|
+
for (const url of this.adPodAllUrls) {
|
|
3867
|
+
if (((_b = (_a = this.ima).hasPreloadedAd) == null ? void 0 : _b.call(_a, url)) || this.fetchedAdDurations.has(url)) {
|
|
3868
|
+
processedUrls.add(url);
|
|
3869
|
+
}
|
|
3870
|
+
}
|
|
3871
|
+
if (this.config.debugAdTiming && processedUrls.size > 0) {
|
|
3872
|
+
console.log(
|
|
3873
|
+
`[ADAPTIVE-POD] \u{1F4E6} Skipping ${processedUrls.size} already-preloaded ads`
|
|
3874
|
+
);
|
|
3875
|
+
}
|
|
3848
3876
|
while (true) {
|
|
3849
3877
|
const nextUrl = this.adPodAllUrls.find((url) => !processedUrls.has(url));
|
|
3850
3878
|
if (!nextUrl) {
|