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/players/index.cjs
CHANGED
|
@@ -3751,21 +3751,24 @@ Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
|
3751
3751
|
for (const duration of this.fetchedAdDurations.values()) {
|
|
3752
3752
|
totalFetchedDurationMs += duration * 1e3;
|
|
3753
3753
|
}
|
|
3754
|
-
const
|
|
3754
|
+
const fetchedCount = this.fetchedAdDurations.size;
|
|
3755
|
+
const averageDurationMs = fetchedCount > 0 ? totalFetchedDurationMs / fetchedCount : 30 * 1e3;
|
|
3756
|
+
const queuedButNotFetched = this.adPodAllUrls.length - fetchedCount;
|
|
3757
|
+
const estimatedQueuedDurationMs = queuedButNotFetched * averageDurationMs;
|
|
3758
|
+
const estimatedTotalDurationMs = totalFetchedDurationMs + estimatedQueuedDurationMs;
|
|
3759
|
+
const remainingTimeMs = this.targetAdBreakDurationMs - estimatedTotalDurationMs;
|
|
3755
3760
|
if (remainingTimeMs <= 0) {
|
|
3756
3761
|
if (this.config.debugAdTiming) {
|
|
3757
3762
|
console.log(
|
|
3758
|
-
`[ADAPTIVE-POD] \u2705 Target duration
|
|
3763
|
+
`[ADAPTIVE-POD] \u2705 Target duration met: Fetched=${totalFetchedDurationMs}ms + Queued(${queuedButNotFetched} ads)=${estimatedQueuedDurationMs}ms = ${estimatedTotalDurationMs}ms / Target=${this.targetAdBreakDurationMs}ms`
|
|
3759
3764
|
);
|
|
3760
3765
|
}
|
|
3761
3766
|
return 0;
|
|
3762
3767
|
}
|
|
3763
|
-
const fetchedCount = this.fetchedAdDurations.size;
|
|
3764
|
-
const averageDurationMs = fetchedCount > 0 ? totalFetchedDurationMs / fetchedCount : 30 * 1e3;
|
|
3765
3768
|
const additionalAds = Math.ceil(remainingTimeMs / averageDurationMs);
|
|
3766
3769
|
if (this.config.debugAdTiming) {
|
|
3767
3770
|
console.log(
|
|
3768
|
-
`[ADAPTIVE-POD] \u{1F4CA} Need ${additionalAds} more ads | Fetched: ${totalFetchedDurationMs}ms
|
|
3771
|
+
`[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`
|
|
3769
3772
|
);
|
|
3770
3773
|
}
|
|
3771
3774
|
return additionalAds;
|