예제 #1
0
        public void CaptureMovie()
        {
            //start recording

            if (!isRecording && CameraMode == CameraModes.Video)
            {
                var outputUrl = ApplicationDocumentsDirectory().Append($"Video_{DateTime.Now.ToString("yyMMdd_hhmmss")}", false).AppendPathExtension("mov");
                VideoFileUrl = outputUrl.AbsoluteString;
                // string localFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
                // var localPath = System.IO.Path.Combine(localFolder, $"Video_{DateTime.Now.ToString("yyMMdd_hhmmss")}.mov");
                //  var outputUrl = ApplicationDocumentsDirectory().Append($"Video_{DateTime.Now.ToString("yyMMdd-hhmmss")}", false).AppendPathExtension("mov");
                var _delegate = new OutputRecorder();
                _delegate.SavedMovie += (sender, e) =>
                {
                    Video?.Invoke(this, VideoFileUrl);
                    /// SavedMovie(this, new ListEventArgs(outputUrl.AbsoluteString, e.error?.LocalizedDescription));
                    //Analytics.TrackEvent("Trigger seconds SavedMovie Event");
                };
                movieFileOutput.StartRecordingToOutputFile(outputUrl, _delegate);
                //takePhotoButton.Hidden = true;
                //stopRecordButton.Hidden = false;
                StartedRecordingVideo?.Invoke(this, EventArgs.Empty);
            }
            else if (isRecording && CameraMode == CameraModes.Video)
            {
                movieFileOutput.StopRecording();
                //takePhotoButton.Hidden = false;
                //stopRecordButton.Hidden = true;
            }
            else if (CameraMode == CameraModes.Snapshot)
            {
                var cb = new PhotoRecorderDelegate();
                cb.SavedPhoto += (object sender, ListEventArgs e) =>
                {
                    /// SavedMovie(this, e);
                    PhotoPath?.Invoke(this, e.MovieUrl);
                };
                var dictionary = new NSDictionary <NSString, NSObject>
                                 (
                    AVVideo.CodecKey, AVVideo.CodecJPEG
                                 );
                var setting = AVCapturePhotoSettings.FromFormat(dictionary);
                setting.IsHighResolutionPhotoEnabled         = true;
                setting.IsAutoStillImageStabilizationEnabled = true;
                photoFileOutput.CapturePhoto(setting, cb);
            }

            isRecording = !isRecording;
        }
예제 #2
0
 public void NotifyPhoto(object sender, string filePath)
 {
     PhotoPath?.Invoke(this, filePath);
 }