youtube or vimeo videos load with expo video

Please provide the following:

  1. SDK Version: 40
  2. Platforms(Android/iOS/web/all): ios and android

I have the video setup but when I use vimeo or youtube link nothing loads. I’ve read to get the “true” video sharing link" from vimeo is to pay for their service (even when I can get the video link from inspecting the page).

I made a free app and for right now i’m just trying to get a free vimeo or youtube video to load. Is there a way to do that?


                   <View style={{ paddingVertical: 10 }}>
                       <Text style={styles.PageText}>Tutorial</Text>
                       <Video
                           source={{ uri: 'https://i.vimeocdn.com/video/1034431146' }}
                           rate={1.0}
                           volume={1.0}
                           resizeMode="cover"
                           useNativeControls={true}
                           style={{ width: 300, height: 300, }}
                       />
                   </View>

use a webview, something like this GitHub - LonelyCpp/react-native-youtube-iframe: A wrapper of the Youtube-iframe API built for react native.

1 Like

will this also load Vimeo videos so it doesn’t show adds or other videos at the end of it?

I’m trying to use this right now

oh I don’t see it showing ads. I think this works…omg this is so good! Will report back if it hits any errors and all that.

Thank you!

do you have any hints how to auto pause the video when I go to a different screen?

Hi
to display videos, you can not use the url directly from Vimeo. You have to request an API with video’s id :
assume we have :

const [listUrl, setListUrl ] = useState([ ]);
axios.get(`https://player.vimeo.com/video/1034431146/config`)
    .then(res => {
          setListUrl([res.data.request.files.hls.cdns[res.data.request.files.hls.default_cdn].url])
   })

“listUrl” will contain the correct url to display your video :wink:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.