Mute examples videos (#1363)

* mute examples videos

* set attrs onmount for safari

Co-authored-by: Radames Ajna <radamajna@gmail.com>
This commit is contained in:
Victor Muštar 2022-05-24 22:08:08 +02:00 committed by GitHub
parent e4b5d4c1b7
commit 0ab254b82f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,15 +1,27 @@
<script lang="ts">
import { playable } from "../../utils/helpers";
import { onMount } from "svelte";
export let value: string;
export let samples_dir: string;
let video: HTMLVideoElement;
onMount(() => {
video.muted = true;
video.playsInline = true;
video.controls = false;
video.setAttribute("muted", "");
video.play();
video.pause();
});
</script>
<!-- svelte-ignore a11y-media-has-caption -->
<!-- svelte-ignore a11y-mouse-events-have-key-events -->
{#if playable(value)}
<video
muted
playsinline
bind:this={video}
on:mouseover={video.play}
on:mouseout={video.pause}