@hakit/components
Version:
A series of components to work with @hakit/core
44 lines (43 loc) • 1.17 kB
JavaScript
import { j as i } from "../../../../../emotion-react-jsx-runtime.browser.esm-BErL7L7Y.js";
import { K as c } from "../../../../../ThemeControlsModal-gl0xLRqL.js";
import { Row as p } from "../../../Row/index.js";
import { useEntity as m, isUnavailableState as f, localize as a } from "@hakit/core";
import { useEffect as u } from "react";
function k({
entity: l,
onStateChange: t,
...r
}) {
const o = m(l), s = f(o.state);
return u(() => {
t("loading");
}, [t]), /* @__PURE__ */ i(p, { fullWidth: !0, children: /* @__PURE__ */ i(c, { entity: l, ...r, onStateChange: (n) => {
let e = a("loading");
switch (n) {
case "playing":
case "play":
e = a("play");
break;
case "loadeddata":
case "waiting":
e = a("loading");
break;
case "pause":
e = a("pause");
break;
case "stalled":
e = a("buffering");
break;
case "canplaythrough":
case "canplay":
e = a("nothing_playing");
break;
}
t(s ? a("unavailable") : e);
} }) });
}
export {
k as ModalCameraControls,
k as default
};
//# sourceMappingURL=index.js.map