From 88b58944bdd3895ce9e05b730812dd39aa9c277f Mon Sep 17 00:00:00 2001 From: zher52 Date: Mon, 1 Nov 2021 11:51:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A2=84=E8=A7=88=E9=97=AA?= =?UTF-8?q?=E9=80=80=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/android/MediaRecorderActivity.java | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/android/MediaRecorderActivity.java b/src/android/MediaRecorderActivity.java index 5d6fb03..d8b6bbb 100644 --- a/src/android/MediaRecorderActivity.java +++ b/src/android/MediaRecorderActivity.java @@ -275,17 +275,7 @@ public class MediaRecorderActivity extends Activity implements } } - private void setStopUI() { - mCameraSwitch.setEnabled(true); - mRecordLed.setEnabled(true); - } - - private void setPreviewUI() throws IOException { - File file = new File(mMediaObject.getOutputTempTranscodingVideoPath()); - if(!file.exists() || file.length() == 0){ - Toast.makeText(this,"录制失败",3000).show(); - return; - } + private void setPreviewUI(){ mMediaRecorder.stopPreview(); mCameraSwitch.setVisibility(View.INVISIBLE); mRecordLed.setVisibility(View.INVISIBLE); @@ -294,7 +284,14 @@ public class MediaRecorderActivity extends Activity implements redoButton.setVisibility(View.VISIBLE); okButton.setVisibility(View.VISIBLE); + } + private void preview() throws IOException { + File file = new File(mMediaObject.getOutputTempTranscodingVideoPath()); + if(!file.exists() || file.length() == 0){ + Toast.makeText(this,"录制失败",3000).show(); + return; + } if(mPlayer == null){ mPlayer = new MediaPlayer(); mPlayer.setOnCompletionListener(this); @@ -325,6 +322,9 @@ public class MediaRecorderActivity extends Activity implements private void redo(){ + mCameraSwitch.setEnabled(true); + mRecordLed.setEnabled(true); + MediaObject.MediaPart part = mMediaObject.getCurrentPart(); if (part != null) { if (part.remove) { @@ -439,7 +439,7 @@ public class MediaRecorderActivity extends Activity implements this.completed = true; Log.d("onEncodeComplete"); try { - setPreviewUI(); + preview(); } catch (IOException e) { e.printStackTrace(); } @@ -514,7 +514,7 @@ public class MediaRecorderActivity extends Activity implements Log.d("onRecordFinishedListener:拍摄完成"); startState = false; stopRecord(); - this.mRecordController.setVisibility(View.INVISIBLE); + setPreviewUI(); } @Override