android - Progress while recording audio -


i trying make progress bar , react while record sound. mean while record on , there sound progress bar have move. dont know how should call using in audio players show music playing. hope know mean.

i recording sound code:

                recorder = new mediarecorder();                 recorder.setaudiosource(mediarecorder.audiosource.voice_recognition);                 recorder.setoutputformat(mediarecorder.outputformat.three_gpp);                              recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb);                 recorder.setoutputfile(outputfile); 

use getmaxamplitude().

call method multiple times delay , need.

here's implementation using rxjava:

mtimersubscription = observable.interval(100, timeunit.milliseconds)         .observeon(androidschedulers.mainthread())         .subscribe(along -> {             // evey 100 milliseconds method called             int amplitude = mrecorder.getmaxamplitude();             logwrapper.d(tag, "amplitude: " + amplitude + " rms " + (int) math.sqrt(amplitude));             msoundprogressbar.setprogress((int) math.sqrt(amplitude));         }); 

you can using handler.postdelayed.


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -