@oddin-gg/havik-player 2.8.0 → 2.9.0

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.d.cts CHANGED
@@ -373,6 +373,23 @@ export declare interface EmbedConfig {
373
373
  autoplay?: boolean;
374
374
  muted?: boolean;
375
375
  waitForLive?: WaitForLive;
376
+ /**
377
+ * QoE beacons, forwarded verbatim to {@link createPlayer}. Same meaning as
378
+ * there: `false` opts out, `{ endpoint }` names a beacons host.
379
+ *
380
+ * Mode C needs this for the same reason Mode A does, and until now had no
381
+ * way to say it. An embed whose `baseUrl` is not a `feed[-dev].<domain>`
382
+ * host — a CDN or gateway fronting the streams API — derives no beacons
383
+ * endpoint, so analytics is off and stays off. Without this option the
384
+ * only remedy was to move `baseUrl` back onto a feed host, which is not a
385
+ * choice an integrator who fronts the API deliberately can make.
386
+ *
387
+ * INJECTED CONFIG ONLY: unlike every other field here, this is not read
388
+ * from the query string. See {@link readConfig}.
389
+ */
390
+ analytics?: boolean | {
391
+ endpoint?: string;
392
+ };
376
393
  }
377
394
 
378
395
  export declare interface EmbedHandle {
@@ -673,6 +690,18 @@ export declare interface MountEmbedOptions {
673
690
  container: HTMLElement;
674
691
  /** URL of the hosted embed page, e.g. `https://player-dev.oddin-video.gg/embed/`. */
675
692
  src: string;
693
+ /**
694
+ * API base URL, forwarded to the embed page as a query parameter.
695
+ *
696
+ * ⚠️ QoE beacons: the beacons endpoint is derived from this host by
697
+ * convention (`feed[-dev].<domain>` → `beacons[-dev].<domain>`). If your
698
+ * base is NOT a feed host, nothing derives and analytics is off — and
699
+ * `mountEmbed` CANNOT fix it, because the only way to name an endpoint is
700
+ * {@link EmbedConfig.analytics}, which the embed page reads from injected
701
+ * config and deliberately never from the query string (a link must not be
702
+ * able to redirect a session's telemetry). Host the embed page yourself
703
+ * and inject `window.HAVIK_EMBED_CONFIG` with `analytics: { endpoint }`.
704
+ */
676
705
  baseUrl: string;
677
706
  matchUrn: string;
678
707
  /**
package/dist/index.d.ts CHANGED
@@ -373,6 +373,23 @@ export declare interface EmbedConfig {
373
373
  autoplay?: boolean;
374
374
  muted?: boolean;
375
375
  waitForLive?: WaitForLive;
376
+ /**
377
+ * QoE beacons, forwarded verbatim to {@link createPlayer}. Same meaning as
378
+ * there: `false` opts out, `{ endpoint }` names a beacons host.
379
+ *
380
+ * Mode C needs this for the same reason Mode A does, and until now had no
381
+ * way to say it. An embed whose `baseUrl` is not a `feed[-dev].<domain>`
382
+ * host — a CDN or gateway fronting the streams API — derives no beacons
383
+ * endpoint, so analytics is off and stays off. Without this option the
384
+ * only remedy was to move `baseUrl` back onto a feed host, which is not a
385
+ * choice an integrator who fronts the API deliberately can make.
386
+ *
387
+ * INJECTED CONFIG ONLY: unlike every other field here, this is not read
388
+ * from the query string. See {@link readConfig}.
389
+ */
390
+ analytics?: boolean | {
391
+ endpoint?: string;
392
+ };
376
393
  }
377
394
 
378
395
  export declare interface EmbedHandle {
@@ -673,6 +690,18 @@ export declare interface MountEmbedOptions {
673
690
  container: HTMLElement;
674
691
  /** URL of the hosted embed page, e.g. `https://player-dev.oddin-video.gg/embed/`. */
675
692
  src: string;
693
+ /**
694
+ * API base URL, forwarded to the embed page as a query parameter.
695
+ *
696
+ * ⚠️ QoE beacons: the beacons endpoint is derived from this host by
697
+ * convention (`feed[-dev].<domain>` → `beacons[-dev].<domain>`). If your
698
+ * base is NOT a feed host, nothing derives and analytics is off — and
699
+ * `mountEmbed` CANNOT fix it, because the only way to name an endpoint is
700
+ * {@link EmbedConfig.analytics}, which the embed page reads from injected
701
+ * config and deliberately never from the query string (a link must not be
702
+ * able to redirect a session's telemetry). Host the embed page yourself
703
+ * and inject `window.HAVIK_EMBED_CONFIG` with `analytics: { endpoint }`.
704
+ */
676
705
  baseUrl: string;
677
706
  matchUrn: string;
678
707
  /**
package/dist/index.js CHANGED
@@ -1856,7 +1856,7 @@ async function vt() {
1856
1856
  }
1857
1857
  //#endregion
1858
1858
  //#region src/core/version.ts
1859
- var yt = "2.8.0", bt = {
1859
+ var yt = "2.9.0", bt = {
1860
1860
  accent: "#E1B600",
1861
1861
  accentText: "#1B1C23",
1862
1862
  background: "#0e0f13",
@@ -2869,7 +2869,14 @@ function Ht(e) {
2869
2869
  //#endregion
2870
2870
  //#region src/embed/page.ts
2871
2871
  var Ut = /^[A-Za-z0-9:_.-]{1,128}$/;
2872
- function Wt() {
2872
+ function Wt(e) {
2873
+ if (typeof e == "boolean") return e;
2874
+ if (typeof e == "object" && e) {
2875
+ let t = e.endpoint;
2876
+ return typeof t == "string" ? { endpoint: t } : {};
2877
+ }
2878
+ }
2879
+ function Gt() {
2873
2880
  let e = window.HAVIK_EMBED_CONFIG;
2874
2881
  if (e) return {
2875
2882
  baseUrl: e.baseUrl ?? "",
@@ -2878,7 +2885,8 @@ function Wt() {
2878
2885
  parentOrigin: e.parentOrigin,
2879
2886
  autoplay: e.autoplay ?? !0,
2880
2887
  muted: e.muted ?? !0,
2881
- waitForLive: e.waitForLive ?? !0
2888
+ waitForLive: e.waitForLive ?? !0,
2889
+ analytics: Wt(e.analytics)
2882
2890
  };
2883
2891
  let t = new URLSearchParams(location.search);
2884
2892
  return {
@@ -2891,9 +2899,9 @@ function Wt() {
2891
2899
  waitForLive: !0
2892
2900
  };
2893
2901
  }
2894
- async function Gt() {
2895
- let e = Wt();
2896
- qt();
2902
+ async function Kt() {
2903
+ let e = Gt();
2904
+ Jt();
2897
2905
  let t = document.createElement("video");
2898
2906
  t.setAttribute("playsinline", ""), t.muted = e.muted ?? !0, t.style.cssText = "width:100%;height:100%;object-fit:contain;background:#000;aspect-ratio:auto", document.body.appendChild(t);
2899
2907
  let r = e.parentOrigin && e.parentOrigin !== "null" ? e.parentOrigin : null;
@@ -2948,7 +2956,7 @@ async function Gt() {
2948
2956
  code: e.code,
2949
2957
  message: e.message
2950
2958
  })), e.on("autoplayblocked", () => {
2951
- i({ type: "oddin:autoplayblocked" }), Kt(t, e);
2959
+ i({ type: "oddin:autoplayblocked" }), qt(t, e);
2952
2960
  });
2953
2961
  }, s = async (r) => {
2954
2962
  a?.destroy(), a = null;
@@ -2960,7 +2968,8 @@ async function Gt() {
2960
2968
  credential: { apiKey: e.apiKey },
2961
2969
  autoplay: e.autoplay,
2962
2970
  muted: e.muted,
2963
- waitForLive: e.waitForLive
2971
+ waitForLive: e.waitForLive,
2972
+ analytics: e.analytics
2964
2973
  });
2965
2974
  a = n;
2966
2975
  let i = t.parentElement;
@@ -3026,18 +3035,18 @@ async function Gt() {
3026
3035
  protocol: 1
3027
3036
  });
3028
3037
  }
3029
- function Kt(e, t) {
3038
+ function qt(e, t) {
3030
3039
  if (document.getElementById("havik-tap")) return;
3031
3040
  let n = document.createElement("button");
3032
3041
  n.id = "havik-tap", n.textContent = "▶ Tap to play", n.style.cssText = "position:fixed;inset:0;width:100%;height:100%;border:0;background:rgba(0,0,0,.55);color:#fff;font:600 18px system-ui,sans-serif;cursor:pointer;z-index:9", n.addEventListener("click", () => {
3033
3042
  n.remove(), t.play();
3034
3043
  }), document.body.appendChild(n);
3035
3044
  }
3036
- function qt() {
3045
+ function Jt() {
3037
3046
  let e = document.createElement("style");
3038
3047
  e.textContent = "html,body{margin:0;height:100%;background:#000;overflow:hidden}body{display:flex}", document.head.appendChild(e);
3039
3048
  }
3040
3049
  //#endregion
3041
- export { bt as ODDIN_THEME, n as PlaybackError, St as applyTheme, z as baseUrlForEnv, Gt as bootEmbed, _e as clearDeviceId, Q as createPlayer, D as deriveEventsBaseUrl, Ee as detectDrmSupport, w as enterVideoFullscreen, T as exitVideoFullscreen, ue as fetchCatalog, fe as fetchTournament, me as flattenMatches, A as getDeviceId, Oe as isLowLatencyManifest, $ as isOddinMessage, ye as licenseRequestHeaders, Ht as mountEmbed, v as pollToLive, b as resolveStream, E as subscribeLiveState, C as videoFullscreenActive, he as watchStatus };
3050
+ export { bt as ODDIN_THEME, n as PlaybackError, St as applyTheme, z as baseUrlForEnv, Kt as bootEmbed, _e as clearDeviceId, Q as createPlayer, D as deriveEventsBaseUrl, Ee as detectDrmSupport, w as enterVideoFullscreen, T as exitVideoFullscreen, ue as fetchCatalog, fe as fetchTournament, me as flattenMatches, A as getDeviceId, Oe as isLowLatencyManifest, $ as isOddinMessage, ye as licenseRequestHeaders, Ht as mountEmbed, v as pollToLive, b as resolveStream, E as subscribeLiveState, C as videoFullscreenActive, he as watchStatus };
3042
3051
 
3043
3052
  //# sourceMappingURL=index.js.map