diff --git a/src/lib/components/lemmy/post/helpers.ts b/src/lib/components/lemmy/post/helpers.ts index 110ef830..c35d7f40 100644 --- a/src/lib/components/lemmy/post/helpers.ts +++ b/src/lib/components/lemmy/post/helpers.ts @@ -79,9 +79,9 @@ export const mediaType = (url?: string, view: View = 'cozy'): MediaType => { return 'none' } -export const iframeType = (post: Post): IframeType => { - if (isVideo(post.url)) return 'video' - if (isYoutubeLink(post.url)) return 'youtube' +export const iframeType = (url: string): IframeType => { + if (isVideo(url)) return 'video' + if (isYoutubeLink(url)) return 'youtube' return 'none' } diff --git a/src/lib/components/lemmy/post/media/PostIframe.svelte b/src/lib/components/lemmy/post/media/PostIframe.svelte index 9cd710a6..00fb948a 100644 --- a/src/lib/components/lemmy/post/media/PostIframe.svelte +++ b/src/lib/components/lemmy/post/media/PostIframe.svelte @@ -41,6 +41,7 @@ export let thumbnail: string | undefined = undefined export let url: string export let opened = !$userSettings.embeds.clickToView + export let autoplay: boolean = $userSettings.embeds.clickToView const urlToEmbed = (inputUrl: string) => { if (type == 'video') { @@ -52,11 +53,10 @@ const videoID = youtubeVideoID(inputUrl) - if ($userSettings.embeds.clickToView) - url.searchParams.set('autoplay', '1') + if (autoplay) url.searchParams.set('autoplay', '1') return `https://${youtubeDomain( - $userSettings.embeds.youtube, + $userSettings.embeds.youtube )}/embed/${videoID}?${url.searchParams.toString()}` } @@ -64,7 +64,7 @@ } const typeData = ( - type: IframeType, + type: IframeType ): { icon: IconSource text: string @@ -102,11 +102,7 @@ {#if opened} {#if type == 'video'} -