Skip to content

Commit

Permalink
misc: autoplay if click to view is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Xyphyn committed Jul 16, 2024
1 parent bb7c5f7 commit 4a8792f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/lib/components/lemmy/post/media/PostIframe.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,19 @@
const videoID = youtubeVideoID(inputUrl)
if ($userSettings.embeds.clickToView)
url.searchParams.set('autoplay', '1')
return `https://${youtubeDomain(
$userSettings.embeds.youtube
$userSettings.embeds.youtube,
)}/embed/${videoID}?${url.searchParams.toString()}`
}
return ''
}
const typeData = (
type: IframeType
type: IframeType,
): {
icon: IconSource
text: string
Expand Down Expand Up @@ -99,7 +102,11 @@
{#if opened}
{#if type == 'video'}
<!-- 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} />
</video>
{:else}
Expand Down

0 comments on commit 4a8792f

Please sign in to comment.