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