I'm trying to record short audio files in android, and after play them using file path. I'm followed this code.
But I'm face next problem on method mRecorder.setOutputFile(mFileName);
Failed to open file '/storage/emulated/0/pronouncing2017-11-07 18:20:19.800.3gp'. (No such file or directory)
and after:
11-07 18:20:27.356 11327-11344/com.apps.vmg.mynewdictionary E/MediaPlayer: error (1, -2147483648)
11-07 18:20:27.357 11327-11327/com.apps.vmg.mynewdictionary E/Add_Word_Activity: prepare() failed
Using file manager device , i found this file and compare actual path with mFileName and they are equal
I'm found what cause this error. I have method:
private File getOutputFile() {
return new File(Environment.getExternalStorageDirectory().getAbsolutePath() +
"/pronouncing" +
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())
+ ".3gp");
}
But this way , it's works :
private File getOutputFile() {
return new File(Environment.getExternalStorageDirectory().getAbsolutePath() +
"/pronouncing" + "word"
// new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())
+ ".3gp");
}
Soo , now I'm sure that Media player can't read file which in name include date with format "yyyy-MM-dd HH:mm:ss.SSS".
With format "yyyy-MM-dd-hh.mm.ss" all works fine