Reputation: 569
I'm trying to pick a video from gallery in ionic / andoid using the following code, which surprisingly was working perfect in older versions of ionic
var starter = angular.module('starter', ['ionic', 'ngCordova']);
starter.controller('CameraCtrl', function($scope, $cordovaCamera) {
$scope.pickVideo = function() {
var options = {
mediaType: Camera.MediaType.VIDEO,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY
};
$cordovaCamera.getPicture(options).then(function(videoUrl) {
$scope.videoUrl = videoUrl;
alert('$scope.videoUrl: '+ videoUrl);
});
};
});
But now when I try to implement the same exact code in new ionic projects, its not working and returning empty value for videoUrl with no obvious errors. On the other hand, it works fine for picking pictures. Any suggestions, alternatives or similar issues... Plz help.
Upvotes: 0
Views: 442
Reputation: 1420
I run into the same issue. I solved this way:
ionic state reset --plugins
Then i re added the plugin
cordova plugin add cordova-plugin-camera
Then I re added the platform
sudo cordova platform add android
And started working as expected again. I had other weird issues in the past, re adding the platform in Cordova often helps
Upvotes: 1