|
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: |
Answered by
stanlrt
Oct 17, 2024
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" }}
/>
);
} |
5 replies
Answer selected by
stanlrt
|
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). |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anyone having the same issue, basically do not follow the docs: