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/index.cjs
CHANGED
|
@@ -3255,21 +3255,38 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3255
3255
|
this.adPodQueue = [...vastTagUrls];
|
|
3256
3256
|
if (this.isAdaptiveMode) {
|
|
3257
3257
|
if (this.config.debugAdTiming) {
|
|
3258
|
-
console.log("[ADAPTIVE-POD]
|
|
3258
|
+
console.log("[ADAPTIVE-POD] \u{1F680} Preloading first 2 ads before starting playback...");
|
|
3259
3259
|
}
|
|
3260
3260
|
try {
|
|
3261
|
-
|
|
3261
|
+
const adsToPreloadBeforeStart = Math.min(2, this.adPodAllUrls.length);
|
|
3262
|
+
for (let i = 0; i < adsToPreloadBeforeStart; i++) {
|
|
3263
|
+
const url = this.adPodAllUrls[i];
|
|
3264
|
+
if (url) {
|
|
3265
|
+
await this.preloadSingleAd(url);
|
|
3266
|
+
if (this.config.debugAdTiming) {
|
|
3267
|
+
console.log(`[ADAPTIVE-POD] \u2705 Preloaded ad ${i + 1}/${adsToPreloadBeforeStart}`);
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3262
3271
|
if (this.config.debugAdTiming) {
|
|
3263
|
-
console.log("[ADAPTIVE-POD]
|
|
3272
|
+
console.log("[ADAPTIVE-POD] \u{1F3AC} First ads preloaded, starting playback immediately");
|
|
3264
3273
|
}
|
|
3265
3274
|
} catch (error) {
|
|
3266
3275
|
if (this.config.debugAdTiming) {
|
|
3267
3276
|
console.warn(
|
|
3268
|
-
"[ADAPTIVE-POD] Error
|
|
3277
|
+
"[ADAPTIVE-POD] \u26A0\uFE0F Error preloading initial ads:",
|
|
3269
3278
|
error
|
|
3270
3279
|
);
|
|
3271
3280
|
}
|
|
3272
3281
|
}
|
|
3282
|
+
this.preloadAllAdsInBackground().catch((error) => {
|
|
3283
|
+
if (this.config.debugAdTiming) {
|
|
3284
|
+
console.warn(
|
|
3285
|
+
"[ADAPTIVE-POD] Error in background preloading:",
|
|
3286
|
+
error
|
|
3287
|
+
);
|
|
3288
|
+
}
|
|
3289
|
+
});
|
|
3273
3290
|
await this.playAdPod();
|
|
3274
3291
|
} else {
|
|
3275
3292
|
this.preloadAllAdsInBackground().catch((error) => {
|
|
@@ -3294,7 +3311,7 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3294
3311
|
console.log("[DEBUG-POD] \u26A0\uFE0F No ads in pod");
|
|
3295
3312
|
return;
|
|
3296
3313
|
}
|
|
3297
|
-
const waitTime = this.isAdaptiveMode ?
|
|
3314
|
+
const waitTime = this.isAdaptiveMode ? 50 : 500;
|
|
3298
3315
|
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
3299
3316
|
if (this.config.debugAdTiming) {
|
|
3300
3317
|
console.log(
|
|
@@ -3860,16 +3877,27 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3860
3877
|
}
|
|
3861
3878
|
}
|
|
3862
3879
|
async preloadAllAdsInBackground() {
|
|
3880
|
+
var _a, _b;
|
|
3863
3881
|
if (this.adPodAllUrls.length === 0) {
|
|
3864
3882
|
return;
|
|
3865
3883
|
}
|
|
3866
3884
|
if (this.isAdaptiveMode) {
|
|
3867
3885
|
if (this.config.debugAdTiming) {
|
|
3868
3886
|
console.log(
|
|
3869
|
-
`[ADAPTIVE-POD] \u{1F504} Starting sequential preload of
|
|
3887
|
+
`[ADAPTIVE-POD] \u{1F504} Starting sequential preload of remaining ads`
|
|
3870
3888
|
);
|
|
3871
3889
|
}
|
|
3872
3890
|
const processedUrls = /* @__PURE__ */ new Set();
|
|
3891
|
+
for (const url of this.adPodAllUrls) {
|
|
3892
|
+
if (((_b = (_a = this.ima).hasPreloadedAd) == null ? void 0 : _b.call(_a, url)) || this.fetchedAdDurations.has(url)) {
|
|
3893
|
+
processedUrls.add(url);
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
if (this.config.debugAdTiming && processedUrls.size > 0) {
|
|
3897
|
+
console.log(
|
|
3898
|
+
`[ADAPTIVE-POD] \u{1F4E6} Skipping ${processedUrls.size} already-preloaded ads`
|
|
3899
|
+
);
|
|
3900
|
+
}
|
|
3873
3901
|
while (true) {
|
|
3874
3902
|
const nextUrl = this.adPodAllUrls.find((url) => !processedUrls.has(url));
|
|
3875
3903
|
if (!nextUrl) {
|