diff --git a/docs/content/scripts/vimeo-player.md b/docs/content/scripts/vimeo-player.md index 56b7ea05f..6d2d90076 100644 --- a/docs/content/scripts/vimeo-player.md +++ b/docs/content/scripts/vimeo-player.md @@ -87,6 +87,7 @@ The [``](/scripts/vimeo-player){lang="html"} component accept - `placeholderAttrs`: The attributes for the placeholder image. Default is `{ loading: 'lazy' }`. - `id`: Shorthand for `vimeoOptions.id`. - `url`: Shorthand for `vimeoOptions.url`. +- `ratio`: Sets the video aspect ratio (e.g. `16/9`, `4/3`, `9/16`). Default is `16/9`. - `vimeoOptions`: All options from the Player SDK are supported, please consult the [Embed Options](https://developer.vimeo.com/player/sdk/embed) for full documentation. diff --git a/src/runtime/components/ScriptVimeoPlayer.vue b/src/runtime/components/ScriptVimeoPlayer.vue index 81abe9711..602360352 100644 --- a/src/runtime/components/ScriptVimeoPlayer.vue +++ b/src/runtime/components/ScriptVimeoPlayer.vue @@ -52,8 +52,10 @@ const props = withDefaults(defineProps<{ vimeoOptions?: VimeoOptions id?: number | undefined url?: string | undefined + ratio?: string }>(), { trigger: 'mousedown', + ratio: '16/9', }) const emits = defineEmits() @@ -247,10 +249,11 @@ const rootAttrs = computed(() => { 'aria-live': 'polite', 'role': 'application', 'style': { + '--vimeo-ratio': props.ratio, maxWidth: '100%', width: `auto`, height: 'auto', - aspectRatio: `16/9`, + aspectRatio: props.ratio, position: 'relative', backgroundColor: 'black', }, @@ -295,7 +298,7 @@ onBeforeUnmount(() => player?.unload())