In fact, you do not have to have empty catch blocks, you can get an explanation for this error, but you just ignore it, try the following:
try {
mMediaPlayer.setDataSource(mAudioFile.getPath());
mMediaPlayer.prepare();
} catch (IllegalArgumentException e) {
Log.e(TAG, "mMediaPlayer IllegalArgumentException " ,e);
return false;
} catch (IOException e) {
Log.e(TAG, "mMediaPlayer IOException" ,e);
return false;
}
source
share