8

I am developing an audio recording application in Android 2.3 using MediaRecorder class. I have the following requirement :

  1. When an interruption occurs , say during recording a call , pause recording .
  2. After the interruption is over and onResume of my recording activity is called , I have to resume recording from the point where it was paused .

I could not find a MediaRecorder api to pause and resume recording. Only start() and stop() are available.
Apart from recording two separate files before and after interruption and then joining them together into one file, is there any other way to achieve this?

Sneha John.

FSDford
  • 448
  • 5
  • 10
Sneha John
  • 81
  • 1
  • 3
  • The bigger problem I see here is that the microphone is muted when you make an outgoing phone call during audio recording, even if you try to stop audio recording when you receive a broadcast for an outgoing phone call. – Sney Nov 14 '11 at 16:50
  • As I know from java sound manangement library, start and stop might actually be start and pause. The stop function is achieved through pause and rewind, or setPosition. – Andrei B. Apr 04 '12 at 16:03
  • Did u get any solution? mediaRecorder.pause() and mediaRecorder.resume() works on api version27 and more – jyomin May 01 '19 at 17:09

1 Answers1

0

There are two possible ways to do this task, if u are using media recorder for the recording than you can append one audio file into another, Like when you got a incoming call than automatically your on pause is called and on your onPause() you can recorde that 1st file, when you comes back again on your activity than you can record a temporary fileResume() and append this temporary file into the previous one.

And another way is using AudioRecorder() class. In that you can record audio as raw file and append those files as per your requirement and finally when you want to stop the recording than add a header into that raw file and convert that into your desired audio format.

wattostudios
  • 8,666
  • 13
  • 43
  • 57
Ravinder
  • 539
  • 1
  • 4
  • 4