我正在使用 Xamarin 的 Mono for Android。当我调用媒体记录器的准备方法时,我收到此错误:
java.io.IOException:准备失败。
这是我的代码:
record.Click += delegate {
try {
path = Android.OS.Environment.ExternalStorageDirectory.Name + "/" + etVideoName.Text + ".mp4";
video.StopPlayback ();
recorder = new MediaRecorder ();
recorder.SetVideoSource (VideoSource.Camera);
recorder.SetAudioSource (AudioSource.Mic);
recorder.SetOutputFormat (OutputFormat.Mpeg4);
recorder.SetVideoEncoder (VideoEncoder.Default);
recorder.SetAudioEncoder (AudioEncoder.Default);
recorder.SetOutputFile (path);
//recorder.SetPreviewDisplay (video.Holder.Surface);
recorder.Prepare ();
recorder.Start ();
} catch (Exception ex) {
MakeAlert("Error", ex.ToString());
}
};