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