Uploading video using Phonegap and DSP to Amazon S3


#1

I am using PhoneGap Capture plugin to capture a video.
Phonegap is successfully capturing the video and then I am uploading the same using the AngularJS API create file. The creation as well happens fine. However, I am not clear why is the remote file not playing after download or through the HTML video tag.

Code to capture the video:-
navigator.device.capture.captureVideo(captureSuccess, captureError, {duration:5})
Code called on success:-
function captureSuccess(mediaFiles){
for(i=0; i<mediaFiles.length; i++){
uploadFile(mediaFiles[i]);
}
}
Code to UploadFile:-
function uploadFile(mediaFile){
var request = {};
request.container = “containerName”;
request.file_path = "video_41.mp4"
request.body = mediaFile;
DreamFactory.api.file.createFile(request).then(
function(result){
console.log(“Created File:” + JSON.stringify(result));
},
function(reject) {
console.log(“Created File Failed:” + JSON.stringify(reject));
});

The Logs for the Uploaded File’s properties:-
{“name”:“capturedvideo.MOV”,“localURL”:“cdvfile://localhost/temporary/capture/capturedvideo.MOV”,“type”:“video/quicktime”,“lastModified”:null,“lastModifiedDate”:1431596510000,“size”:242512,“start”:0,“end”:0,“fullPath”:"/private/var/mobile/Containers/Data/Application/0243099F-462C-4002-90EA-ABA720E2102E/tmp/capture/capturedvideo.MOV"}

The logs print the following on successful upload:-
Created File:{“data”:{“file”:[{“name”:“video_40.mp4”,“path”:“patchme//video_40.mp4”}]},“status”:200,“config”:{“method”:“POST”,“transformRequest”:[null],“transformResponse”:[null],“url”:“http://ec2-***-139-78.ap-southeast-1.compute.amazonaws.com/rest/file/ContainerName//video_40.mp4”,“headers”:{“Content-Type”:“application/json”,“Accept”:“application/json”,“X-DreamFactory-Application-Name”:“someName”},“data”:{“name”:“capturedvideo.MOV”,“localURL”:“cdvfile://localhost/temporary/capture/capturedvideo.MOV”,“type”:“video/quicktime”,“lastModified”:null,“lastModifiedDate”:1431591498000,“size”:128395,“start”:0,“end”:0,“fullPath”:"/private/var/mobile/Containers/Data/Application/0243099F-462C-4002-90EA-ABA720E2102E/tmp/capture/capturedvideo.MOV"}},“statusText”:“OK”}

is it just a mov vs mp4 issue? or if any clue, if I am supposed to do any thing with the video encoding.
Any help is appreciated.


#2

Hi Praveen-
Did you figure this out? I found that cordova was crashing if the file was over 15 mb and wanted to see if you were having this same issue or identified a workaround.

Thanks!
Crystal