stormcloud-video-player 0.3.3 → 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 +25 -11
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +25 -11
- package/lib/index.js.map +1 -1
- package/lib/player/StormcloudVideoPlayer.cjs +25 -11
- package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
- package/lib/players/HlsPlayer.cjs +25 -11
- package/lib/players/HlsPlayer.cjs.map +1 -1
- package/lib/players/index.cjs +25 -11
- package/lib/players/index.cjs.map +1 -1
- package/lib/ui/StormcloudVideoPlayer.cjs +25 -11
- package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
- package/package.json +1 -1
|
@@ -2432,10 +2432,12 @@ var StormcloudVideoPlayer = class {
|
|
|
2432
2432
|
this.handleAdPodComplete();
|
|
2433
2433
|
}
|
|
2434
2434
|
});
|
|
2435
|
-
this.ima.on("ad_error", () => {
|
|
2435
|
+
this.ima.on("ad_error", (errorPayload) => {
|
|
2436
2436
|
const remaining = this.getRemainingAdMs();
|
|
2437
|
-
console.
|
|
2438
|
-
`[DEBUG-POD] \u274C ad_error event | inBreak=${this.inAdBreak}, queue=${this.adPodQueue.length}, remaining=${remaining}ms
|
|
2437
|
+
console.error(
|
|
2438
|
+
`[DEBUG-POD] \u274C ad_error event | inBreak=${this.inAdBreak}, queue=${this.adPodQueue.length}, remaining=${remaining}ms`,
|
|
2439
|
+
errorPayload ? `
|
|
2440
|
+
Error details: ${JSON.stringify(errorPayload)}` : ""
|
|
2439
2441
|
);
|
|
2440
2442
|
if (this.inAdBreak) {
|
|
2441
2443
|
if (remaining > 500 && this.adPodQueue.length > 0) {
|
|
@@ -2462,7 +2464,7 @@ var StormcloudVideoPlayer = class {
|
|
|
2462
2464
|
}
|
|
2463
2465
|
});
|
|
2464
2466
|
this.ima.on("content_pause", () => {
|
|
2465
|
-
console.log(`[DEBUG-POD] \u{1F3AF} content_pause | ad ${this.currentAdIndex}/${this.totalAdsInBreak}, queue=${this.adPodQueue.length}`);
|
|
2467
|
+
console.log(`[DEBUG-POD] \u{1F3AF} content_pause (AD STARTING!) | ad ${this.currentAdIndex}/${this.totalAdsInBreak}, queue=${this.adPodQueue.length}`);
|
|
2466
2468
|
this.clearAdFailsafeTimer();
|
|
2467
2469
|
this.clearAdRequestWatchdog();
|
|
2468
2470
|
this.activeAdRequestToken = null;
|
|
@@ -3387,22 +3389,31 @@ var StormcloudVideoPlayer = class {
|
|
|
3387
3389
|
console.log(`[DEBUG-POD] \u{1F4DD} Request token=${requestToken}, preloaded=${wasPreloaded}`);
|
|
3388
3390
|
this.startAdRequestWatchdog(requestToken);
|
|
3389
3391
|
try {
|
|
3392
|
+
console.log(`[DEBUG-POD] \u{1F4E1} Calling ima.requestAds() for token=${requestToken}...`);
|
|
3390
3393
|
await this.ima.requestAds(vastTagUrl);
|
|
3394
|
+
console.log(`[DEBUG-POD] \u2705 ima.requestAds() completed successfully`);
|
|
3391
3395
|
this.clearAdRequestWatchdog();
|
|
3392
3396
|
if (this.activeAdRequestToken !== requestToken) {
|
|
3393
3397
|
console.warn(`[DEBUG-POD] \u26A0\uFE0F Token mismatch after requestAds (stale request)`);
|
|
3394
3398
|
return;
|
|
3395
3399
|
}
|
|
3400
|
+
console.log(`[DEBUG-POD] \u{1F4FA} Calling ima.play() to start ad playback...`);
|
|
3401
|
+
console.log(`[DEBUG-POD] \u{1F4CA} Video element state: paused=${this.video.paused}, muted=${this.video.muted}, readyState=${this.video.readyState}`);
|
|
3396
3402
|
try {
|
|
3397
3403
|
this.startAdFailsafeTimer(requestToken);
|
|
3398
3404
|
await this.ima.play();
|
|
3399
3405
|
if (this.activeAdRequestToken === requestToken) {
|
|
3400
|
-
console.log(`[DEBUG-POD] \u2705 Ad play initiated (token=${requestToken})`);
|
|
3406
|
+
console.log(`[DEBUG-POD] \u2705 Ad play initiated successfully (token=${requestToken})`);
|
|
3401
3407
|
} else {
|
|
3402
3408
|
console.warn(`[DEBUG-POD] \u26A0\uFE0F Token mismatch after play (stale request)`);
|
|
3403
3409
|
}
|
|
3404
3410
|
} catch (playError) {
|
|
3405
|
-
console.
|
|
3411
|
+
console.error(
|
|
3412
|
+
"[DEBUG-POD] \u274C Failed to play ad:",
|
|
3413
|
+
playError instanceof Error ? playError.message : playError,
|
|
3414
|
+
"\nFull error:",
|
|
3415
|
+
playError
|
|
3416
|
+
);
|
|
3406
3417
|
this.clearAdFailsafeTimer();
|
|
3407
3418
|
if (this.activeAdRequestToken === requestToken) {
|
|
3408
3419
|
this.activeAdRequestToken = null;
|
|
@@ -3698,21 +3709,24 @@ var StormcloudVideoPlayer = class {
|
|
|
3698
3709
|
for (const duration of this.fetchedAdDurations.values()) {
|
|
3699
3710
|
totalFetchedDurationMs += duration * 1e3;
|
|
3700
3711
|
}
|
|
3701
|
-
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;
|
|
3702
3718
|
if (remainingTimeMs <= 0) {
|
|
3703
3719
|
if (this.config.debugAdTiming) {
|
|
3704
3720
|
console.log(
|
|
3705
|
-
`[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`
|
|
3706
3722
|
);
|
|
3707
3723
|
}
|
|
3708
3724
|
return 0;
|
|
3709
3725
|
}
|
|
3710
|
-
const fetchedCount = this.fetchedAdDurations.size;
|
|
3711
|
-
const averageDurationMs = fetchedCount > 0 ? totalFetchedDurationMs / fetchedCount : 30 * 1e3;
|
|
3712
3726
|
const additionalAds = Math.ceil(remainingTimeMs / averageDurationMs);
|
|
3713
3727
|
if (this.config.debugAdTiming) {
|
|
3714
3728
|
console.log(
|
|
3715
|
-
`[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`
|
|
3716
3730
|
);
|
|
3717
3731
|
}
|
|
3718
3732
|
return additionalAds;
|