• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Playing recorded audio

jon21569

Newbie
Aug 10, 2008
23
7
On the G1 I am attempting to play audio that has been recorded.

Here is the code I am using to record audio.

///////////
m_recorder = new MediaRecorder();
m_recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
m_recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
m_recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
m_canvas.m_context.getFilesDir().mkdirs();
String path = m_context.getFilesDir() + "/recorded.amr";
m_recorder.setOutputFile(path);
m_recorder.prepare();
m_recorder.start();
m_iRecordState = kRecordState_Recording;
////////////

I have tried several ways of playing the recorded audio, but so far without success. Here are various ways I have attempted to play the audio.

/////////
Uri uri = Uri.fromFile(getFileStreamPath("recorded.amr") );
m_mediaPlayer = MediaPlayer.create( m_context, uri );
m_mediaPlayer.start();
//////////
Uri uri = Uri.fromFile(getFileStreamPath(m_context.getFilesDir() + "recorded.amr") );
m_mediaPlayer = MediaPlayer.create(m_context, uri );
m_mediaPlayer.start();
///////////
String path = m_context.getFilesDir() + "/recorded.amr";
m_mediaPlayer.setDataSource(path);
m_mediaPlayer.prepare();
m_mediaPlayer.start();
///////////

Has anyone had success playing recorded audio?
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones