stormcloud-video-player 0.2.34 → 0.2.35

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/lib/index.cjs CHANGED
@@ -738,7 +738,7 @@ function createImaController(video, options) {
738
738
  console.log("[DEBUG-FLOW] \u23F8\uFE0F CONTENT_RESUME - Single ad done");
739
739
  adPlaying = false;
740
740
  setAdPlayingFlag(false);
741
- console.log("[DEBUG-LAYER] \u26A0\uFE0F Waiting for pod manager decision (more ads or done)");
741
+ console.log("[DEBUG-LAYER] \u26A0\uFE0F Waiting for pod manager (more ads, placeholder, or done)");
742
742
  emit("content_resume");
743
743
  }
744
744
  );
@@ -2506,44 +2506,31 @@ var StormcloudVideoPlayer = class {
2506
2506
  }
2507
2507
  });
2508
2508
  this.ima.on("ad_error", () => {
2509
- if (this.config.debugAdTiming) {
2510
- console.log("[StormcloudVideoPlayer] IMA ad_error event received", {
2511
- showAds: this.showAds,
2512
- inAdBreak: this.inAdBreak,
2513
- remainingAds: this.adPodQueue.length
2514
- });
2515
- }
2509
+ const remaining = this.getRemainingAdMs();
2510
+ console.log(
2511
+ `[DEBUG-POD] \u274C ad_error event | inBreak=${this.inAdBreak}, queue=${this.adPodQueue.length}, remaining=${remaining}ms`
2512
+ );
2516
2513
  if (this.inAdBreak) {
2517
- const remaining = this.getRemainingAdMs();
2518
2514
  if (remaining > 500 && this.adPodQueue.length > 0) {
2519
2515
  const nextPreloaded = this.findNextPreloadedAd();
2520
2516
  if (nextPreloaded) {
2521
2517
  this.currentAdIndex++;
2522
- if (this.config.debugAdTiming) {
2523
- console.log(
2524
- `[StormcloudVideoPlayer] Skipping to next preloaded ad after error`
2525
- );
2526
- }
2518
+ console.log(
2519
+ `[DEBUG-POD] \u27A1\uFE0F Trying next ad after error (${this.currentAdIndex}/${this.totalAdsInBreak})`
2520
+ );
2527
2521
  this.playSingleAd(nextPreloaded).catch(() => {
2528
2522
  this.handleAdFailure();
2529
2523
  });
2530
2524
  } else {
2531
- if (this.config.debugAdTiming) {
2532
- console.log(
2533
- "[StormcloudVideoPlayer] No preloaded ads available, ending ad break"
2534
- );
2535
- }
2525
+ console.log("[DEBUG-POD] \u26A0\uFE0F No more preloaded ads - calling handleAdFailure");
2536
2526
  this.handleAdFailure();
2537
2527
  }
2538
2528
  } else {
2529
+ console.log("[DEBUG-POD] \u26A0\uFE0F No more ads or time - calling handleAdFailure");
2539
2530
  this.handleAdFailure();
2540
2531
  }
2541
2532
  } else {
2542
- if (this.config.debugAdTiming) {
2543
- console.log(
2544
- "[StormcloudVideoPlayer] Ad error before ad break established - cleaning up"
2545
- );
2546
- }
2533
+ console.log("[DEBUG-POD] \u26A0\uFE0F Error before ad break established");
2547
2534
  this.handleAdFailure();
2548
2535
  }
2549
2536
  });
@@ -3294,31 +3281,15 @@ var StormcloudVideoPlayer = class {
3294
3281
  const overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
3295
3282
  const shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
3296
3283
  if (shouldExtendAdBreak) {
3297
- if (this.config.debugAdTiming) {
3298
- console.log(
3299
- "[StormcloudVideoPlayer] Extending ad break beyond scheduled duration",
3300
- {
3301
- adPlaying,
3302
- pendingAds,
3303
- showAds: this.showAds,
3304
- overrunMs,
3305
- checkIntervalMs,
3306
- maxExtensionMs
3307
- }
3308
- );
3309
- }
3284
+ console.log(
3285
+ `[DEBUG-POD] \u23F3 Extending ad break | elapsed=${elapsedSinceStartMs}ms, expected=${expectedDurationMs}ms, overrun=${overrunMs}ms`
3286
+ );
3310
3287
  this.scheduleAdStopCountdown(checkIntervalMs);
3311
3288
  return;
3312
3289
  }
3313
- if (this.config.debugAdTiming) {
3314
- console.log("[StormcloudVideoPlayer] Ending ad break via timer", {
3315
- adPlaying,
3316
- pendingAds,
3317
- showAds: this.showAds,
3318
- overrunMs,
3319
- maxExtensionMs
3320
- });
3321
- }
3290
+ console.log(
3291
+ `[DEBUG-POD] \u23F1\uFE0F Ad break duration expired | elapsed=${elapsedSinceStartMs}ms, expected=${expectedDurationMs}ms`
3292
+ );
3322
3293
  if (adPlaying) {
3323
3294
  this.ima.stop().catch(() => {
3324
3295
  });
@@ -3433,9 +3404,20 @@ var StormcloudVideoPlayer = class {
3433
3404
  }
3434
3405
  }
3435
3406
  handleAdFailure() {
3407
+ const remaining = this.getRemainingAdMs();
3436
3408
  console.log(
3437
- `[DEBUG-POD] \u274C handleAdFailure | inBreak=${this.inAdBreak}, showAds=${this.showAds}, paused=${this.video.paused}`
3409
+ `[DEBUG-POD] \u274C handleAdFailure | inBreak=${this.inAdBreak}, showAds=${this.showAds}, remaining=${remaining}ms`
3438
3410
  );
3411
+ if (remaining > 500 && this.inAdBreak) {
3412
+ console.log(
3413
+ `[DEBUG-POD] \u23F3 Ad failed but ${remaining}ms remaining - showing placeholder until duration expires`
3414
+ );
3415
+ this.showAds = true;
3416
+ this.ima.showPlaceholder();
3417
+ this.enforceAdHoldState();
3418
+ return;
3419
+ }
3420
+ console.log("[DEBUG-POD] \u23F9\uFE0F No remaining time - ending ad break now");
3439
3421
  this.handleAdPodComplete();
3440
3422
  }
3441
3423
  startAdRequestWatchdog(token) {