Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public async Task TakePhoto()
photoOutputConnection.VideoOrientation = previewLayer.Connection?.VideoOrientation ?? throw new NullReferenceException();

var photoSettings = AVCapturePhotoSettings.Create();
photoSettings.FlashMode = (AVCaptureFlashMode)flashMode;
photoSettings.FlashMode = GetFlashMode();
photoSettings.IsHighResolutionPhotoEnabled = true;

var photoCaptureDelegate = new PhotoCaptureDelegate
Expand Down Expand Up @@ -239,6 +239,21 @@ public async Task TakePhoto()
}
}

AVCaptureFlashMode GetFlashMode()
{
switch (flashMode)
{
case CameraFlashMode.On:
case CameraFlashMode.Torch:
return AVCaptureFlashMode.On;
case CameraFlashMode.Auto:
return AVCaptureFlashMode.Auto;
case CameraFlashMode.Off:
default:
return AVCaptureFlashMode.Off;
}
}

string ConstructVideoFilename()
{
var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
Expand Down Expand Up @@ -605,4 +620,4 @@ public void DidFinishProcessingPhoto(AVCapturePhotoOutput captureOutput, CMSampl
public void DidFinishCapture(AVCapturePhotoOutput captureOutput, AVCaptureResolvedPhotoSettings resolvedSettings, NSError error)
=> OnFinishCapture?.Invoke(photoData, error);
}
}
}