Hey I just released a library called embedz specifically for this, it handles everything for you, and is about 5x faster than a regular youtube embed
You can check it out here, GitHub
To use it install the npm package
npm i @embedz/svelte
Then import the library in to your svelte app
<script>
import { YouTube, Vimeo } from "@embedz/svelte";
</script>
<YouTube
id="KRVnaN29GvM"
posterquality="max"
/>