@moq/watch 0.2.10 → 0.2.11

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/ui/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Button as ct, Icon as W, Stats as Nt } from "@moq/ui-core";
1
+ import { Button as ct, Icon as L, Stats as Nt } from "@moq/ui-core";
2
2
  import { Signals as Ut } from "@moq/hang";
3
3
  const Kt = !1, Dt = (t, e) => t === e, Ht = /* @__PURE__ */ Symbol("solid-track"), rt = {
4
4
  equals: Dt
@@ -40,7 +40,7 @@ function T(t, e, n) {
40
40
  const a = kt(t, e, !1, B);
41
41
  X(a);
42
42
  }
43
- function Lt(t, e, n) {
43
+ function Wt(t, e, n) {
44
44
  Mt = te;
45
45
  const a = kt(t, e, !1, B);
46
46
  a.user = !0, j ? j.push(a) : X(a);
@@ -60,8 +60,8 @@ function I(t) {
60
60
  v = e;
61
61
  }
62
62
  }
63
- function Wt(t) {
64
- Lt(() => I(t));
63
+ function Lt(t) {
64
+ Wt(() => I(t));
65
65
  }
66
66
  function ft(t) {
67
67
  return p === null || (p.cleanups === null ? p.cleanups = [t] : p.cleanups.push(t)), t;
@@ -715,17 +715,17 @@ function Ce(t) {
715
715
  timestamp: K,
716
716
  videoBuffered: D,
717
717
  audioBuffered: dt
718
- }, V = t.moqWatch, L = new Ut.Effect();
719
- L.run((b) => {
718
+ }, V = t.moqWatch, W = new Ut.Effect();
719
+ W.run((b) => {
720
720
  const M = b.get(V.connection.url), z = b.get(V.connection.status), k = b.get(V.broadcast.status);
721
721
  M ? z === "disconnected" ? n("disconnected") : z === "connecting" ? n("connecting") : k === "offline" ? n("offline") : k === "loading" ? n("loading") : k === "live" ? n("live") : z === "connected" && n("connected") : n("no-url");
722
- }), L.run((b) => {
722
+ }), W.run((b) => {
723
723
  const M = b.get(V.backend.paused);
724
724
  r(!M);
725
- }), L.run((b) => {
725
+ }), W.run((b) => {
726
726
  const M = b.get(V.backend.audio.volume);
727
727
  i(M * 100);
728
- }), L.run((b) => {
728
+ }), W.run((b) => {
729
729
  const z = b.get(V.backend.video.source.catalog)?.renditions ?? {}, k = Object.entries(z).map(([tt, H]) => ({
730
730
  name: tt,
731
731
  width: H.codedWidth,
@@ -737,7 +737,7 @@ function Ce(t) {
737
737
  const ht = () => {
738
738
  $(!!document.fullscreenElement);
739
739
  };
740
- return L.event(document, "fullscreenchange", ht), ft(() => L.close()), g(lt.Provider, {
740
+ return W.event(document, "fullscreenchange", ht), ft(() => W.close()), g(lt.Provider, {
741
741
  value: Y,
742
742
  get children() {
743
743
  return t.children;
@@ -810,12 +810,12 @@ function Pe(t) {
810
810
  const h = n(), d = e.timestamp(), _ = e.buffering();
811
811
  u && qt(u, e.videoBuffered(), d, h, _), f && qt(f, e.audioBuffered(), d, h, _), $ = requestAnimationFrame(m);
812
812
  };
813
- return Wt(() => {
813
+ return Lt(() => {
814
814
  $ = requestAnimationFrame(m);
815
815
  }), ft(() => {
816
816
  $ !== void 0 && cancelAnimationFrame($), document.removeEventListener("mousemove", A), document.removeEventListener("mouseup", y);
817
817
  }), (() => {
818
- var h = $e(), d = h.firstChild, _ = d.firstChild, q = _.nextSibling, N = q.firstChild, K = N.nextSibling, D = q.nextSibling, dt = D.firstChild, Y = dt.nextSibling, V = D.nextSibling, L = V.firstChild, ht = L.firstChild;
818
+ var h = $e(), d = h.firstChild, _ = d.firstChild, q = _.nextSibling, N = q.firstChild, K = N.nextSibling, D = q.nextSibling, dt = D.firstChild, Y = dt.nextSibling, V = D.nextSibling, W = V.firstChild, ht = W.firstChild;
819
819
  d.$$keydown = P, d.$$mousedown = x;
820
820
  var b = c;
821
821
  typeof b == "function" ? _t(b, d) : c = d, pt(d, "aria-valuemin", vt);
@@ -827,7 +827,7 @@ function Pe(t) {
827
827
  return () => k() && Ee();
828
828
  })(), null), T((k) => {
829
829
  var tt = `watch-ui__buffer-visualization ${a() ? "watch-ui__buffer-visualization--dragging" : ""}`, H = e.jitter(), Ct = n(), St = `${i()}%`;
830
- return tt !== k.e && yt(d, k.e = tt), H !== k.t && pt(d, "aria-valuenow", k.t = H), Ct !== k.a && pt(d, "aria-valuemax", k.a = Ct), St !== k.o && ce(L, "left", k.o = St), k;
830
+ return tt !== k.e && yt(d, k.e = tt), H !== k.t && pt(d, "aria-valuenow", k.t = H), Ct !== k.a && pt(d, "aria-valuemax", k.a = Ct), St !== k.o && ce(W, "left", k.o = St), k;
831
831
  }, {
832
832
  e: void 0,
833
833
  t: void 0,
@@ -850,10 +850,10 @@ function qe() {
850
850
  return t.isFullscreen();
851
851
  },
852
852
  get fallback() {
853
- return g(W.FullscreenEnter, {});
853
+ return g(L.FullscreenEnter, {});
854
854
  },
855
855
  get children() {
856
- return g(W.FullscreenExit, {});
856
+ return g(L.FullscreenExit, {});
857
857
  }
858
858
  });
859
859
  }
@@ -875,17 +875,17 @@ function Me() {
875
875
  return t.isPlaying();
876
876
  },
877
877
  get fallback() {
878
- return g(W.Play, {});
878
+ return g(L.Play, {});
879
879
  },
880
880
  get children() {
881
- return g(W.Pause, {});
881
+ return g(L.Pause, {});
882
882
  }
883
883
  });
884
884
  }
885
885
  });
886
886
  }
887
- var Re = /* @__PURE__ */ R("<div class=watch-ui__quality-selector><label for=quality-select class=watch-ui__quality-label>Quality: </label><select id=quality-select class=watch-ui__quality-select><option value>Auto"), Le = /* @__PURE__ */ R("<option>");
888
- function We(t) {
887
+ var Re = /* @__PURE__ */ R("<div class=watch-ui__quality-selector><label for=quality-select class=watch-ui__quality-label>Quality: </label><select id=quality-select class=watch-ui__quality-select><option value>Auto"), We = /* @__PURE__ */ R("<option>");
888
+ function Le(t) {
889
889
  return t >= 1e6 ? `${(t / 1e6).toFixed(1)} Mbps` : t >= 1e3 ? `${(t / 1e3).toFixed(0)} kbps` : `${t} bps`;
890
890
  }
891
891
  function je() {
@@ -900,13 +900,13 @@ function je() {
900
900
  return t.availableRenditions() ?? [];
901
901
  },
902
902
  children: (o) => (() => {
903
- var s = Le();
903
+ var s = We();
904
904
  return w(s, () => o.name, null), w(s, (() => {
905
905
  var i = mt(() => !!(o.width && o.height));
906
906
  return () => i() ? ` (${o.width}x${o.height})` : "";
907
907
  })(), null), w(s, (() => {
908
908
  var i = mt(() => !!o.bitrate);
909
- return () => i() ? ` ${We(o.bitrate)}` : "";
909
+ return () => i() ? ` ${Le(o.bitrate)}` : "";
910
910
  })(), null), T(() => s.value = o.name), s;
911
911
  })()
912
912
  }), null), T(() => r.value = t.activeRendition() ?? ""), n;
@@ -922,18 +922,18 @@ function Te() {
922
922
  t.setIsStatsPanelVisible(!t.isStatsPanelVisible());
923
923
  },
924
924
  get children() {
925
- return g(W.Stats, {});
925
+ return g(L.Stats, {});
926
926
  }
927
927
  });
928
928
  }
929
929
  var Ie = /* @__PURE__ */ R('<div class="watch-ui__volume-slider flex--center"><input type=range min=0 max=100><span class=watch-ui__volume-label>');
930
- const Ve = (t, e) => e || t === 0 ? g(W.Mute, {}) : t > 0 && t <= 33 ? g(W.VolumeLow, {}) : t > 33 && t <= 66 ? g(W.VolumeMedium, {}) : g(W.VolumeHigh, {});
930
+ const Ve = (t, e) => e || t === 0 ? g(L.Mute, {}) : t > 0 && t <= 33 ? g(L.VolumeLow, {}) : t > 33 && t <= 66 ? g(L.VolumeMedium, {}) : g(L.VolumeHigh, {});
931
931
  function ze() {
932
932
  const [t, e] = E(0), n = F(), a = (r) => {
933
933
  const o = r.currentTarget, s = parseFloat(o.value);
934
934
  n.setVolume(s);
935
935
  };
936
- return Lt(() => {
936
+ return Wt(() => {
937
937
  const r = n.currentVolume() || 0;
938
938
  e(Math.round(r));
939
939
  }), (() => {
@@ -1028,7 +1028,14 @@ function Qe(t) {
1028
1028
  get children() {
1029
1029
  return g(Nt, {
1030
1030
  context: lt,
1031
- getElement: (r) => r?.moqWatch.backend
1031
+ getElement: (r) => {
1032
+ if (r)
1033
+ return {
1034
+ audio: r.moqWatch.backend.audio,
1035
+ video: r.moqWatch.backend.video,
1036
+ connection: r.moqWatch.connection.established
1037
+ };
1038
+ }
1032
1039
  });
1033
1040
  }
1034
1041
  }) : null;
@@ -1041,7 +1048,7 @@ ke("moq-watch-ui", (t, {
1041
1048
  element: e
1042
1049
  }) => {
1043
1050
  const [n, a] = E();
1044
- return Wt(async () => {
1051
+ return Lt(async () => {
1045
1052
  await customElements.whenDefined("moq-watch");
1046
1053
  const r = e.querySelector("moq-watch");
1047
1054
  a(r || void 0);