修复预览闪退的问题
This commit is contained in:
parent
f0440075dd
commit
88b58944bd
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user