i want to get bitRate, sampleRate,channelCount of one audio file
i use code
@SuppressLint("NewApi")
public void GetSampleRate(String path)
{
MediaExtractor mex = new MediaExtractor();
try {
mex.setDataSource(new File(path).getAbsolutePath());// the adresss location of the sound on sdcard.
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MediaFormat mf = mex.getTrackFormat(0);
bitRate = mf.getInteger(MediaFormat.KEY_BIT_RATE);
sampleRate = mf.getInteger(MediaFormat.KEY_SAMPLE_RATE);
channelCount = mf.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
}
But when compiler come on this line
mex.setDataSource(new File(path).getAbsolutePath());
logcat show one error
10-13 12:57:52.772: E/WVMExtractor(9554): Failed to open libwvm.so: dlopen failed: library "libwvm.so" not found
and then this error when i try to get bitRate, sampleRate,channelCount.
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference