Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know whether a MediaRecorder is in running state or not?

I wrote a code to record audio of call conversation using MediaRecorder.

how can i know whether a MediaRecorder is in running state or not, to stop the recording. like

boolean running;
MediaRecorder mr;
//what should i assign to running?        
if(running){
   mr.stop()
}

Above code is just an example.. If you do not understand my question, please tell me.. i will explain clearly with actual code..

What all i want to know is "In which state the MediaRecorder is?" -> recording/released/prepared/initial/etc..

like image 270
manidhar mulaparthi Avatar asked Aug 11 '10 13:08

manidhar mulaparthi


People also ask

Does Safari support MediaRecorder?

MediaRecorder API is Not Supported on Safari 13, which means that any user who'd be accessing your page through Safari 13 can see it perfectly.

What is MediaRecorder?

android.media.MediaRecorder. Used to record audio and video. The recording control is based on a simple state machine (see below).

What is MediaRecorder API?

The MediaRecorder interface of the MediaStream Recording API provides functionality to easily record media. It is created using the MediaRecorder() constructor.


1 Answers

You cannot get the state directly, see the open enhancement request at http://code.google.com/p/android/issues/detail?id=800

You need to set a variable manually in the listeners when the mediaplayer reaches a certain state in order to remember the current state.

Also this this discussion: http://www.mail-archive.com/[email protected]/msg35320.html

like image 118
Mathias Conradt Avatar answered Nov 02 '22 17:11

Mathias Conradt