abbasfreestyle / react-native-af-video-player

MIT License
381 stars 289 forks source link

How to run Vimeo Videos? #89

Open prameetc opened 5 years ago

prameetc commented 5 years ago

I have this Vimeo Link - https://player.vimeo.com/video/289535718

How do I run this video using this package?

I have Vimeo Pro account and API Key with me.

lyvwhyr commented 5 years ago
const VIMEO_ID = '179859217';
fetch(`https://player.vimeo.com/video/${VIMEO_ID}/config`)
      .then(res => res.json())
      .then(res => this.setState({
        thumbnailUrl: res.video.thumbs['640'],
        videoUrl: res.request.files.hls.cdns[res.request.files.hls.default_cdn].url,
        video: res.video,
      }));

then use that videoUrl variable in the package. You will need to interact with Vimeo API yourself as this plugin won't automatically take care of it