Getting issues in reading videos' url in IOS + PhoneGap App

PhoneGap Apr 3, 2015

In this blog post, I will give you a solution of an issue in 2 minutes for which I spent whole 2 days and didn't get any help on google or from anyone. It was that weird. No technical explanation, no issue reported anywhere online.

I made an upload feature for devices which was working fine on Android ,picking all gallery images/videos but on IOS, it broke for videos.The issue was with reading videos with FileReader of phoneGap.

FileReader takes your device's file url as an argument and returns corresponding metadata information.

Just to give some background, we get these urls from Camera plugin that captures a new pic or picks a file from gallery and gives file's url as a result. Using this url, we can read the file.

I was getting {code : 5} failure message which means that something happened while encoding the file. You can check this error over here .

After spending two days, I felt very wierd about urls. The urls for images and videos were little bit different.

Image's Url : file:///var/mobile/Containers/Data/Application/50EB2F23-67A0-467D-B1A3-B3A2D1F875A2/tmp/cdv_photo_001.jpg

Video's Url : file:///**private/**var/mobile/Containers/Data/Application/50EB2F23-67A0-467D-B1A3-B3A2D1F875A2/tmp/trim.F26037A6-6D84-477E-8583-BDECB3BC0B24.MOV

private keyword was extra in video urls. Removing this keyword fixed my issues in IOS.

For full working code, you can go to github repo here

Related Posts:
Adding file upload feature in your phoneGap application.

Making file upload feature for your PhoneGap app

Related Tags:

PhoneGap