@oddin-gg/havik-player 2.5.1 → 2.6.1

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
@@ -1691,11 +1691,9 @@ var lt = class {
1691
1691
  if (e && e(this.url, t)) return;
1692
1692
  }
1693
1693
  let n = this.opts.fetchFn ?? (typeof fetch < "u" ? fetch : void 0);
1694
- if (!n) return;
1695
- let r = { "content-type": "application/json" };
1696
- this.opts.apiKey && (r["x-api-key"] = this.opts.apiKey), n(this.url, {
1694
+ n && n(this.url, {
1697
1695
  method: "POST",
1698
- headers: r,
1696
+ headers: { "content-type": "application/json" },
1699
1697
  body: t,
1700
1698
  keepalive: !0
1701
1699
  }).catch(() => {});
@@ -1776,7 +1774,7 @@ async function mt() {
1776
1774
  }
1777
1775
  //#endregion
1778
1776
  //#region src/core/version.ts
1779
- var ht = "2.5.1", J = {
1777
+ var ht = "2.6.1", J = {
1780
1778
  accent: "#E1B600",
1781
1779
  accentText: "#1B1C23",
1782
1780
  background: "#0e0f13",
@@ -2369,39 +2367,38 @@ var Pt = class {
2369
2367
  a(), i.destroy();
2370
2368
  return;
2371
2369
  }
2372
- this.engine = i, this.detachMedia = a, this.opts.maxBitrate != null && i.setMaxBitrate(this.opts.maxBitrate), this.startStats(), this.scheduleLicenseRefresh(), this.startLiveState(t), this.startAnalytics(e, i, n.apiKey), r && (this.pendingStartLoad = !0, this.setState("paused"), i.name === "native" && setTimeout(() => {
2370
+ this.engine = i, this.detachMedia = a, this.opts.maxBitrate != null && i.setMaxBitrate(this.opts.maxBitrate), this.startStats(), this.scheduleLicenseRefresh(), this.startLiveState(t), this.startAnalytics(e, i), r && (this.pendingStartLoad = !0, this.setState("paused"), i.name === "native" && setTimeout(() => {
2373
2371
  this.destroyed || t !== this.loadGen || this.engine !== i || (this.analyticsSession?.noteReady(), this.emit("ready"));
2374
2372
  }, 0));
2375
2373
  }
2376
- startAnalytics(e, t, n) {
2374
+ startAnalytics(e, t) {
2377
2375
  if (this.analyticsSession?.noteDestroyed(), this.analyticsSession = null, this.detachMediaListeners?.(), this.opts.analytics === !1) return;
2378
- let r = e.analytics?.sid;
2376
+ let n = e.analytics?.sid;
2377
+ if (!n) return;
2378
+ let r = (typeof this.opts.analytics == "object" ? this.opts.analytics.endpoint : void 0) ?? ct(this.opts.baseUrl);
2379
2379
  if (!r) return;
2380
- let i = (typeof this.opts.analytics == "object" ? this.opts.analytics.endpoint : void 0) ?? ct(this.opts.baseUrl);
2381
- if (!i) return;
2382
- let a = this.opts.video, o = new lt({
2383
- endpoint: i,
2384
- sid: r,
2385
- apiKey: n,
2380
+ let i = this.opts.video, a = new lt({
2381
+ endpoint: r,
2382
+ sid: n,
2386
2383
  player: t.name === "native" ? "PLAYER_SAFARI_NATIVE" : "PLAYER_HLSJS",
2387
2384
  sdkVersion: ht,
2388
- environment: pt(a),
2385
+ environment: pt(i),
2389
2386
  sample: () => {
2390
- let e = this.engine?.getStats() ?? I, t = a.buffered.length ? Math.max(0, a.buffered.end(a.buffered.length - 1) - a.currentTime) : 0;
2387
+ let e = this.engine?.getStats() ?? I, t = i.buffered.length ? Math.max(0, i.buffered.end(i.buffered.length - 1) - i.currentTime) : 0;
2391
2388
  return {
2392
2389
  ...e,
2393
2390
  bufferedMs: Math.round(t * 1e3),
2394
2391
  state: this._state,
2395
- positionMs: Math.round(a.currentTime * 1e3),
2396
- playbackRate: a.playbackRate
2392
+ positionMs: Math.round(i.currentTime * 1e3),
2393
+ playbackRate: i.playbackRate
2397
2394
  };
2398
2395
  }
2399
2396
  });
2400
- this.analyticsSession = o;
2401
- let s = () => o.noteSeek(), c = () => o.noteVolume(a.muted, a.volume);
2402
- a.addEventListener("seeking", s), a.addEventListener("volumechange", c), this.detachMediaListeners = () => {
2403
- a.removeEventListener("seeking", s), a.removeEventListener("volumechange", c);
2404
- }, o.start(), o.seedVolume(a.muted, a.volume), o.notePresentation(this.currentPresentation()), mt().then((e) => o.noteEnvironment(e)), this.opts.autoplay === !1 && o.noteAutoplay("AUTOPLAY_RESULT_NOT_ATTEMPTED");
2397
+ this.analyticsSession = a;
2398
+ let o = () => a.noteSeek(), s = () => a.noteVolume(i.muted, i.volume);
2399
+ i.addEventListener("seeking", o), i.addEventListener("volumechange", s), this.detachMediaListeners = () => {
2400
+ i.removeEventListener("seeking", o), i.removeEventListener("volumechange", s);
2401
+ }, a.start(), a.seedVolume(i.muted, i.volume), a.notePresentation(this.currentPresentation()), mt().then((e) => a.noteEnvironment(e)), this.opts.autoplay === !1 && a.noteAutoplay("AUTOPLAY_RESULT_NOT_ATTEMPTED");
2405
2402
  }
2406
2403
  currentPresentation() {
2407
2404
  let e = this.opts.video;