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