javascript - How to create and upload a video to parse server? -
i able upload image file s3 using parse server. (by creating parse file base64 image data , doing save() on parse file)
how can same thing video file? doing using parse-server js library in ionic 2 app typescript. below code worked images.
let file = new parse.file("thumbnail", { base64: imagedata }); file.save().then(() => { // file has been saved parse. console.log("file uploaded...."); }, (error) => { // file either not read, or not saved parse. console.log("file upload failed."); });
in case of video file, have file location received cordova media capture callback. me in uploading video file.
thank you
here solution after days of research. works iphone.
important statement this: data=data.replace("quicktime","mov");
var options = { limit: 1, duration: 30 }; navigator.device.capture.capturevideo(function(files){ // success! audio data here console.log("video file ready"); var vfile = files[0]; console.log(vfile.fullpath); ///private/var/mobile/containers/data/application/7a0069eb-f864-438f-a685-a0dae97f8b2d/tmp/capture-t0x144510b50.tmp.gfxoow/capturedvideo.mov self.auctionvideo = vfile.fullpath; //localurl; console.log(self.auctionvideo); var filereader = new filereader(); var file; filereader.onload = function (readerevt) { var data = filereader.result; data=data.replace("quicktime","mov"); console.log(data); //data:video/quicktime;base64,aaaafgz0 console.log(data.length); self.auctionvideo=data; self.videofile = {base64:data}; }; //filereader.reasasdataurl(audiofile); //this result in problem. file = new window.file(vfile.name, vfile.localurl, vfile.type, vfile.lastmodifieddate, vfile.size); filereader.readasdataurl(file); //this result in solution. // filereader.readasbinarystring(file); //this result in solution. }, function(error){ }, options);
Comments
Post a Comment