From 89b2270d8de1f9f9b36a4a354a871d1bcd2324d9 Mon Sep 17 00:00:00 2001 From: Maxime Pauvert Date: Sun, 14 Dec 2025 15:04:28 +0100 Subject: [PATCH] add ratio props to ScriptYouTubePlayer --- src/runtime/components/ScriptYouTubePlayer.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/runtime/components/ScriptYouTubePlayer.vue b/src/runtime/components/ScriptYouTubePlayer.vue index d1785cb9..729b9feb 100644 --- a/src/runtime/components/ScriptYouTubePlayer.vue +++ b/src/runtime/components/ScriptYouTubePlayer.vue @@ -35,6 +35,7 @@ const props = withDefaults(defineProps<{ playerVars?: YT.PlayerVars width?: number height?: number + ratio?: string /** * Whether to use youtube-nocookie.com for embedding. * @@ -53,6 +54,7 @@ const props = withDefaults(defineProps<{ playerVars: { autoplay: 0, playsinline: 1 }, width: 640, height: 360, + ratio: '16/9', }) const emits = defineEmits<{ @@ -147,7 +149,7 @@ const rootAttrs = computed(() => { position: 'relative', backgroundColor: 'black', width: '100%', - aspectRatio: `${props.width}/${props.height}`, + aspectRatio: props.ratio, }, ...(trigger instanceof Promise ? trigger.ssrAttrs || {} : {}), }) as HTMLAttributes @@ -186,7 +188,7 @@ const placeholderAttrs = computed(() => { loading: props.aboveTheFold ? 'eager' : 'lazy', style: { width: '100%', - objectFit: 'contain', + objectFit: 'cover', height: '100%', }, onLoad(payload) {