-
Hello, import { DotLottie, DotLottieSolid } from "@lottiefiles/dotlottie-solid";
import { createEffect, createSignal } from "solid-js";
/**
* The visual component that indicates volume and speaker changes.
*/
export function VoiceIndicator(props: { volumeLevel: number }) {
const [lottieRef, setLottieRef] = createSignal<DotLottie>();
ccreateEffect(() => {
const lottie = lottieRef();
if (lottie) {
lottie.setFrame(Math.round(props.volumeLevel * lottie.totalFrames));
}
});
return (
<DotLottieSolid
src={"./VUI-anim.lottie"}
dotLottieRefCallback={setLottieRef}
style={{ width: "100px", height: "100px" }}
/>
);
} Here the error: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
For anyone having the same issue, basically do not follow the docs: import { DotLottie, DotLottieSolid } from "@lottiefiles/dotlottie-solid";
import { createEffect, createSignal } from "solid-js";
import VUIAnim from "./VUI-anim.json";
/**
* The visual component that indicates volume and speaker changes.
*/
export function VoiceIndicator(props: { volumeLevel: number }) {
const [lottieRef, setLottieRef] = createSignal<DotLottie>();
createEffect(() => {
const lottie = lottieRef();
if (lottie) {
lottie.setFrame(Math.round(props.volumeLevel * lottie.totalFrames));
}
});
return (
<DotLottieSolid
data={VUIAnim}
dotLottieRefCallback={setLottieRef}
style={{ width: "100px", height: "100px" }}
/>
);
} |
Beta Was this translation helpful? Give feedback.
-
hey @stanlrt, i tried this on all available players, there were this error. import VUIAnim from "./VUI-anim.json";
function App() {
return (
<DotLottieSolid data={VUIAnim} loop autoplay />
);
} this works as it will be converted into a module object on runtime. another workaround is to serve from static files dir. like
function App() {
return (
<DotLottieSolid src="/lotties/dotLottieJson.json" loop autoplay />
);
} this will also work, since it is accessed via a URL on runtime. EDIT: I think, the docs are referred to the second method (the way of providing path/to/file). |
Beta Was this translation helpful? Give feedback.
For anyone having the same issue, basically do not follow the docs: