try {
mRecorder.prepare();//预期准备
Log.i(TAG, "recorder.prepare()" );
} catch (IllegalStateException e) {
// TODO Auto-generated catch block
Log.i(TAG,e.getMessage());
e.printStackTrace();
return false;
} catch (IOException e) {
// TODO Auto-generated catch block
Log.i(TAG,e.getMessage());
e.printStackTrace();
return false;
}
try{
mRecorder.start(); //开始刻录
}catch (IllegalStateException e) {
// TODO Auto-generated catch block
Log.i(TAG,e.getMessage());
e.printStackTrace();
return false;
}
I'm not very familiar with java, do not know if there are any problems using exceptions? When a process re-recording, another process starts, I want mic status, similar getStatuse () function of the class, do you have any good way? Thank you!
error message as follows:
04-26 02:23:59.241: E / MediaRecorder (3197): start failed: -1
04-26 02:23:59.251: D / AndroidRuntime (3197): Shutting down VM
04-26 02:23:59.251: W / dalvikvm (3197): threadid = 1: thread exiting with uncaught exception (group = 0x4001d800)
04-26 02:23:59.462: E / AndroidRuntime (3197): FATAL EXCEPTION: main
04-26 02:23:59.462: E / AndroidRuntime (3197): java.lang.RuntimeException: Error receiving broadcast Intent {act = android.provider. Telephony.SMS_RECEIVED (has extras)} in com.TS.SnsReceiver @ 44ef9be0
04-26 02:23:59.462: E / AndroidRuntime (3197): at android.app.ActivityThread $ PackageInfo $ ReceiverDispatcher $ Args.run (ActivityThread.java: 905)
04-26 02:23:59.462: E / AndroidRuntime (3197): at android.os.Handler.handleCallback (Handler.java: 587)
04-26 02:23:59.462: E / AndroidRuntime (3197): at android.os.Handler.dispatchMessage (Handler.java: 92)
04-26 02:23:59.462: E / AndroidRuntime (3197): at android.os.Looper.loop (Looper.java: 123)
04-26 02:23:59.462: E / AndroidRuntime (3197): at android.app.ActivityThread.main (ActivityThread.java: 4627)
04-26 02:23:59.462: E / AndroidRuntime (3197): at java.lang.reflect.Method.invokeNative (Native Method)
04-26 02:23:59.462: E / AndroidRuntime (3197): at java.lang.reflect.Method.invoke (Method.java: 521)
04-26 02:23:59.462: E / AndroidRuntime (3197): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java: 868)
04-26 02:23:59.462: E / AndroidRuntime (3197): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java: 626)
04-26 02:23:59.462: E / AndroidRuntime (3197): at dalvik.system.NativeStart.main (Native Method)
04-26 02:23:59.462: E / AndroidRuntime (3197): Caused by: java.lang.RuntimeException: start failed.
04-26 02:23:59.462: E / AndroidRuntime (3197): at android.media.MediaRecorder.start (Native Method)
04-26 02:23:59.462: E / AndroidRuntime (3197): at com.TS.RcdMediaCtrl.StartRecord (RcdMediaCtrl.java: 70)
04-26 02:23:59.462: E / AndroidRuntime (3197): at com.TS.SnsReceiver.onReceive (SnsReceiver.java: 53)
04-26 02:23:59.462: E / AndroidRuntime (3197): at android.app.ActivityThread $ PackageInfo $ ReceiverDispatcher $ Args.run (ActivityThread.java: 892)
------ Solution ------------------------------------------- -
Audiorecoder arguably should be able to support multiple. Only the data from the audiofliger in multi turn out a copy, you can do samplerate conversion. audiotrack can have multiple simultaneously send data to audiofliger, this idea should also be on the recorder Reverse feasible.
------ Solution ---------------------------------------- ----
I also tangled this problem ah
------ Solution --------------------------- -----------------
this argument in the Android technical documentation has yet to determine what? !
public void start ()
Since: API Level 1 Begins capturing and encoding data to the file specified with setOutputFile (). Call this after prepare ().
Since API level 13, if applications set a camera via setCamera (Camera), the apps can use the camera after this method ; call. The apps do not need to lock the camera again. However, if this method fails, the apps should still lock ; the camera back. The apps should not start another recording session during recording.
------ Solution ------------------------------------ --------
like recording resources can not be used simultaneously, even after use release, other functional modules can be used.
------ reference --------------------------------------- < br> like android can not directly use shared memory, message queues, and so the process of communication, using AIDL feel complex and is not necessary, it is best to get the MIC state before recording can prompt "device is in use!", we see how ? Welcome to QQ group 48786483 discussed.
------ reference --------------------------------------- < br> up!
------ reference --------------------------------------- < br> up!
------ reference --------------------------------------- < br> Thank you upstairs reply, I saw MediaRecorder source, without these options, and most are calling native package, I was under the framework of the source, I do not know if I can find some options.
------ reference --------------------------------------- < br> continue to wait for master it
------ reference ---------------------------------- -----
------ reference ------------------------------------ ---
camera not to be reused, but the mic should be, because the call recording can be achieved. No matter can not be reused, I was trying to get device status information, like getDeviceStatus () function of the class, I still have not found.
------ reference --------------------------------------- < br> Thank you for your help, I was through their own program logic control bar
------ reference ------------------------ ---------------
how to solve this problem. . . Members. .
------ reference --------------------------------------- < br> with AudioRecorder record a time to look at the success to judge.
没有评论:
发表评论