I was basically looking for a cordova plugin which'll allow me to navigate through device files and choose any audio file. I failed to find one that does exactly that so I 'm writing my own, currently focusing on android.
So I'm looking for way to create an audio file chooser for android with the possibility of limiting the file size. What I've tried so far is:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("audio/*");
String[] mimetypes = {"audio/3gp", "audio/AMR", "audio/mp3"};
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
Intent chooser = Intent.createChooser(intent, "Select File");
cordova.startActivityForResult(this, chooser, 1);
A few problems with this one, first the file type is not limited. I've tried this one amongst others to limit the display of only audio files, but I either get just mp3 files (with "audio/*") or all of them with and other combination.
Second I have no clue how to limit the size of displayed files. I thought about calculating the size once the file has been selected by the user and notifying him in case it's bigger than the allowed size. But I would really like to keep it as a last solution and see if it's possible to display files responding to size criteria.
Thanks in advance for pointing me in the right direction or telling me if it's not possible at all.