Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update quality #7

Merged
merged 1 commit into from Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 0 additions & 12 deletions Capturer/Basic/Outputs/PhotoOutput.swift
Expand Up @@ -31,26 +31,14 @@ public final class PhotoOutput: _StatefulObjectBase, OutputNodeType {
}

private let _output = AVCapturePhotoOutput()
private let quality: AVCapturePhotoOutput.QualityPrioritization

public init(quality: AVCapturePhotoOutput.QualityPrioritization = .balanced) {
self.quality = quality
super.init()

_output.isHighResolutionCaptureEnabled = true
_output.maxPhotoQualityPrioritization = quality
}

public func makeCaptureSettings() -> AVCapturePhotoSettings {

let settings = AVCapturePhotoSettings()

settings.photoQualityPrioritization = quality
settings.isHighResolutionPhotoEnabled = true

return settings
}

public func capture(with settings: AVCapturePhotoSettings, completion: @escaping (Result<CapturePhoto, Error>) -> Void) {

var completionWrapper: ((Result<CapturePhoto, Error>) -> Void)!
Expand Down
Expand Up @@ -100,8 +100,9 @@ final class DemoInputPreviewViewController: UIViewController {

Task { [weak self] in
do {

let result = try await photoOutput.capture(with: photoOutput.makeCaptureSettings())
let settings = AVCapturePhotoSettings()
settings.isHighResolutionPhotoEnabled = true
let result = try await photoOutput.capture(with: settings)

guard let self = self else { return }

Expand Down