Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/content/scripts/vimeo-player.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ The [`<ScriptVimeoPlayer>`](/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.

Expand Down
7 changes: 5 additions & 2 deletions src/runtime/components/ScriptVimeoPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<TEmits>()
Expand Down Expand Up @@ -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',
},
Expand Down Expand Up @@ -295,7 +298,7 @@ onBeforeUnmount(() => player?.unload())
<style>
.vimeo-player iframe {
height: auto;
aspect-ratio: 16/9;
aspect-ratio: var(--vimeo-ratio, 16/9);
width: 100%;
max-width: 100% !important;
}
Expand Down
Loading