Android audio capture -


i'm following this article capture audio on android. thought easy, there's problem. here's code:

    file dir = activity.getdir("recordings", context.mode_private);     file file = new file(dir, "testaudio.mpeg4");      fileutil fileutil = new fileutil();     file parent = file.getparentfile();      if(!parent.exists()){         log.i(tag, "creating non-existent path:" + parent.getabsolutepath());         parent.mkdirs();     }       recorder = new mediarecorder();     recorder.setaudiosource(mediarecorder.audiosource.mic);     recorder.setoutputformat(mediarecorder.outputformat.mpeg_4);     recorder.setaudioencoder(mediarecorder.audioencoder.default);          try{             recorder.setoutputfile(file.getabsolutepath());             recorder.prepare();             recorder.start();         }catch(ioexception e){         //more code         } 

so, create testaudio.mpeg4 file under /data/data/com.myapp/app_recordings/ folder. but, after transferring file mac (using adb pull) doesn't play. on mac , i've tried few audio formats (e.g. mp3, mpeg, 3gp etc.) nothing seems working. help/guidance appreciated.

use this

file dir = new file(environment             .getexternalstoragedirectory().getabsolutepath() + "/recording/"); 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -