c# - MediaRecorder throw java.lang.illegalstateexception at Start() -


i facing issue using mediarecorder in android xamarin. when try start or stop record exception raised :

07-15 21:06:40.984 w/system.err(13609): java.lang.illegalstateexception 07-15 21:06:41.014 w/system.err(13609):     @ android.media.mediarecorder.start(native method) 07-15 21:06:41.014 w/system.err(13609):     @ md51ef13e2ce92dda6cb40f015673d2b702.videoansweractivity.n_btntakevideo(native method) 07-15 21:06:41.014 w/system.err(13609):     @ md51ef13e2ce92dda6cb40f015673d2b702.videoansweractivity.btntakevideo(videoansweractivity.java:39) 07-15 21:06:41.014 w/system.err(13609):     @ java.lang.reflect.method.invokenative(native method) 07-15 21:06:41.014 w/system.err(13609):     @ java.lang.reflect.method.invoke(method.java:515) 07-15 21:06:41.024 w/system.err(13609):     @ android.view.view$1.onclick(view.java:3955) 07-15 21:06:41.024 w/system.err(13609):     @ android.view.view.performclick(view.java:4575) 07-15 21:06:41.024 w/system.err(13609):     @ android.view.view$performclick.run(view.java:18578) 07-15 21:06:41.024 w/system.err(13609):     @ android.os.handler.handlecallback(handler.java:733) 07-15 21:06:41.024 w/system.err(13609):     @ android.os.handler.dispatchmessage(handler.java:95) 07-15 21:06:41.024 w/system.err(13609):     @ android.os.looper.loop(looper.java:136) 07-15 21:06:41.024 w/system.err(13609):     @ android.app.activitythread.main(activitythread.java:5127) 07-15 21:06:41.024 w/system.err(13609):     @ java.lang.reflect.method.invokenative(native method) 07-15 21:06:41.024 w/system.err(13609):     @ java.lang.reflect.method.invoke(method.java:515) 07-15 21:06:41.024 w/system.err(13609):     @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:825) 07-15 21:06:41.024 w/system.err(13609):     @ com.android.internal.os.zygoteinit.main(zygoteinit.java:641) 07-15 21:06:41.024 w/system.err(13609):     @ dalvik.system.nativestart.main(native method) 

i follow xamarin tutorial record video : https://developer.xamarin.com/recipes/android/media/video/record_video/

here code start() :

                recording = true;                 recorder.setvideosource(videosource.camera);                 recorder.setaudiosource(audiosource.mic);                 recorder.setoutputformat(outputformat.default);                 recorder.setvideoencoder(videoencoder.default);                 recorder.setaudioencoder(audioencoder.default);                 recorder.setoutputfile(path);                 recorder.setpreviewdisplay(video.holder.surface);                 recorder.setmaxduration(30000);                 recorder.setorientationhint(90);                 recorder.prepare();                 try                 {                     recorder.start();                 }                 catch (illegalstateexception e)                 {                     // todo auto-generated catch block                     e.printstacktrace();                 } 

remove .reset code restarting/resetting mediarecorder , have re-initilize over.

restarts mediarecorder idle state. after calling method, have configure again if had been constructed.

ref: https://developer.xamarin.com/api/member/android.media.mediarecorder.reset()/

enter image description here


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -