Skip to content

Commit

Permalink
resolve path on video component too
Browse files Browse the repository at this point in the history
  • Loading branch information
ceitine committed Nov 9, 2024
1 parent 046fbd4 commit b64972d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/components/Video.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
<script lang="ts">
import { page } from '$app/stores';
function resolvePath(src: string) {
return src.startsWith('http://') || src.startsWith('https://')
? src
: `/blogs/${$page.params.slug}/${src}`;
}
export let src: string;
</script>

<!-- svelte-ignore a11y-no-static-element-interactions -->
<!-- svelte-ignore a11y-media-has-caption -->
<video class="mx-auto flex justify-center rounded-lg" controls>
<source src="/blogs/{$page.params.slug}/{src}" />
<source src={resolvePath(src)} />
</video>

0 comments on commit b64972d

Please sign in to comment.