Hi All, Im trying video capture with device and ( recorder.prepare(); causes error and closes my application.) Can any one suggest me where im going wrong with this code.
public class VideoCapture1 extends Activity { private MediaRecorder recorder; private SurfaceHolder holder; private String filePath = "/sdcard/test1.mp4"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); startVideoCapture(); } private void startVideoCapture(){ try { SurfaceView sv = (SurfaceView)findViewById (R.id.surfaceview); holder = sv.getHolder(); holder.setType (SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); recorder = new MediaRecorder(); recorder.setAudioSource (MediaRecorder.AudioSource.MIC); recorder.setVideoSource (MediaRecorder.VideoSource.CAMERA); recorder.setOutputFormat (MediaRecorder.OutputFormat.MPEG_4); recorder.setAudioEncoder (MediaRecorder.AudioEncoder.AMR_NB); recorder.setVideoEncoder (MediaRecorder.VideoEncoder.MPEG_4_SP); /* recorder.setOutputFormat (MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder (MediaRecorder.AudioEncoder.AMR_NB); recorder.setVideoEncoder (MediaRecorder.VideoEncoder.H263); */ recorder.setOutputFile(filePath); this.setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); recorder.setPreviewDisplay(holder.getSurface()); } catch (Exception e1) { e1.printStackTrace(); } try { recorder.prepare(); } catch (IllegalStateException e) { Log.i(this.getClass().toString(),e.getMessage()); } catch (IOException e) { Log.i(this.getClass().toString(),e.getMessage()); } recorder.start(); } public void destroy(){ } } 08-19 16:21:25.763: WARN/SurfaceFlinger(62): timeout expired mFreezeDisplay=1, mFreezeCount=1 08-19 16:21:26.472: INFO/DEBUG(4410): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 08-19 16:21:26.472: INFO/DEBUG(4410): Build fingerprint: 'htc_asia_india/htc_magic/sapphire/sapphire:1.5/2.16.720.2/38755:user/ release-keys' 08-19 16:21:26.472: INFO/DEBUG(4410): pid: 4444, tid: 4444 >>> com.greatinnovus.VideoCapture1 <<< 08-19 16:21:26.472: INFO/DEBUG(4410): signal 11 (SIGSEGV), fault addr 00000018 08-19 16:21:26.472: INFO/DEBUG(4410): r0 ffffef40 r1 ffffece8 r2 41097b28 r3 00000000 08-19 16:21:26.472: INFO/DEBUG(4410): r4 437a9688 r5 ab308358 r6 0000a9c8 r7 bebee488 08-19 16:21:26.472: INFO/DEBUG(4410): r8 bebee4a8 r9 41049ce0 10 41e3e344 fp 00001070 08-19 16:21:26.472: INFO/DEBUG(4410): ip ad083e50 sp bebee480 lr ad03dcf5 pc ab305408 cpsr 80000030 08-19 16:21:26.572: INFO/DEBUG(4410): #00 pc 00005408 / system/lib/libmedia_jni.so 08-19 16:21:26.572: INFO/DEBUG(4410): #01 pc 0000e3b4 / system/lib/libdvm.so 08-19 16:21:26.582: INFO/DEBUG(4410): #02 pc 00040a8a / system/lib/libdvm.so 08-19 16:21:26.582: INFO/DEBUG(4410): #03 pc 00029430 / system/lib/libdvm.so 08-19 16:21:26.592: INFO/DEBUG(4410): #04 pc 00017610 / system/lib/libdvm.so 08-19 16:21:26.592: INFO/DEBUG(4410): #05 pc 00052268 / system/lib/libdvm.so 08-19 16:21:26.592: INFO/DEBUG(4410): #06 pc 000596ee / system/lib/libdvm.so 08-19 16:21:26.602: INFO/DEBUG(4410): #07 pc 00013118 / system/lib/libdvm.so 08-19 16:21:26.602: INFO/DEBUG(4410): #08 pc 00017b1c / system/lib/libdvm.so 08-19 16:21:26.602: INFO/DEBUG(4410): #09 pc 00017560 / system/lib/libdvm.so 08-19 16:21:26.613: INFO/DEBUG(4410): #10 pc 000520ec / system/lib/libdvm.so 08-19 16:21:26.613: INFO/DEBUG(4410): #11 pc 0003f0f8 / system/lib/libdvm.so 08-19 16:21:26.613: INFO/DEBUG(4410): #12 pc 00029600 / system/lib/libandroid_runtime.so 08-19 16:21:26.613: INFO/DEBUG(4410): #13 pc 0002a0fe / system/lib/libandroid_runtime.so 08-19 16:21:26.613: INFO/DEBUG(4410): #14 pc 00008bf2 / system/bin/app_process 08-19 16:21:26.622: INFO/DEBUG(4410): #15 pc 0001fd22 / system/lib/libc.so 08-19 16:21:26.632: INFO/DEBUG(4410): #16 pc 0000bcb2 / system/lib/libc.so 08-19 16:21:26.632: INFO/DEBUG(4410): #17 pc b000157e / system/bin/linker 08-19 16:21:26.643: INFO/DEBUG(4410): stack: 08-19 16:21:26.643: INFO/DEBUG(4410): bebee440 00000007 08-19 16:21:26.643: INFO/DEBUG(4410): bebee444 ad046ca5 /system/ lib/libdvm.so 08-19 16:21:26.643: INFO/DEBUG(4410): bebee448 0000bcc8 [heap] 08-19 16:21:26.643: INFO/DEBUG(4410): bebee44c 00000000 08-19 16:21:26.652: INFO/DEBUG(4410): bebee450 437a9220 08-19 16:21:26.652: INFO/DEBUG(4410): bebee454 ad03dcf5 /system/ lib/libdvm.so 08-19 16:21:26.652: INFO/DEBUG(4410): bebee458 ab308828 08-19 16:21:26.652: INFO/DEBUG(4410): bebee45c ad082c50 08-19 16:21:26.652: INFO/DEBUG(4410): bebee460 437a9220 08-19 16:21:26.652: INFO/DEBUG(4410): bebee464 ab30488d /system/ lib/libmedia_jni.so 08-19 16:21:26.652: INFO/DEBUG(4410): bebee468 437a9688 08-19 16:21:26.652: INFO/DEBUG(4410): bebee46c 437a9688 08-19 16:21:26.652: INFO/DEBUG(4410): bebee470 ab308358 08-19 16:21:26.663: INFO/DEBUG(4410): bebee474 0000a9c8 [heap] 08-19 16:21:26.663: INFO/DEBUG(4410): bebee478 df002777 08-19 16:21:26.663: INFO/DEBUG(4410): bebee47c e3a070ad 08-19 16:21:26.663: INFO/DEBUG(4410): #00 bebee480 00000000 08-19 16:21:26.663: INFO/DEBUG(4410): bebee484 00000000 08-19 16:21:26.663: INFO/DEBUG(4410): bebee488 00000000 08-19 16:21:26.663: INFO/DEBUG(4410): bebee48c 001b3500 [heap] 08-19 16:21:26.663: INFO/DEBUG(4410): bebee490 bebee4c8 [stack] 08-19 16:21:26.673: INFO/DEBUG(4410): bebee494 bebee4c8 [stack] 08-19 16:21:26.673: INFO/DEBUG(4410): bebee498 00000000 08-19 16:21:26.673: INFO/DEBUG(4410): bebee49c ab3053c9 /system/ lib/libmedia_jni.so 08-19 16:21:26.673: INFO/DEBUG(4410): bebee4a0 41049ce8 08-19 16:21:26.673: INFO/DEBUG(4410): bebee4a4 ad00e3b8 /system/ lib/libdvm.so 08-19 16:21:26.673: INFO/DEBUG(4410): #01 bebee4a8 4112b8b0 08-19 16:21:26.673: INFO/DEBUG(4410): bebee4ac 0000bcc8 [heap] 08-19 16:21:26.673: INFO/DEBUG(4410): bebee4b0 ab3053c9 /system/ lib/libmedia_jni.so 08-19 16:21:26.673: INFO/DEBUG(4410): bebee4b4 00000000 08-19 16:21:26.673: INFO/DEBUG(4410): bebee4b8 4112b8b0 08-19 16:21:26.673: INFO/DEBUG(4410): bebee4bc 00003ea4 08-19 16:21:26.682: INFO/DEBUG(4410): bebee4c0 bebee4c8 [stack] 08-19 16:21:26.682: INFO/DEBUG(4410): bebee4c4 ad040a8d /system/ lib/libdvm.so 08-19 16:21:27.502: INFO/DEBUG(4410): debuggerd committing suicide to free the zombie! 08-19 16:21:27.522: INFO/ActivityManager(62): Process com.greatinnovus.VideoCapture1 (pid 4444) has died. 08-19 16:21:27.543: DEBUG/Zygote(34): Process 4444 terminated by signal (11) 08-19 16:21:27.572: INFO/DEBUG(4452): debuggerd: Jun 21 2009 21:03:06 08-19 16:21:27.622: DEBUG/dalvikvm(729): GC freed 23213 objects / 563704 bytes in 451ms 08-19 16:21:27.832: DEBUG/dalvikvm(62): GC freed 5059 objects / 384944 bytes in 293ms 08-19 16:21:27.842: INFO/WindowManager(62): Setting rotation to 0, animFlags=0 08-19 16:21:27.852: INFO/WindowManager(62): Config changed: { scale=1.0 imsi=0/0 locale=en_IN touch=3 key=1/1/2 nav=3 orien=1 } 08-19 16:21:27.863: INFO/WindowManager(62): Config changed: { scale=1.0 imsi=0/0 locale=en_IN touch=3 key=1/1/2 nav=3 orien=1 } 08-19 16:21:28.043: INFO/WindowManager(62): Config changed: { scale=1.0 imsi=0/0 locale=en_IN touch=3 key=1/1/2 nav=3 orien=1 } 08-19 16:21:28.052: WARN/InputManagerService(62): Window already focused, ignoring focus gain of: com.android.internal.view.iinputmethodclient$stub$pr...@43a1df80 08-19 16:21:28.162: DEBUG/StatusBar(62): updateResources 08-19 16:21:30.652: DEBUG/dalvikvm(62): GC freed 3462 objects / 208056 bytes in 230ms 08-19 16:23:04.302: DEBUG/KeyguardViewMediator(62): screen is locked 08-19 16:23:04.312: WARN/ActivityManager(62): Unable to start service Intent { action=android.accounts.IAccountsService comp= {com.google.android.googleapps/ com.google.android.googleapps.GoogleLoginService} }: not found 08-19 16:23:04.312: ERROR/LockPatternKeyguardView(62): Failed to bind to GLS while checking for account 08-19 16:23:04.332: DEBUG/Sensors(62): sensors=00000000, real=00000000 08-19 16:23:04.423: DEBUG/SurfaceFlinger(62): About to give-up screen, flinger = 0x18e1a0 08-19 16:23:04.652: DEBUG/AKMD(39): Compass CLOSE Thanks and Regards, Steve --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---