@openplayerjs/ads 3.5.4 → 3.5.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/index.js CHANGED
@@ -3586,8 +3586,9 @@ class CsaiAdStrategy {
3586
3586
  return true;
3587
3587
  }
3588
3588
  catch (err) {
3589
- this.bus.emit('ads:error', err);
3590
- this.ctx.events.emit('ads.error', { err });
3589
+ const message = err instanceof Error ? err.message : String(err);
3590
+ this.bus.emit('ads:error', { message, error: err });
3591
+ this.ctx.events.emit('ads.error', { message, error: err });
3591
3592
  this.finish({
3592
3593
  resume: meta.kind !== 'postroll' && (this.userPlayIntent || this.resumeAfter),
3593
3594
  suppressResume: opts?.suppressResumeOnError,
@@ -3835,9 +3836,10 @@ class CsaiAdStrategy {
3835
3836
  if (shouldForceMute) {
3836
3837
  this.forcedMuteUntilInteraction = true;
3837
3838
  try {
3838
- if (v()) {
3839
- v().muted = true;
3840
- v().volume = 0;
3839
+ const el = v();
3840
+ if (el) {
3841
+ el.muted = true;
3842
+ el.volume = 0;
3841
3843
  }
3842
3844
  }
3843
3845
  catch {
@@ -3847,9 +3849,10 @@ class CsaiAdStrategy {
3847
3849
  else {
3848
3850
  this.forcedMuteUntilInteraction = false;
3849
3851
  try {
3850
- if (v()) {
3851
- v().muted = this.ctx.core.muted;
3852
- v().volume = this.ctx.core.volume;
3852
+ const el = v();
3853
+ if (el) {
3854
+ el.muted = this.ctx.core.muted;
3855
+ el.volume = this.ctx.core.volume;
3853
3856
  }
3854
3857
  }
3855
3858
  catch {
@@ -3865,19 +3868,21 @@ class CsaiAdStrategy {
3865
3868
  this.sessionUnsubs.push(events.on('cmd:pause', () => v()?.pause()));
3866
3869
  this.sessionUnsubs.push(events.on('cmd:setVolume', (x) => {
3867
3870
  const vol = Number(x);
3868
- if (!Number.isFinite(vol) || !v() || this.syncingVolume || this.forcedMuteUntilInteraction)
3871
+ const el = v();
3872
+ if (!Number.isFinite(vol) || !el || this.syncingVolume || this.forcedMuteUntilInteraction)
3869
3873
  return;
3870
- v().volume = vol;
3874
+ el.volume = vol;
3871
3875
  }));
3872
3876
  this.sessionUnsubs.push(events.on('cmd:setMuted', (x) => {
3873
- if (!v() || this.syncingVolume)
3877
+ const el = v();
3878
+ if (!el || this.syncingVolume)
3874
3879
  return;
3875
3880
  if (this.forcedMuteUntilInteraction && !this.ctx.core.userInteracted) {
3876
- v().muted = true;
3877
- v().volume = 0;
3881
+ el.muted = true;
3882
+ el.volume = 0;
3878
3883
  return;
3879
3884
  }
3880
- v().muted = Boolean(x);
3885
+ el.muted = Boolean(x);
3881
3886
  }));
3882
3887
  }
3883
3888
  // ─── Tracker & telemetry ──────────────────────────────────────────────────