diff --git a/src/components/video/poster.astro b/src/components/video/poster.astro index 77d6539..4f55ab2 100644 --- a/src/components/video/poster.astro +++ b/src/components/video/poster.astro @@ -1,21 +1,14 @@ --- +import { getVideoImages } from '~/helpers/listing-page.js' const { video } = Astro.props -const webpSource = { - ...video.thumbnail, - srcset: video.thumbnail.srcset.replaceAll('ytimg.com/vi/', 'ytimg.com/vi_webp/').replace(/.png|.jpg|.jpeg/g, '.webp') -} - -const mergedSources = { - webp: webpSource, - jpeg: video.thumbnail -} +const images = getVideoImages( video ) --- - { Object.entries( mergedSources ).map( ([ key, source ]) => ( + { Object.entries( images.srcset ).map( ([ key, source ]) => (