misc: autoplay if click to view is enabled

This commit is contained in:
Xylight committed 2024-07-16 13:23:03 -07:00
1 parent bb7c5f7ae6
commit 4a8792f510
1 file changed
+10 -3
@@ -52,8 +52,11 @@
const videoID = youtubeVideoID(inputUrl) const videoID = youtubeVideoID(inputUrl)
if ($userSettings.embeds.clickToView)
url.searchParams.set('autoplay', '1')
return `https://${youtubeDomain( return `https://${youtubeDomain(
$userSettings.embeds.youtube $userSettings.embeds.youtube,
)}/embed/${videoID}?${url.searchParams.toString()}` )}/embed/${videoID}?${url.searchParams.toString()}`
} }
@@ -61,7 +64,7 @@
} }
const typeData = ( const typeData = (
type: IframeType type: IframeType,
): { ): {
icon: IconSource icon: IconSource
text: string text: string
@@ -99,7 +102,11 @@
{#if opened} {#if opened}
{#if type == 'video'} {#if type == 'video'}
<!-- svelte-ignore a11y-media-has-caption --> <!-- svelte-ignore a11y-media-has-caption -->
<video controls class="rounded-xl aspect-video"> <video
autoplay={$userSettings.embeds.clickToView}
controls
class="rounded-xl aspect-video"
>
<source src={url} /> <source src={url} />
</video> </video>
{:else} {:else}