Open Scorpio3310 opened 1 year ago
Why not use the component directly?
<script>
import { browser } from '$app/environment';
import { LottiePlayer } from '@lottiefiles/svelte-lottie-player';
export let src;
export let width;
let dataReady = false;
</script>
{#if browser}
<div style="max-width: {width}px;" class="mx-auto">
<LottiePlayer
{src}
autoplay={true}
loop={true}
controls={false}
renderer="svg"
background="transparent"
height={0}
width={0}
controlsLayout={false}
/>
</div>
{:else}
<div class="flex flex-col gap-6">
<div class="animate-pulse">
<div class="w-30 h-60 bg-gray-100 rounded-xl max-w-sm mx-auto"></div>
</div>
</div>
{/if}
Also, your height
and width
props are 0
, is that intentional?
I encountered an error while loading the Lottie player. The problem occurs when the Lottie animation is loaded on the page, and there are also warnings during the app's building process. Interestingly, despite these errors and warnings, the Lottie player loads normally and works as expected.
Code in browser in sources: LottiePlayer.svelte
Could not load content for http://localhost:5173/sl/LottiePlayer.svelte (HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE)
My code:
Terminal warnings/errors:
Building warnings: