void startStopPushed(object sender, EventArgs ea) { if (!weAreRecording) { var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var library = System.IO.Path.Combine(documents, "..", "Library"); var urlpath = System.IO.Path.Combine(library, "sweetMovieFilm.mov"); NSUrl url = new NSUrl(urlpath, false); NSFileManager manager = new NSFileManager(); NSError error = new NSError(); if (manager.FileExists(urlpath)) { Console.WriteLine("Deleting File"); manager.Remove(urlpath, out error); Console.WriteLine("Deleted File"); } AVCaptureFileOutputRecordingDelegate avDel = new AVCaptureFileOutputRecordingDelegate(); output.StartRecordingToOutputFile(url, avDel); Console.WriteLine(urlpath); weAreRecording = true; btnStartRecording.SetTitle("Stop Recording", UIControlState.Normal); } //we were already recording. Stop recording else { output.StopRecording(); Console.WriteLine("stopped recording"); weAreRecording = false; btnStartRecording.SetTitle("Start Recording", UIControlState.Normal); } }
void startStopPushed(object sender, EventArgs ea) { if (!weAreRecording) { var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments); var library = System.IO.Path.Combine (documents, "..", "Library"); var urlpath = System.IO.Path.Combine (library, "sweetMovieFilm.mov"); NSUrl url = new NSUrl (urlpath, false); NSFileManager manager = new NSFileManager (); NSError error = new NSError (); if (manager.FileExists (urlpath)) { Console.WriteLine ("Deleting File"); manager.Remove (urlpath, out error); Console.WriteLine ("Deleted File"); } AVCaptureFileOutputRecordingDelegate avDel= new AVCaptureFileOutputRecordingDelegate (); output.StartRecordingToOutputFile(url, avDel); Console.WriteLine (urlpath); weAreRecording = true; btnStartRecording.SetTitle("Stop Recording", UIControlState.Normal); } //we were already recording. Stop recording else { output.StopRecording (); Console.WriteLine ("stopped recording"); weAreRecording = false; btnStartRecording.SetTitle("Start Recording", UIControlState.Normal); } }
private void startStopPushed (Object sender, EventArgs ea) { if (!weAreRecording) { deleteVideo (videoPath); AVCaptureFileOutputRecordingDelegate avDel = new AVCaptureFileOutputRecordingDelegate (); output.StartRecordingToOutputFile (videoLocation, avDel); btnRecord.SetImage (UIImage.FromFile("btn_done_recording.png"), UIControlState.Normal); btnPlayVideo.Hidden = true; weAreRecording = true; } else { output.StopRecording (); weAreRecording = false; btnRecord.SetImage (UIImage.FromFile("btn_Start_recording.png"), UIControlState.Normal); btnPlayVideo.Hidden = false; } }