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.cjs
CHANGED
|
@@ -3776,21 +3776,24 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3776
3776
|
for (const duration of this.fetchedAdDurations.values()) {
|
|
3777
3777
|
totalFetchedDurationMs += duration * 1e3;
|
|
3778
3778
|
}
|
|
3779
|
-
const
|
|
3779
|
+
const fetchedCount = this.fetchedAdDurations.size;
|
|
3780
|
+
const averageDurationMs = fetchedCount > 0 ? totalFetchedDurationMs / fetchedCount : 30 * 1e3;
|
|
3781
|
+
const queuedButNotFetched = this.adPodAllUrls.length - fetchedCount;
|
|
3782
|
+
const estimatedQueuedDurationMs = queuedButNotFetched * averageDurationMs;
|
|
3783
|
+
const estimatedTotalDurationMs = totalFetchedDurationMs + estimatedQueuedDurationMs;
|
|
3784
|
+
const remainingTimeMs = this.targetAdBreakDurationMs - estimatedTotalDurationMs;
|
|
3780
3785
|
if (remainingTimeMs <= 0) {
|
|
3781
3786
|
if (this.config.debugAdTiming) {
|
|
3782
3787
|
console.log(
|
|
3783
|
-
`[ADAPTIVE-POD] \u2705 Target duration
|
|
3788
|
+
`[ADAPTIVE-POD] \u2705 Target duration met: Fetched=${totalFetchedDurationMs}ms + Queued(${queuedButNotFetched} ads)=${estimatedQueuedDurationMs}ms = ${estimatedTotalDurationMs}ms / Target=${this.targetAdBreakDurationMs}ms`
|
|
3784
3789
|
);
|
|
3785
3790
|
}
|
|
3786
3791
|
return 0;
|
|
3787
3792
|
}
|
|
3788
|
-
const fetchedCount = this.fetchedAdDurations.size;
|
|
3789
|
-
const averageDurationMs = fetchedCount > 0 ? totalFetchedDurationMs / fetchedCount : 30 * 1e3;
|
|
3790
3793
|
const additionalAds = Math.ceil(remainingTimeMs / averageDurationMs);
|
|
3791
3794
|
if (this.config.debugAdTiming) {
|
|
3792
3795
|
console.log(
|
|
3793
|
-
`[ADAPTIVE-POD] \u{1F4CA} Need ${additionalAds} more ads | Fetched: ${totalFetchedDurationMs}ms
|
|
3796
|
+
`[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`
|
|
3794
3797
|
);
|
|
3795
3798
|
}
|
|
3796
3799
|
return additionalAds;
|