2

I want to play a streaming video from my google drive using react-native-video. I got the shareable link and paste in my code, but when i run my code, the log showed an error

"Couldn't open https://drive.google.com/open?id=1la4ENUiwDvnYbmRck1QZGbKLy8Kc_5UH&name=larva.mp4: java.io.FileNotFoundException: No content provider: https://drive.google.com/open?id=1la4ENUiwDvnYbmRck1QZGbKLy8Kc_5UH&name=larva.mp4"

Here is my video code :

source={{
uri: 'https://drive.google.com/open?id=1la4ENUiwDvnYbmRck1QZGbKLy8Kc_5UH&name=larva.mp4',
type: 'video/mp4'
}}
Hasta Dhana
  • 4,699
  • 7
  • 17
  • 26

2 Answers2

2

Because the link you provided is a google drive web page with a player which is HTML. And you need a direct resource link to play the video.

You can extract the resource link by using this service https://gdurl.com/, paste your link there, and get the permanent resource link.

Change the URL into this will make it work. Enjoy!

https://gdurl.com/nUNM
I Putu Yoga Permana
  • 3,980
  • 29
  • 33
  • it works, but when I want to share the video with another person it can't play and showed "Access to r5---sn-npoeenez.c.drive.google.com was denied You don't have authorization to view this page." I already set the video in my drive public so everyone can view the video. But the inspect link still set private. – Eko Sri Wahyuni Oct 07 '19 at 04:04
  • I updated the answer to generate the permanent resource url from google drive @EkoSriWahyuni – I Putu Yoga Permana Oct 07 '19 at 06:34
0

Ensure that the video is publicly accessible. Just convert Google Drive URL from https://drive.google.com/file/d/{id}/view to https://drive.google.com/uc?export=download&id={id} and use it like

import Video from "react-native-video";

...

<Video source={{uri: 'https://drive.google.com/uc?export=download&id={id}'}}
...

Just make sure to replace {id} with your Google Drive video id.

Mher
  • 985
  • 9
  • 23