I am developing audio player in android. So i want to add the details of the playing song i.e. Artist Name, Duration, Bit rate and sampling frequency. I can get Artist Name
I know it's been resolved but i got much better way to get accurate answer
MediaExtractor mex = new MediaExtractor();
try {
mex.setDataSource(path);// the adresss location of the sound on sdcard.
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MediaFormat mf = mex.getTrackFormat(0);
int bitRate = mf.getInteger(MediaFormat.KEY_BIT_RATE);
int sampleRate = mf.getInteger(MediaFormat.KEY_SAMPLE_RATE);