我一直在尝试录制视频,但一直不成功。我的代码已编译,但在运行时崩溃了。有谁知道如何在不改变屏幕视图的情况下录制视频吗?谢谢。
recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setVideoEncoder(MediaRecorder.VideoEncoder.MPEG_4_SP);
recorder.setMaxDuration(15000); // 15 seconds
recorder.setMaxFileSize(5000000); // Approximately 5 megabytes
recorder.setOutputFile("/sdcard/xxxxx.mp4");
recorder.start();