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