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
|
@@ -3191,21 +3191,38 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3191
3191
|
this.adPodQueue = [...vastTagUrls];
|
|
3192
3192
|
if (this.isAdaptiveMode) {
|
|
3193
3193
|
if (this.config.debugAdTiming) {
|
|
3194
|
-
console.log("[ADAPTIVE-POD]
|
|
3194
|
+
console.log("[ADAPTIVE-POD] \u{1F680} Preloading first 2 ads before starting playback...");
|
|
3195
3195
|
}
|
|
3196
3196
|
try {
|
|
3197
|
-
|
|
3197
|
+
const adsToPreloadBeforeStart = Math.min(2, this.adPodAllUrls.length);
|
|
3198
|
+
for (let i = 0; i < adsToPreloadBeforeStart; i++) {
|
|
3199
|
+
const url = this.adPodAllUrls[i];
|
|
3200
|
+
if (url) {
|
|
3201
|
+
await this.preloadSingleAd(url);
|
|
3202
|
+
if (this.config.debugAdTiming) {
|
|
3203
|
+
console.log(`[ADAPTIVE-POD] \u2705 Preloaded ad ${i + 1}/${adsToPreloadBeforeStart}`);
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3198
3207
|
if (this.config.debugAdTiming) {
|
|
3199
|
-
console.log("[ADAPTIVE-POD]
|
|
3208
|
+
console.log("[ADAPTIVE-POD] \u{1F3AC} First ads preloaded, starting playback immediately");
|
|
3200
3209
|
}
|
|
3201
3210
|
} catch (error) {
|
|
3202
3211
|
if (this.config.debugAdTiming) {
|
|
3203
3212
|
console.warn(
|
|
3204
|
-
"[ADAPTIVE-POD] Error
|
|
3213
|
+
"[ADAPTIVE-POD] \u26A0\uFE0F Error preloading initial ads:",
|
|
3205
3214
|
error
|
|
3206
3215
|
);
|
|
3207
3216
|
}
|
|
3208
3217
|
}
|
|
3218
|
+
this.preloadAllAdsInBackground().catch((error) => {
|
|
3219
|
+
if (this.config.debugAdTiming) {
|
|
3220
|
+
console.warn(
|
|
3221
|
+
"[ADAPTIVE-POD] Error in background preloading:",
|
|
3222
|
+
error
|
|
3223
|
+
);
|
|
3224
|
+
}
|
|
3225
|
+
});
|
|
3209
3226
|
await this.playAdPod();
|
|
3210
3227
|
} else {
|
|
3211
3228
|
this.preloadAllAdsInBackground().catch((error) => {
|
|
@@ -3230,7 +3247,7 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3230
3247
|
console.log("[DEBUG-POD] \u26A0\uFE0F No ads in pod");
|
|
3231
3248
|
return;
|
|
3232
3249
|
}
|
|
3233
|
-
const waitTime = this.isAdaptiveMode ?
|
|
3250
|
+
const waitTime = this.isAdaptiveMode ? 50 : 500;
|
|
3234
3251
|
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
3235
3252
|
if (this.config.debugAdTiming) {
|
|
3236
3253
|
console.log(
|
|
@@ -3796,16 +3813,27 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3796
3813
|
}
|
|
3797
3814
|
}
|
|
3798
3815
|
async preloadAllAdsInBackground() {
|
|
3816
|
+
var _a, _b;
|
|
3799
3817
|
if (this.adPodAllUrls.length === 0) {
|
|
3800
3818
|
return;
|
|
3801
3819
|
}
|
|
3802
3820
|
if (this.isAdaptiveMode) {
|
|
3803
3821
|
if (this.config.debugAdTiming) {
|
|
3804
3822
|
console.log(
|
|
3805
|
-
`[ADAPTIVE-POD] \u{1F504} Starting sequential preload of
|
|
3823
|
+
`[ADAPTIVE-POD] \u{1F504} Starting sequential preload of remaining ads`
|
|
3806
3824
|
);
|
|
3807
3825
|
}
|
|
3808
3826
|
const processedUrls = /* @__PURE__ */ new Set();
|
|
3827
|
+
for (const url of this.adPodAllUrls) {
|
|
3828
|
+
if (((_b = (_a = this.ima).hasPreloadedAd) == null ? void 0 : _b.call(_a, url)) || this.fetchedAdDurations.has(url)) {
|
|
3829
|
+
processedUrls.add(url);
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
if (this.config.debugAdTiming && processedUrls.size > 0) {
|
|
3833
|
+
console.log(
|
|
3834
|
+
`[ADAPTIVE-POD] \u{1F4E6} Skipping ${processedUrls.size} already-preloaded ads`
|
|
3835
|
+
);
|
|
3836
|
+
}
|
|
3809
3837
|
while (true) {
|
|
3810
3838
|
const nextUrl = this.adPodAllUrls.find((url) => !processedUrls.has(url));
|
|
3811
3839
|
if (!nextUrl) {
|