@vindral/web-sdk 4.5.1-17-g1fb63dd0b → 4.5.1-19-g68d897ea1

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.
@@ -1,5 +1,5 @@
1
1
  import { n as e, t } from "./BsfwXDui.js";
2
- import { _ as n, a as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as ee, n as d, o as te, p as ne, r as re, s as ie, t as ae, u as oe, v as se } from "./CJN8L0VO.js";
2
+ import { _ as n, a as r, c as i, d as a, f as o, g as s, h as c, i as l, l as u, m as ee, n as d, o as te, p as ne, r as re, s as ie, t as ae, u as oe, v as se } from "./CMgsKIWh.js";
3
3
  import { P as ce } from "./CiWlpwR0.js";
4
4
  import { i as f, n as p, r as m, t as h } from "./DSw1XhvD.js";
5
5
  import { c as le, n as ue, t as de } from "./BOdyvABa.js";
@@ -3375,7 +3375,7 @@ var wo = (e) => {
3375
3375
  case "h264": return Go(n, r);
3376
3376
  case "h265": return qo(n, r, e.width, e.height);
3377
3377
  case "av1": return Ko(n, r);
3378
- case "opus": return Jo(n, r, e.channelCount || 2);
3378
+ case "opus": return Jo(n, r);
3379
3379
  case "aac": return Yo(n, r, e.channelCount || 2);
3380
3380
  default: throw Error(`Failed to initialize ${t} segment`);
3381
3381
  }
@@ -3387,7 +3387,10 @@ var wo = (e) => {
3387
3387
  }, Go = (e, t) => vo(e, t), Ko = (e, t) => Ho(e, t), qo = (e, t, n, r) => {
3388
3388
  if (!n || !r) throw Error("HEVC init segment requires width and height");
3389
3389
  return bo(e, t, n, r);
3390
- }, Jo = (e, t, n) => xo(new Uint8Array(e), n, t), Yo = (e, t, n) => ho(new Uint8Array(e), n, t, t), Xo = (e, t) => {
3390
+ }, Jo = (e, t) => {
3391
+ let n = new DataView(e).getUint8(9);
3392
+ return xo(new Uint8Array(e), n, t);
3393
+ }, Yo = (e, t, n) => ho(new Uint8Array(e), n, t, t), Xo = (e, t) => {
3391
3394
  if (!e[0]) throw Error("At least one sample must be provided");
3392
3395
  switch (e[0].codec) {
3393
3396
  case "h264": return _o(e, t);
@@ -8602,6 +8605,9 @@ var I_ = (e, t) => `${e}\u0000${t == null ? "" : t}`, L_ = (e, t, n, r) => e ===
8602
8605
  audioRenderer: "AudioContext",
8603
8606
  audioDecoder: this._audioWebCodecsInUse ? "WebCodecs" : "WASM"
8604
8607
  });
8608
+ }), e(this, "setVideoRenderingEnabled", (e) => {
8609
+ var t, n, r;
8610
+ this._offscreenCanvasInUse && ((t = this.trackContexts.get("video")) == null || (r = (n = t.decoderContext).setRenderingEnabled) == null || r.call(n, e));
8605
8611
  }), e(this, "setSubtitleCues", (e, t, n, r, i) => {
8606
8612
  var a;
8607
8613
  if (!this._offscreenCanvasInUse) return;
@@ -8744,7 +8750,7 @@ var I_ = (e, t) => `${e}\u0000${t == null ? "" : t}`, L_ = (e, t, n, r) => e ===
8744
8750
  break;
8745
8751
  }
8746
8752
  case "video": {
8747
- let { VideoDecoderWorkerContext: n } = yield import("./ir89G42i.js"), a = yield n.create(r.createContext("VideoDecoderWorker"), i, c, l, u, d, () => s.currentTime);
8753
+ let { VideoDecoderWorkerContext: n } = yield import("./DBL4St0f.js"), a = yield n.create(r.createContext("VideoDecoderWorker"), i, c, l, u, d, () => s.currentTime);
8748
8754
  p = a.isWebCodecs, h = a.usingOffscreenCanvas, t.set(e.type, {
8749
8755
  buffer: [],
8750
8756
  decoderContext: a,
@@ -11407,7 +11413,7 @@ var dy = class {
11407
11413
  }
11408
11414
  }
11409
11415
  else h instanceof xv && (h.setBackgroundPlaybackEnabled(i.isBackgroundPlayEnabled(i.channelId)), p === "OffscreenCanvas" && d ? (h.setOffscreenCanvas(d), i.offscreenCanvasElement = d) : (h.setOffscreenCanvas(void 0), i.offscreenCanvasElement = void 0));
11410
- (e = i.modules.decoder) == null || e.unload(), i.modules.decoder = f, i.isHiddenWithBackgroundPlayback() && i.modules.decoder.enableBackgroundTimers(), i.modules.decoder.load(), i.setupOffscreenSubtitleRouting();
11416
+ (e = i.modules.decoder) == null || e.unload(), i.modules.decoder = f, i.isHiddenWithBackgroundPlayback() && i.modules.decoder.enableBackgroundTimers(), i.modules.decoder.setVideoRenderingEnabled(i.isVideoOnScreen()), i.modules.decoder.load(), i.setupOffscreenSubtitleRouting();
11411
11417
  })), e(this, "setupOffscreenSubtitleRouting", () => {
11412
11418
  if (this.offscreenSubtitleInterval !== void 0 && (clearInterval(this.offscreenSubtitleInterval), this.offscreenSubtitleInterval = void 0), !this.offscreenCanvasElement || !this.modules.decoder || this.modules.canvasModule instanceof xv) return;
11413
11419
  let e = this.modules.decoder, t = this.modules.canvasModule;
@@ -11459,7 +11465,7 @@ var dy = class {
11459
11465
  }, n.BACKGROUND_INACTIVITY_DISCONNECT_TIMEOUT);
11460
11466
  }), e(this, "clearInactivityDisconnect", () => {
11461
11467
  this.inactivityDisconnectInterval !== void 0 && (this.modules.timer.clearInterval(this.inactivityDisconnectInterval), this.inactivityDisconnectInterval = void 0);
11462
- }), e(this, "isHiddenWithBackgroundPlayback", () => !this.modules.documentState.isVisible && this.shouldAllowBackgroundPlayback(this.channelId)), e(this, "isHiddenWithBackgroundPlayDisabled", () => !this.modules.documentState.isVisible && !this.isBackgroundPlayEnabled(this.channelId)), e(this, "resumeModules", () => {
11468
+ }), e(this, "isHiddenWithBackgroundPlayback", () => !this.modules.documentState.isVisible && this.shouldAllowBackgroundPlayback(this.channelId)), e(this, "isVideoOnScreen", (e = this.modules.documentState.isVisible) => e || this.modules.pictureInPicture.isPictureInPictureActive()), e(this, "isHiddenWithBackgroundPlayDisabled", () => !this.modules.documentState.isVisible && !this.isBackgroundPlayEnabled(this.channelId)), e(this, "resumeModules", () => {
11463
11469
  Object.values(this.modules).forEach((e) => {
11464
11470
  e && "unsuspend" in e && e.unsuspend();
11465
11471
  });
@@ -11467,7 +11473,7 @@ var dy = class {
11467
11473
  let e = this.modules.canvasModule instanceof xv ? !0 : void 0;
11468
11474
  return O({
11469
11475
  uptime: this.uptime,
11470
- version: "4.5.1-17-g1fb63dd0b",
11476
+ version: "4.5.1-19-g68d897ea1",
11471
11477
  clientId: this.clientId,
11472
11478
  sessionId: this.sessionId,
11473
11479
  channelId: this.channelId,
@@ -11610,11 +11616,18 @@ var dy = class {
11610
11616
  mseModule: oe,
11611
11617
  unpause: ce,
11612
11618
  canvasModule: T
11613
- }, this.modules.adaptivity.isEnabled = this.options.get("abrEnabled"), this.emitter.on("page active", (e) => {
11614
- if (e) this.clearInactivityDisconnect(), this.isUserPaused || (this.logger.debug("Unsuspending"), this.unsuspend());
11619
+ }, this.modules.adaptivity.isEnabled = this.options.get("abrEnabled"), this.emitter.on("enter picture in picture", () => {
11620
+ var e;
11621
+ return (e = this.modules.decoder) == null ? void 0 : e.setVideoRenderingEnabled(!0);
11622
+ }), this.emitter.on("exit picture in picture", () => {
11623
+ var e;
11624
+ return (e = this.modules.decoder) == null ? void 0 : e.setVideoRenderingEnabled(this.modules.documentState.isVisible);
11625
+ }), this.emitter.on("page active", (e) => {
11626
+ var t;
11627
+ if ((t = this.modules.decoder) == null || t.setVideoRenderingEnabled(this.isVideoOnScreen(e)), e) this.clearInactivityDisconnect(), this.isUserPaused || (this.logger.debug("Unsuspending"), this.unsuspend());
11615
11628
  else if (this.logger.debug("Suspending"), this.suspend(), this.shouldAllowBackgroundPlayback(this.channelId)) {
11616
- var t, n, r;
11617
- (t = this.modules.decoder) == null || t.enableBackgroundTimers(), this.modules.connection.unsuspend(), this.modules.sync.unsuspend(), (n = this.modules.decoder) == null || n.unsuspend(), (r = this.modules.canvasModule) == null || r.unsuspend(), this.scheduleInactivityDisconnect();
11629
+ var n, r, i;
11630
+ (n = this.modules.decoder) == null || n.enableBackgroundTimers(), this.modules.connection.unsuspend(), this.modules.sync.unsuspend(), (r = this.modules.decoder) == null || r.unsuspend(), (i = this.modules.canvasModule) == null || i.unsuspend(), this.scheduleInactivityDisconnect();
11618
11631
  } else this.disconnectForInactivePage(this.isUserPaused ? "Background playback paused" : "Background playback disabled");
11619
11632
  }), this.emitter.on("pageshow", (e) => {
11620
11633
  if (!e.persisted || this.isUserPaused) return;