Skip to content

Commit 09fa69f

Browse files
committed
fix(VimeoPlayer): switch to new oembed API for thumbnails
Fixes #451
1 parent 7671c80 commit 09fa69f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/runtime/components/ScriptVimeoPlayer.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,24 @@ const id = computed(() => {
152152
return props.vimeoOptions?.id || props.id
153153
})
154154
155+
const videoId = computed(() => `vimeo-embed:${id.value}`)
155156
const { data: payload } = useAsyncData(
156-
`vimeo-embed:${id.value}`,
157+
videoId,
157158
// TODO ideally we cache this
158-
() => $fetch(`https://vimeo.com/api/v2/video/${id.value}.json`).then(res => (res as any)[0]),
159+
() => $fetch(`https://vimeo.com/api/oembed.json`, {
160+
params: {
161+
url: `https://vimeo.com/${id.value}`,
162+
format: 'json',
163+
}
164+
}),
159165
{
160-
watch: [id],
161-
},
166+
lazy: true,
167+
}
162168
)
163169
164-
const placeholder = computed(() => payload.value?.thumbnail_large)
170+
const placeholder = computed(() => {
171+
return payload.value?.thumbnail_url
172+
})
165173
166174
let player: Vimeo | undefined
167175
// we can't directly expose the player as vue will break the proxy

0 commit comments

Comments
 (0)