hi everyone,
i am developing an application were i have record a voice and send 2 server
i tried the below code but i am getting error can anyone hlp me please
error:
12-09 07:39:06.272: ERROR/audio_input(34): unsupported parameter:
x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
12-09 07:39:06.272: ERROR/audio_input(34): VerifyAndSetParameter failed
12-09 07:39:06.772: ERROR/PVOMXEncNode(34):
PVMFOMXEncNode-Audio_AMRNB::DoPrepare(): Got Component OMX.PV.amrencnb
handle
12-09 07:39:06.772: ERROR/PVOMXEncNode(34):
PVMFOMXEncNode-Audio_AMRNB::DoPrepare(): Got Component OMX.PV.amrencnb
handle
here is my code
public class AudioRecorder {
MediaRecorder recorder = new MediaRecorder();
final String path;
public AudioRecorder(String path) {
this.path = sanitizePath(path);
}
private String sanitizePath(String path) {
if (!path.startsWith("/")) {
path = "/" + path;
}
if (!path.contains(".")) {
path += ".3gp";
}
return
Environment.getExternalStorageDirectory().getAbsolutePath() + path;
}
public void start() throws IOException {
String state = android.os.Environment.getExternalStorageState();
if(!state.equals(android.os.Environment.MEDIA_MOUNTED)) {
throw new IOException("SD Card is not mounted. It is " +
state + ".");
}
// make sure the directory we plan to store the recording in
exists
File directory = new File(path).getParentFile();
if (!directory.exists() && !directory.mkdirs()) {
throw new IOException("Path to file could not be created.");
}
try{
System.out.println("starting audio ");
recorder.setAudioSource(AudioSource.MIC);
Log.v("audio source", ""+AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
Log.v("Output
format",""+MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
Log.v("Audio encoder
",MediaRecorder.AudioEncoder.AMR_NB+"");
recorder.setOutputFile(path);
Log.v("Path ",path);
// recorder.setAudioSource(AudioSource.MIC);
recorder.prepare();
recorder.start();
Thread.sleep(6000);
}
catch(Exception e){
e.printStackTrace();
}
}
public void stop() throws IOException {
recorder.stop();
recorder.release();
}
}
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.message);
record=(Button)findViewById(R.id.record);//record button
record.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
final AudioRecorder recorder = new
AudioRecorder("/res/raw");
try {
recorder.start();
} catch (IOException e) {
e.printStackTrace();
}
}
});
stop=(Button)findViewById(R.id.stop);//Stop button
stop.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
recorder.stop();
//recorder.release();
}
});
i have 3 buttons to record ,stop and play please anyone can help me
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en