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.
@@ -671,7 +671,7 @@ function createImaController(video, options) {
671
671
  console.log("[DEBUG-FLOW] \u23F8\uFE0F CONTENT_RESUME - Single ad done");
672
672
  adPlaying = false;
673
673
  setAdPlayingFlag(false);
674
- console.log("[DEBUG-LAYER] \u26A0\uFE0F Waiting for pod manager decision (more ads or done)");
674
+ console.log("[DEBUG-LAYER] \u26A0\uFE0F Waiting for pod manager (more ads, placeholder, or done)");
675
675
  emit("content_resume");
676
676
  }
677
677
  );
@@ -2439,44 +2439,31 @@ var StormcloudVideoPlayer = class {
2439
2439
  }
2440
2440
  });
2441
2441
  this.ima.on("ad_error", () => {
2442
- if (this.config.debugAdTiming) {
2443
- console.log("[StormcloudVideoPlayer] IMA ad_error event received", {
2444
- showAds: this.showAds,
2445
- inAdBreak: this.inAdBreak,
2446
- remainingAds: this.adPodQueue.length
2447
- });
2448
- }
2442
+ const remaining = this.getRemainingAdMs();
2443
+ console.log(
2444
+ `[DEBUG-POD] \u274C ad_error event | inBreak=${this.inAdBreak}, queue=${this.adPodQueue.length}, remaining=${remaining}ms`
2445
+ );
2449
2446
  if (this.inAdBreak) {
2450
- const remaining = this.getRemainingAdMs();
2451
2447
  if (remaining > 500 && this.adPodQueue.length > 0) {
2452
2448
  const nextPreloaded = this.findNextPreloadedAd();
2453
2449
  if (nextPreloaded) {
2454
2450
  this.currentAdIndex++;
2455
- if (this.config.debugAdTiming) {
2456
- console.log(
2457
- `[StormcloudVideoPlayer] Skipping to next preloaded ad after error`
2458
- );
2459
- }
2451
+ console.log(
2452
+ `[DEBUG-POD] \u27A1\uFE0F Trying next ad after error (${this.currentAdIndex}/${this.totalAdsInBreak})`
2453
+ );
2460
2454
  this.playSingleAd(nextPreloaded).catch(() => {
2461
2455
  this.handleAdFailure();
2462
2456
  });
2463
2457
  } else {
2464
- if (this.config.debugAdTiming) {
2465
- console.log(
2466
- "[StormcloudVideoPlayer] No preloaded ads available, ending ad break"
2467
- );
2468
- }
2458
+ console.log("[DEBUG-POD] \u26A0\uFE0F No more preloaded ads - calling handleAdFailure");
2469
2459
  this.handleAdFailure();
2470
2460
  }
2471
2461
  } else {
2462
+ console.log("[DEBUG-POD] \u26A0\uFE0F No more ads or time - calling handleAdFailure");
2472
2463
  this.handleAdFailure();
2473
2464
  }
2474
2465
  } else {
2475
- if (this.config.debugAdTiming) {
2476
- console.log(
2477
- "[StormcloudVideoPlayer] Ad error before ad break established - cleaning up"
2478
- );
2479
- }
2466
+ console.log("[DEBUG-POD] \u26A0\uFE0F Error before ad break established");
2480
2467
  this.handleAdFailure();
2481
2468
  }
2482
2469
  });
@@ -3227,31 +3214,15 @@ var StormcloudVideoPlayer = class {
3227
3214
  const overrunMs = Math.max(0, elapsedSinceStartMs - expectedDurationMs);
3228
3215
  const shouldExtendAdBreak = (adPlaying || pendingAds || this.showAds) && overrunMs < maxExtensionMs;
3229
3216
  if (shouldExtendAdBreak) {
3230
- if (this.config.debugAdTiming) {
3231
- console.log(
3232
- "[StormcloudVideoPlayer] Extending ad break beyond scheduled duration",
3233
- {
3234
- adPlaying,
3235
- pendingAds,
3236
- showAds: this.showAds,
3237
- overrunMs,
3238
- checkIntervalMs,
3239
- maxExtensionMs
3240
- }
3241
- );
3242
- }
3217
+ console.log(
3218
+ `[DEBUG-POD] \u23F3 Extending ad break | elapsed=${elapsedSinceStartMs}ms, expected=${expectedDurationMs}ms, overrun=${overrunMs}ms`
3219
+ );
3243
3220
  this.scheduleAdStopCountdown(checkIntervalMs);
3244
3221
  return;
3245
3222
  }
3246
- if (this.config.debugAdTiming) {
3247
- console.log("[StormcloudVideoPlayer] Ending ad break via timer", {
3248
- adPlaying,
3249
- pendingAds,
3250
- showAds: this.showAds,
3251
- overrunMs,
3252
- maxExtensionMs
3253
- });
3254
- }
3223
+ console.log(
3224
+ `[DEBUG-POD] \u23F1\uFE0F Ad break duration expired | elapsed=${elapsedSinceStartMs}ms, expected=${expectedDurationMs}ms`
3225
+ );
3255
3226
  if (adPlaying) {
3256
3227
  this.ima.stop().catch(() => {
3257
3228
  });
@@ -3366,9 +3337,20 @@ var StormcloudVideoPlayer = class {
3366
3337
  }
3367
3338
  }
3368
3339
  handleAdFailure() {
3340
+ const remaining = this.getRemainingAdMs();
3369
3341
  console.log(
3370
- `[DEBUG-POD] \u274C handleAdFailure | inBreak=${this.inAdBreak}, showAds=${this.showAds}, paused=${this.video.paused}`
3342
+ `[DEBUG-POD] \u274C handleAdFailure | inBreak=${this.inAdBreak}, showAds=${this.showAds}, remaining=${remaining}ms`
3371
3343
  );
3344
+ if (remaining > 500 && this.inAdBreak) {
3345
+ console.log(
3346
+ `[DEBUG-POD] \u23F3 Ad failed but ${remaining}ms remaining - showing placeholder until duration expires`
3347
+ );
3348
+ this.showAds = true;
3349
+ this.ima.showPlaceholder();
3350
+ this.enforceAdHoldState();
3351
+ return;
3352
+ }
3353
+ console.log("[DEBUG-POD] \u23F9\uFE0F No remaining time - ending ad break now");
3372
3354
  this.handleAdPodComplete();
3373
3355
  }
3374
3356
  startAdRequestWatchdog(token) {