blaziken105
blaziken105

Reputation: 501

Convert path to URI in React Native

I am using React Native and am using https://github.com/lwansbrough/react-native-camera to capture a video. On saving the video I get an absolute path to the storage on my device. I want to convert it into a URI to display it.

{path:"file:///storage/emulated/0/DCIM/VID_21324217_242411222.mp4"}

I have already tried doing this

<Video
  source={{ uri: this.state.videoSource.path}}
  ....

But it doesn't work what am I missing? how do I convert this absolute path to an URI so I can display it in the video player?

Upvotes: 4

Views: 8611

Answers (1)

Eldelshell
Eldelshell

Reputation: 6950

As stated here try to remove the file:// part of the path since it seems to be a bug on react-native-video which, although was fixed, IDK which version of this you're using or which version is patched.

Upvotes: 1

Related Questions