How to open video picker view or gallery in ionic?


#1

Currently I can open image picker using $cordovaImagePicker, but also I want to open video picker for picking the video from gallery/ video gallery.

How can I achieve above task/ thing?

Currently there is no any plugin for picking videos. And html input type=file is open the Mobile Gallery but it’s not provide the file path. Is there another way for this?


[TUTORIAL] Here are solutions to few common problems I encountered
#2

Yo can use the Camera plugin org.apache.cordova.camera and use this options for select a video from the gallery (Tested in Android):

var options = {
quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
mediaType:Camera.MediaType.VIDEO

};

$cordovaCamera.getPicture(options).then( …


#3

Hi all i am also getting the same problem as i am trying to access the video path using $cordovaCamera plugin, here is my code:-

$scope.getVideoPath = function(){
var options = {
quality: 50,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
mediaType:Camera.MediaType.VIDEO
};
$cordovaCamera.getPicture(options).then(function(videoURI) {
console.log(“videoURI”,JSON.stringify(videoURI));
console.log(“videoURI”,videoURI.toURI());
}, function(err) {
console.log(“err”,JSON.stringify(err));
});
}

I am getting both the log blank


#4
$scope.getVideoPath = function(){
      var options = {
        quality: 50,
         destinationType: Camera.DestinationType.FILE_URI, // <== try THIS
         sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
        mediaType:Camera.MediaType.VIDEO
    };

    $cordovaCamera.getPicture(options).then(function(videoURI) {
        console.log("videoURI",JSON.stringify(videoURI));
        console.log("videoURI",videoURI.toURI());
    }, function(err) {
        console.log("err",JSON.stringify(err));
    });
}

someone suggested it above… is it not working?


#5

@aaronksaunders no its not going to work with
destinationType: Camera.DestinationType.FILE_URI

showing the same blank log.
log videoURI, “”


#6

this we just release a production app for a client using that in our code… would need to see more of your application to understand why you are running into issues. Sorry couldn’t help more


#7

@aaronksaunders it true in case of Image only that is:-
quality: 50, destinationType: Camera.DestinationType.FILE_URI, sourceType: Camera.PictureSourceType.PHOTOLIBRARY, mediaType:Camera.MediaType.SAVEDPHOTOALBUM OR mediaType:Camera.MediaType.PHOTOLIBRARY <== seee this

Log in case of Image :- videoURI, “content://media/external/images/media/31249”

Log in case of Video :- videoURI, “”


#8

@PradeepGill are you able to solve this ? facing the same issue


#9

any one find solution?