How to choose video from gallery in phone?

Please help me how to select only video from the gallery in android and iOS in Cordova. I tried this click Here to select the video from the media, but it does not work for me ...

var pictureSource; var destinationType; var mediaType; document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { pictureSource = navigator.camera.PictureSourceType; destinationType = navigator.camera.DestinationType; mediaType = navigator.camera.MediaType; } navigator.camera.getPicture(onPhotoURISuccess, onFail, { destinationType: destinationType.FILE_URI, mediaType: mediaType.VIDEO, sourceType: source }); function onPhotoURISuccess(imageURI) { console.log(imageURI); } function onFail(message) { console.log(message); } 

I use the same code for implementation in my application, but it cannot come ....

+7
android ios video cordova phonegap-plugins
source share
1 answer

You can try the snippet below:

 navigator.camera.getPicture(onSuccess, onFail, { quality: 100, destinationType: Camera.DestinationType.FILE_URI, sourceType: Camera.PictureSourceType.PHOTOLIBRARY, mediaType: Camera.MediaType.VIDEO }); 

Not that mediaType could be:

 Camera.MediaType = { PICTURE: 0, // allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType VIDEO: 1, // allow selection of video only, WILL ALWAYS RETURN FILE_URI ALLMEDIA : 2 // allow selection from all media types 

For reference, read this .

+4
source share

All Articles