stormcloud-video-player 0.3.4 → 0.3.5
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 +8 -5
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +8 -5
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +8 -5
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +8 -5
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +8 -5
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +8 -5
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -3709,21 +3709,24 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3709
3709
|
for (const duration of this.fetchedAdDurations.values()) {
|
|
3710
3710
|
totalFetchedDurationMs += duration * 1e3;
|
|
3711
3711
|
}
|
|
3712
|
-
const
|
|
3712
|
+
const fetchedCount = this.fetchedAdDurations.size;
|
|
3713
|
+
const averageDurationMs = fetchedCount > 0 ? totalFetchedDurationMs / fetchedCount : 30 * 1e3;
|
|
3714
|
+
const queuedButNotFetched = this.adPodAllUrls.length - fetchedCount;
|
|
3715
|
+
const estimatedQueuedDurationMs = queuedButNotFetched * averageDurationMs;
|
|
3716
|
+
const estimatedTotalDurationMs = totalFetchedDurationMs + estimatedQueuedDurationMs;
|
|
3717
|
+
const remainingTimeMs = this.targetAdBreakDurationMs - estimatedTotalDurationMs;
|
|
3713
3718
|
if (remainingTimeMs <= 0) {
|
|
3714
3719
|
if (this.config.debugAdTiming) {
|
|
3715
3720
|
console.log(
|
|
3716
|
-
`[ADAPTIVE-POD] \u2705 Target duration
|
|
3721
|
+
`[ADAPTIVE-POD] \u2705 Target duration met: Fetched=${totalFetchedDurationMs}ms + Queued(${queuedButNotFetched} ads)=${estimatedQueuedDurationMs}ms = ${estimatedTotalDurationMs}ms / Target=${this.targetAdBreakDurationMs}ms`
|
|
3717
3722
|
);
|
|
3718
3723
|
}
|
|
3719
3724
|
return 0;
|
|
3720
3725
|
}
|
|
3721
|
-
const fetchedCount = this.fetchedAdDurations.size;
|
|
3722
|
-
const averageDurationMs = fetchedCount > 0 ? totalFetchedDurationMs / fetchedCount : 30 * 1e3;
|
|
3723
3726
|
const additionalAds = Math.ceil(remainingTimeMs / averageDurationMs);
|
|
3724
3727
|
if (this.config.debugAdTiming) {
|
|
3725
3728
|
console.log(
|
|
3726
|
-
`[ADAPTIVE-POD] \u{1F4CA} Need ${additionalAds} more ads | Fetched: ${totalFetchedDurationMs}ms
|
|
3729
|
+
`[ADAPTIVE-POD] \u{1F4CA} Need ${additionalAds} more ads | Fetched: ${totalFetchedDurationMs}ms (${fetchedCount} ads) | Queued: ${estimatedQueuedDurationMs}ms (${queuedButNotFetched} ads) | Target: ${this.targetAdBreakDurationMs}ms | Remaining: ${remainingTimeMs}ms | Avg duration: ${averageDurationMs}ms`
|
|
3727
3730
|
);
|
|
3728
3731
|
}
|
|
3729
3732
|
return additionalAds;
|