Hybrid app with offline videos

Hi all!

I need to build an app, where users can login and retrieve some scheduled data and videos. The Videos and other data need to be offline accessable. So on start all videos need to be downloaded. Is this possible with meteor?

The Cordova integration in current versions of Meteor has an issue with accessing files stored on the local file system, so although you would be able to download the videos and store them for offline usage, playing them back will likely not work correctly. I’m working on a rewrite of the Meteor file serving plugin that should fix this.

2 Likes

Thanks! When are you planing to do the rewrite?

I’m currently working on it, but there is still a lot to do before it is production ready. Hopefully I’ll be able to do a preview release at the end of next month.

1 Like

You can download the videos using the Cordova FileTransfer plugin. On Android you will have to proxy using the httpd module to access local images/videos:

// Use Cordova HTTP Plugin to create a local HTTP proxy for Image and file resources. function startServer (wwwRoot) { console.log('starting server at ' + wwwRoot);
if (httpd) {
    // before start, check whether its up or not
    httpd.getURL(function (url) {
        if (url.length > 0) {
            httpUrl = url;
        } else {
            httpd.startServer({
                www_root:       wwwRoot,
                port:           8080,
                localhost_only: true
            }, function (url) {

                httpUrl = url;
            }, function (error) {

                console.log('failed to start server: ' + error);
            });
        }

    });
} else {
    console.log('CorHttpd plugin not available/ready.');
}

}
// For example using ImgCache module:
startServer(ImgCache.getCacheFolderURI().replace(‘file://’, ‘’));

Then you can set the img or video source to: http://127.0.0.1:8080/myVideo.mp4

On IOS you can use cdvfile://localhost/videofolder/

1 Like