stormcloud-video-player 0.3.0 → 0.3.1
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 +60 -30
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +60 -30
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +60 -30
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +60 -30
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +60 -30
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +60 -30
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -3213,7 +3213,8 @@ var StormcloudVideoPlayer = class {
|
|
|
3213
3213
|
console.log("[DEBUG-POD] \u26A0\uFE0F No ads in pod");
|
|
3214
3214
|
return;
|
|
3215
3215
|
}
|
|
3216
|
-
|
|
3216
|
+
const waitTime = this.isAdaptiveMode ? 1500 : 500;
|
|
3217
|
+
await new Promise((resolve) => setTimeout(resolve, waitTime));
|
|
3217
3218
|
const firstPreloaded = this.findNextPreloadedAd();
|
|
3218
3219
|
if (!firstPreloaded) {
|
|
3219
3220
|
console.log("[DEBUG-POD] \u26A0\uFE0F No preloaded ads after wait, trying first ad");
|
|
@@ -3658,22 +3659,12 @@ var StormcloudVideoPlayer = class {
|
|
|
3658
3659
|
);
|
|
3659
3660
|
if (this.config.debugAdTiming) {
|
|
3660
3661
|
console.log(
|
|
3661
|
-
`[ADAPTIVE-POD] \u{1F504} Adding ${newUrls.length} additional VAST URLs to queue`
|
|
3662
|
+
`[ADAPTIVE-POD] \u{1F504} Adding ${newUrls.length} additional VAST URLs to queue (will be preloaded sequentially)`
|
|
3662
3663
|
);
|
|
3663
3664
|
}
|
|
3664
3665
|
this.adPodAllUrls.push(...newUrls);
|
|
3665
3666
|
this.adPodQueue.push(...newUrls);
|
|
3666
3667
|
this.totalAdsInBreak += newUrls.length;
|
|
3667
|
-
for (const url of newUrls) {
|
|
3668
|
-
this.preloadSingleAd(url).catch((error) => {
|
|
3669
|
-
if (this.config.debugAdTiming) {
|
|
3670
|
-
console.warn(
|
|
3671
|
-
`[ADAPTIVE-POD] Failed to preload adaptive ad:`,
|
|
3672
|
-
error
|
|
3673
|
-
);
|
|
3674
|
-
}
|
|
3675
|
-
});
|
|
3676
|
-
}
|
|
3677
3668
|
}
|
|
3678
3669
|
async preloadMediaFile(mediaUrl) {
|
|
3679
3670
|
if (this.preloadedMediaUrls.has(mediaUrl)) {
|
|
@@ -3719,26 +3710,65 @@ var StormcloudVideoPlayer = class {
|
|
|
3719
3710
|
if (this.adPodAllUrls.length === 0) {
|
|
3720
3711
|
return;
|
|
3721
3712
|
}
|
|
3722
|
-
if (this.
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
);
|
|
3713
|
+
if (this.isAdaptiveMode) {
|
|
3714
|
+
if (this.config.debugAdTiming) {
|
|
3715
|
+
console.log(
|
|
3716
|
+
`[ADAPTIVE-POD] Starting sequential preload of ${this.adPodAllUrls.length} initial ads`
|
|
3717
|
+
);
|
|
3718
|
+
}
|
|
3719
|
+
const processedUrls = /* @__PURE__ */ new Set();
|
|
3720
|
+
while (true) {
|
|
3721
|
+
const nextUrl = this.adPodAllUrls.find((url) => !processedUrls.has(url));
|
|
3722
|
+
if (!nextUrl) {
|
|
3723
|
+
break;
|
|
3734
3724
|
}
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3725
|
+
processedUrls.add(nextUrl);
|
|
3726
|
+
try {
|
|
3727
|
+
await this.preloadSingleAd(nextUrl);
|
|
3728
|
+
} catch (error) {
|
|
3729
|
+
if (this.config.debugAdTiming) {
|
|
3730
|
+
console.warn(
|
|
3731
|
+
`[ADAPTIVE-POD] Preload failed for ${nextUrl}:`,
|
|
3732
|
+
error
|
|
3733
|
+
);
|
|
3734
|
+
}
|
|
3735
|
+
}
|
|
3736
|
+
if (this.calculateAdditionalAdsNeeded() === 0) {
|
|
3737
|
+
if (this.config.debugAdTiming) {
|
|
3738
|
+
console.log(
|
|
3739
|
+
`[ADAPTIVE-POD] \u2705 Target duration reached, stopping preload`
|
|
3740
|
+
);
|
|
3741
|
+
}
|
|
3742
|
+
break;
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3745
|
+
if (this.config.debugAdTiming) {
|
|
3746
|
+
console.log(
|
|
3747
|
+
`[ADAPTIVE-POD] Sequential preloading completed (${processedUrls.size} ads preloaded)`
|
|
3748
|
+
);
|
|
3749
|
+
}
|
|
3750
|
+
} else {
|
|
3751
|
+
if (this.config.debugAdTiming) {
|
|
3752
|
+
console.log(
|
|
3753
|
+
`[StormcloudVideoPlayer] Starting parallel preload of ${this.adPodAllUrls.length} ads`
|
|
3754
|
+
);
|
|
3755
|
+
}
|
|
3756
|
+
const preloadPromises = this.adPodAllUrls.map(
|
|
3757
|
+
(vastTagUrl) => this.preloadSingleAd(vastTagUrl).catch((error) => {
|
|
3758
|
+
if (this.config.debugAdTiming) {
|
|
3759
|
+
console.warn(
|
|
3760
|
+
`[StormcloudVideoPlayer] Preload failed for ${vastTagUrl}:`,
|
|
3761
|
+
error
|
|
3762
|
+
);
|
|
3763
|
+
}
|
|
3764
|
+
})
|
|
3741
3765
|
);
|
|
3766
|
+
await Promise.all(preloadPromises);
|
|
3767
|
+
if (this.config.debugAdTiming) {
|
|
3768
|
+
console.log(
|
|
3769
|
+
`[StormcloudVideoPlayer] Background preloading completed for all ads`
|
|
3770
|
+
);
|
|
3771
|
+
}
|
|
3742
3772
|
}
|
|
3743
3773
|
}
|
|
3744
3774
|
async preloadSingleAd(vastTagUrl) {
|