@oddin-gg/havik-player 2.6.0 → 2.6.2

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
@@ -1685,20 +1685,16 @@ var lt = class {
1685
1685
  }
1686
1686
  flush(e = !1) {
1687
1687
  if (this.firstFlushTimer &&= (clearTimeout(this.firstFlushTimer), null), this.pendingStart = null, this.pending.length === 0) return;
1688
- let t = { beacons: this.pending };
1689
- this.opts.apiKey && (t.apiKey = this.opts.apiKey);
1690
- let n = JSON.stringify(t);
1688
+ let t = JSON.stringify({ beacons: this.pending });
1691
1689
  if (this.pending = [], e) {
1692
1690
  let e = this.opts.sendBeacon ?? (typeof navigator < "u" && navigator.sendBeacon ? navigator.sendBeacon.bind(navigator) : void 0);
1693
- if (e && e(this.url, n)) return;
1691
+ if (e && e(this.url, t)) return;
1694
1692
  }
1695
- let r = this.opts.fetchFn ?? (typeof fetch < "u" ? fetch : void 0);
1696
- if (!r) return;
1697
- let i = { "content-type": "application/json" };
1698
- this.opts.apiKey && (i["x-api-key"] = this.opts.apiKey), r(this.url, {
1693
+ let n = this.opts.fetchFn ?? (typeof fetch < "u" ? fetch : void 0);
1694
+ n && n(this.url, {
1699
1695
  method: "POST",
1700
- headers: i,
1701
- body: n,
1696
+ headers: { "content-type": "application/json" },
1697
+ body: t,
1702
1698
  keepalive: !0
1703
1699
  }).catch(() => {});
1704
1700
  }
@@ -1778,7 +1774,7 @@ async function mt() {
1778
1774
  }
1779
1775
  //#endregion
1780
1776
  //#region src/core/version.ts
1781
- var ht = "2.6.0", J = {
1777
+ var ht = "2.6.2", J = {
1782
1778
  accent: "#E1B600",
1783
1779
  accentText: "#1B1C23",
1784
1780
  background: "#0e0f13",
@@ -2371,39 +2367,38 @@ var Pt = class {
2371
2367
  a(), i.destroy();
2372
2368
  return;
2373
2369
  }
2374
- 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(() => {
2375
2371
  this.destroyed || t !== this.loadGen || this.engine !== i || (this.analyticsSession?.noteReady(), this.emit("ready"));
2376
2372
  }, 0));
2377
2373
  }
2378
- startAnalytics(e, t, n) {
2374
+ startAnalytics(e, t) {
2379
2375
  if (this.analyticsSession?.noteDestroyed(), this.analyticsSession = null, this.detachMediaListeners?.(), this.opts.analytics === !1) return;
2380
- 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);
2381
2379
  if (!r) return;
2382
- let i = (typeof this.opts.analytics == "object" ? this.opts.analytics.endpoint : void 0) ?? ct(this.opts.baseUrl);
2383
- if (!i) return;
2384
- let a = this.opts.video, o = new lt({
2385
- endpoint: i,
2386
- sid: r,
2387
- apiKey: n,
2380
+ let i = this.opts.video, a = new lt({
2381
+ endpoint: r,
2382
+ sid: n,
2388
2383
  player: t.name === "native" ? "PLAYER_SAFARI_NATIVE" : "PLAYER_HLSJS",
2389
2384
  sdkVersion: ht,
2390
- environment: pt(a),
2385
+ environment: pt(i),
2391
2386
  sample: () => {
2392
- 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;
2393
2388
  return {
2394
2389
  ...e,
2395
2390
  bufferedMs: Math.round(t * 1e3),
2396
2391
  state: this._state,
2397
- positionMs: Math.round(a.currentTime * 1e3),
2398
- playbackRate: a.playbackRate
2392
+ positionMs: Math.round(i.currentTime * 1e3),
2393
+ playbackRate: i.playbackRate
2399
2394
  };
2400
2395
  }
2401
2396
  });
2402
- this.analyticsSession = o;
2403
- let s = () => o.noteSeek(), c = () => o.noteVolume(a.muted, a.volume);
2404
- a.addEventListener("seeking", s), a.addEventListener("volumechange", c), this.detachMediaListeners = () => {
2405
- a.removeEventListener("seeking", s), a.removeEventListener("volumechange", c);
2406
- }, 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");
2407
2402
  }
2408
2403
  currentPresentation() {
2409
2404
  let e = this.opts.video;