Looking for solution to locally store video's from CMS

I’m new to Ionic but i already love it :slight_smile: (I did use Angular before) I want to make my next project with Ionic but I do have a “challenge", hopefully someone can help me. Our client would like an app that can play 10 video’s. He also wants the video’s to play when the internet connection is broken. So i have to find a way to locally store them. That wouldn’t be a big problem if it were always the same video’s but our client wants to change them every month by using a CMS. So i have a CMS that provides me with an API that give’s me an URL to the video. Can someone give me some advise on how I would solve this issue? I was thinking about PouchDB but because I never used PouchDB before I’m not sure if that is what i need.
Every suggestion is welcome , thanks! :slight_smile:

use cordova file and filetransferplugin:

with the fileplugin --> mount your PERSISTEN filesystem --> create folder for your app.
with file-transfer plugin… download the files to your folder

Thank you so much for helping me out! I can’t wait to try this! :smile: :smiley:

Hello, I am trying achieve the same task in Android, I download video files from external URL and try to store in cordova.file.dataDirectory path like this.

// Path example: /data/data/<app-id>/files/video.mp4
var targetPath = cordova.file.dataDirectory + video_SD; 
$cordovaFileTransfer.download(server_url_video, targetPath, {}, true).then(function(result)  { 
// Success!
alert( JSON.stringify(result) );
...

image

Apparently everything goes fine, but when i look into the directory , it is empty.

Does anybody know what is happening? thank you

FYI, i have solved this problem.

In order to download the files properly, the right targetpath must be:
var targetPath = cordova.file.externalDataDirectory + video_SD;

and here is the URL ready to be used in video src tag :
$scope.srcFile = result.toNativeURL();

Regards.

1 Like