File tree Expand file tree Collapse file tree
packages/vidstack/src/providers/vimeo Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,9 +50,9 @@ export class VimeoProviderLoader implements MediaProviderLoader<VimeoProvider> {
5050
5151 if ( ! isString ( src . src ) ) return null ;
5252
53- const { videoId } = resolveVimeoVideoId ( src . src ) ;
53+ const { videoId, hash } = resolveVimeoVideoId ( src . src ) ;
5454 if ( videoId ) {
55- return getVimeoVideoInfo ( videoId , abort ) . then ( ( info ) => ( info ? info . poster : null ) ) ;
55+ return getVimeoVideoInfo ( videoId , abort , hash ) . then ( ( info ) => ( info ? info . poster : null ) ) ;
5656 }
5757
5858 return null ;
Original file line number Diff line number Diff line change @@ -228,7 +228,7 @@ export class VimeoProvider
228228
229229 this . _videoInfoPromise = promise ;
230230
231- getVimeoVideoInfo ( videoId , abort )
231+ getVimeoVideoInfo ( videoId , abort , this . _hash )
232232 . then ( ( info ) => {
233233 promise . resolve ( info ) ;
234234 } )
Original file line number Diff line number Diff line change 11import type { VimeoOEmbedData , VimeoVideoInfo } from './embed/misc' ;
22
3- const videoIdRE = / (?: h t t p s : \/ \/ ) ? (?: p l a y e r \. ) ? v i m e o (?: \. c o m ) ? \/ (?: v i d e o \/ ) ? ( \d + ) (?: \? h a s h = ( .* ) ) ? / ;
3+ const videoIdRE =
4+ / (?: h t t p s : \/ \/ ) ? (?: p l a y e r \. ) ? v i m e o (?: \. c o m ) ? \/ (?: v i d e o \/ ) ? ( \d + ) (?: (?: \? h a s h = | \? h = | \/ ) ( .* ) ) ? / ;
45
56const infoCache = new Map < string , VimeoVideoInfo > ( ) ;
67
@@ -11,12 +12,19 @@ export function resolveVimeoVideoId(src: string) {
1112 return { videoId : matches ?. [ 1 ] , hash : matches ?. [ 2 ] } ;
1213}
1314
14- export async function getVimeoVideoInfo ( videoId : string , abort : AbortController ) {
15+ export async function getVimeoVideoInfo (
16+ videoId : string ,
17+ abort : AbortController ,
18+ videoHash ?: string | null ,
19+ ) {
1520 if ( infoCache . has ( videoId ) ) return infoCache . get ( videoId ) ! ;
1621
1722 if ( pendingFetch . has ( videoId ) ) return pendingFetch . get ( videoId ) ;
1823
19- const oembedSrc = `https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/${ videoId } ` ;
24+ let oembedSrc = `https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/${ videoId } ` ;
25+ if ( videoHash ) {
26+ oembedSrc = oembedSrc . concat ( `?h=${ videoHash } ` ) ;
27+ }
2028
2129 const promise = window
2230 . fetch ( oembedSrc , {
You can’t perform that action at this time.
0 commit comments