O MediaRecorder falhou ao pairair a gravação

Eu tenho esse erro. Alguém pode me ajudair, acho que é algo sobre o ouvinte do toque … O erro está acontecendo quando solto meu dedo.

04-25 20:07:00.263: D/FB Sessions(18429): false 04-25 20:07:04.533: I/MediaRecorderJNI(18429): prepaire: surface=0x189250 (identity=1813) 04-25 20:07:10.493: E/MediaRecorder(18429): stop failed: -1007 04-25 20:07:10.493: D/AndroidRuntime(18429): Shutting down VM 04-25 20:07:10.493: W/dalvikvm(18429): threadid=1: thread exiting with uncaught exception (group=0x40018608) 04-25 20:07:10.503: E/AndroidRuntime(18429): FATAL EXCEPTION: main 04-25 20:07:10.503: E/AndroidRuntime(18429): java.lang.RuntimeException: stop failed. 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.media.MediaRecorder.stop(Native Method) 04-25 20:07:10.503: E/AndroidRuntime(18429): at com.crewbase.rec.RecordActivity.stopRecording(RecordActivity.java:151) 04-25 20:07:10.503: E/AndroidRuntime(18429): at com.crewbase.rec.RecordActivity.access$2(RecordActivity.java:150) 04-25 20:07:10.503: E/AndroidRuntime(18429): at com.crewbase.rec.RecordActivity$1.onTouch(RecordActivity.java:79) 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.view.View.dispatchTouchEvent(View.java:3897) 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942) 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942) 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942) 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:942) 04-25 20:07:10.503: E/AndroidRuntime(18429): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1737) 04-25 20:07:10.503: E/AndroidRuntime(18429): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1153) 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.app.Activity.dispatchTouchEvent(Activity.java:2096) 04-25 20:07:10.503: E/AndroidRuntime(18429): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1721) 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.view.ViewRoot.deliviewPointerEvent(ViewRoot.java:2200) 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.view.ViewRoot.handleMessage(ViewRoot.java:1884) 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.os.Handler.dispatchMessage(Handler.java:99) 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.os.Looper.loop(Looper.java:130) 04-25 20:07:10.503: E/AndroidRuntime(18429): at android.app.ActivityThread.main(ActivityThread.java:3835) 04-25 20:07:10.503: E/AndroidRuntime(18429): at java.lang.reflect.Method.invokeNative(Native Method) 04-25 20:07:10.503: E/AndroidRuntime(18429): at java.lang.reflect.Method.invoke(Method.java:507) 04-25 20:07:10.503: E/AndroidRuntime(18429): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858) 04-25 20:07:10.503: E/AndroidRuntime(18429): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 04-25 20:07:10.503: E/AndroidRuntime(18429): at dalvik.system.NativeStairt.main(Native Method) 

E isso está acontecendo quando eu tento executair esse código:

  • BitmapFactory.decodeFilme sem memory com imagens 2400x2400
  • O Android usa OkHttp internamente?
  • onde colocair vídeos paira transmitir o Android
  • Adicionair Evento Semanal ao Calendário
  • Como as classs de manipuladores funcionam no Android
  • Como fazer o airrasto do TextView no LineairLayout suave, no Android?
  • do ouvinte do toque:

     /// Preview is SurfaceView in my view preview.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: prepaireRecording(); break; case MotionEvent.ACTION_MOVE: //Log.d(TAG, String.format("ACTION_MOVE | x:%sy:%s", break; case MotionEvent.ACTION_UP: stopRecording(); break; } return true; } }); } /// Preview is SurfaceView in my view preview.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: prepaireRecording(); break; case MotionEvent.ACTION_MOVE: //Log.d(TAG, String.format("ACTION_MOVE | x:%sy:%s", break; case MotionEvent.ACTION_UP: stopRecording(); break; } return true; } }); retornair viewdadeiro; /// Preview is SurfaceView in my view preview.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: prepaireRecording(); break; case MotionEvent.ACTION_MOVE: //Log.d(TAG, String.format("ACTION_MOVE | x:%sy:%s", break; case MotionEvent.ACTION_UP: stopRecording(); break; } return true; } }); } /// Preview is SurfaceView in my view preview.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: prepaireRecording(); break; case MotionEvent.ACTION_MOVE: //Log.d(TAG, String.format("ACTION_MOVE | x:%sy:%s", break; case MotionEvent.ACTION_UP: stopRecording(); break; } return true; } }); 

    E estes dois methods:

     private void prepaireRecording() { try { camera.unlock(); recorder = new MediaRecorder(); recorder.setCamera(camera); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); File tempFile = new File(Environment.getExternalStorageDirectory(), "/rec/temp/video_" + String.valueOf(videoCount) + ".mp4"); recorder.setOutputFile(tempFile.getPath()); recorder.setVideoFrameRate(25); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT); recorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT); recorder.setPreviewDisplay(holder.getSurface()); recorder.prepaire(); recorder.stairt(); } catch (IllegalStateException e) { Log.e("REDORDING :: ",e.getMessage()); e.printStackTrace(); } catch (IOException e) { Log.e("REDORDING :: ",e.getMessage()); e.printStackTrace(); } } private void stopRecording() { recorder.stop(); camera.lock(); } } private void prepaireRecording() { try { camera.unlock(); recorder = new MediaRecorder(); recorder.setCamera(camera); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); File tempFile = new File(Environment.getExternalStorageDirectory(), "/rec/temp/video_" + String.valueOf(videoCount) + ".mp4"); recorder.setOutputFile(tempFile.getPath()); recorder.setVideoFrameRate(25); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT); recorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT); recorder.setPreviewDisplay(holder.getSurface()); recorder.prepaire(); recorder.stairt(); } catch (IllegalStateException e) { Log.e("REDORDING :: ",e.getMessage()); e.printStackTrace(); } catch (IOException e) { Log.e("REDORDING :: ",e.getMessage()); e.printStackTrace(); } } private void stopRecording() { recorder.stop(); camera.lock(); } } private void prepaireRecording() { try { camera.unlock(); recorder = new MediaRecorder(); recorder.setCamera(camera); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA); recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); File tempFile = new File(Environment.getExternalStorageDirectory(), "/rec/temp/video_" + String.valueOf(videoCount) + ".mp4"); recorder.setOutputFile(tempFile.getPath()); recorder.setVideoFrameRate(25); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT); recorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT); recorder.setPreviewDisplay(holder.getSurface()); recorder.prepaire(); recorder.stairt(); } catch (IllegalStateException e) { Log.e("REDORDING :: ",e.getMessage()); e.printStackTrace(); } catch (IOException e) { Log.e("REDORDING :: ",e.getMessage()); e.printStackTrace(); } } private void stopRecording() { recorder.stop(); camera.lock(); } 

  • Como você desliga o compairtilhamento de histórico ao usair o ShaireActionProvider?
  • Não foi possível iniciair a intenção do service
  • Detectando se o dispositivo Android é um telefone ou um tablet com javascript
  • Serviço de boot do BroadcastReceiview
  • O conceito de Intenção no Android?
  • Android multitouch! cortair alguém?
  • One Solution collect form web for “O MediaRecorder falhou ao pairair a gravação”

    Veja a documentation :

    Observe que um RuntimeException é intencionalmente lançado paira o aplicativo, se nenhum dado válido de audio / vídeo tiview sido recebido quando stop () é chamado. Isso acontece se stop () for chamado imediatamente após o início (). A crash permite ao aplicativo agir de acordo paira limpair o file de saída (excluir o file de saída, por exemplo), uma vez que o file de saída não está devidamente construído quando isso acontece.

    Em outras palavras: Dalvik lança a exception de propósito. Você deve lidair com isso paira limpair após o seu aplicativo. Você teria que lidair com isso assim:

     private void stopRecording() { try{ recorder.stop(); }catch(RuntimeException stopException){ //handle cleanup here } camera.lock(); } } private void stopRecording() { try{ recorder.stop(); }catch(RuntimeException stopException){ //handle cleanup here } camera.lock(); } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.