'Get path of a PHAsset coming from CameraRoll iOS with react native
I'm building a video app uploader using react-native.
I encounter a problem with file management from cameraroll. I have video inside my camera roll that i want to either play in my app (using rn-video), or upload them.
I tried using react-native-image-crop-picker with Passtrough option that should not compress video, but i feel like it's copying the video from cameraroll of iOS to AppData. So for big video i'm stuck sometime a longtime on "Processing Asset ..." window (see post here).
Now my question is, using react-native-cameraroll, i can fetch directly information about local video, but what i get is a link like this : ph://EA9508C5-6B69-46EC-8980-832774283946/L0/00
Is there a way to transform this link into something like this : 'file:///sdcard/Movies/sintel.mp4'
without copying the video entirely into my appData (to avoid long import)
Thanks in advance
Solution 1:[1]
After some research, i found that we can use a different path called assets-library
in iOS :
assets-library://asset/asset.${'mov'}?id=${appleId}&ext=${'mov'}
If you use this path with appleId being the ph asset identificator (something that look like this : const appleId = 'EFA45A33-818E-4A67-A0D8-50991A9B89FB/L0/001'
it will work perfectly.
It will work with react-native-fs //File system for RN
for copy/paste video for example
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | foufrix |