Installation
Install the component
Run the following command to install the component and its dependencies:
Import the component
Import the component into your Svelte file:
Showcase
A refined video player component with a progress slider and smooth GSAP-powered interactions.
npx @motion-core/cli add video-playernpx @motion-core/cli add video-playerimport { VideoPlayer } from "$lib/motion-core";import { VideoPlayer } from "$lib/motion-core";<script lang="ts">
import { VideoPlayer } from "motion-core";
import type { ComponentProps } from "svelte";
type Props = Partial<ComponentProps<typeof VideoPlayer>>;
let {
autoplay = false,
muted = true,
loop = true,
hideControls = false,
}: Props = $props();
</script>
<div class="flex items-center justify-center px-8 py-16">
<VideoPlayer
src="https://videos.pexels.com/video-files/35217201/14919167_1920_1080_30fps.mp4"
{autoplay}
{muted}
{loop}
{hideControls}
/>
</div>
<script lang="ts">
import { VideoPlayer } from "motion-core";
import type { ComponentProps } from "svelte";
type Props = Partial<ComponentProps<typeof VideoPlayer>>;
let {
autoplay = false,
muted = true,
loop = true,
hideControls = false,
}: Props = $props();
</script>
<div class="flex items-center justify-center px-8 py-16">
<VideoPlayer
src="https://videos.pexels.com/video-files/35217201/14919167_1920_1080_30fps.mp4"
{autoplay}
{muted}
{loop}
{hideControls}
/>
</div>
| Prop | Type | Default |
|---|---|---|
src | string | undefined |
poster | string | undefined |
autoplay | boolean | false |
muted | boolean | true |
loop | boolean | false |
hideControls | boolean | false |
class | string | undefined |