Ionic Cordova video file for upload service -
have succeeded in making uploadvideo function ionic , cordova framework, capture new recording or pick earlier recorded video device library , upload remote service. seems $cordovacapture
or/and $cordovacamera
result in uri representation of video -on, -to , -for device itself. not file , result in upload failure. there way ionic cordova app can grab file through uri or there cordova plugin or method allow me catch video file recorded or chosen on device?
my apps record , chose video code shown below, if have , working code, prefer base answer around instead. in code videopath
holds uri file.
angular.module('myapp.controllers', []) .controller('videoctrl', function($scope, $cordovacapture, $cordovacamera){ // used cordova-video(player) // display recorded or choosen video $scope.data = { videopath: "" }; // camera capture video function $scope.capturevideo = $scope.capturevideo = function(){ var options = { quality: 50, limit: 3, duration: 15 }; $cordovacapture.capturevideo(options).then(function(videodata){ // success! video data here $scope.data.videopath = "file:/" + videodata[0].fullpath; }, function(err){ // error occurred. show message user console.log(err); }); } // choose video device photolibrary $scope.getpicture = function(sourcetype){ var options = { quality: 50, destinationtype: camera.destinationtype.file_uri, sourcetype: camera.picturesourcetype.photolibrary, mediatype:camera.mediatype.video }; $cordovacamera.getpicture(options).then(function(imagedata){ // success! video data here $scope.data.videopath = imagedata; }, function(err) { // error occurred. show message user console.log(err); }); } });
Comments
Post a Comment