I really want to load the source of a video from my applications cache. In the native part of my application I'm saving a video to a folder within a folder within caches.
/var/mobile/Containers/Data/Application/639797B4-1726-4350-91D7-2E212ACB974D/Library/Caches/.../.../clip.mov
So I was looking into using the cordova file plugin:
and honestly I'm so confused as to how I'm supposed to implement it. I've done almost nothing on the web side of the application. Just a few basic functions and I'm sort of unsure as to how to do this and where I am supposed to do it. I understand that it's supposed to come after the device is ready.
all I want to do is read the file but it says I need a fileEntry object for which I think I need to create a temporary or persistant file. (Not sure which is appropriate because I only want to use the file temporarily but I am saving it into the file caches file system so I guess it's persistant?) I'm just generally confused about what I need to include.
Below is my barebones JS:
var app = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
...
//some button events
...
},
// deviceready Event Handler
onDeviceReady: function() {
app.receivedEvent('deviceready');
// <---
},
// Update DOM on a Received Event
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
}
};
app.initialize();
if anybody could point me in the right direction it would be greatly appreciated.
Thanks.