How to get mime type in Cordoba getPicture

I am trying to get the mime type of a selected video or image from a photo library. I can specify the encoding format of the image, but not the video. So, when I select a video or picture, I do not have an extension to the success function, I have a way similar to this: content:://media/external/images/media/58 .

Then, how can I get the mime type of both sources (video and image) using JavaScript and Cordoba?

Code

 navigator.camera.getPicture(drawImage, errorFunction, { quality: 50, mediaType: navigator.camera.MediaType.ALLMEDIA, destinationType: navigator.camera.DestinationType.FILE_URI, encodingType: navigator.camera.EncodingType.PNG, sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY }); var drawImage = function(image) { if (typeof image !== "undefined") { $("#uploadMedia").append("<img src='" + image + "' width='200' height='200'>"); } }; 
+5
source share

Source: https://habr.com/ru/post/1235531/


All Articles