@capgo/camera-preview 7.4.0-beta.11 → 7.4.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -66,8 +66,8 @@ extension CameraController {
|
|
|
66
66
|
self.captureSession = AVCaptureSession()
|
|
67
67
|
|
|
68
68
|
// 2. Pre-configure session preset (can be changed later)
|
|
69
|
-
if captureSession!.canSetSessionPreset(.
|
|
70
|
-
captureSession!.sessionPreset = .
|
|
69
|
+
if captureSession!.canSetSessionPreset(.high) {
|
|
70
|
+
captureSession!.sessionPreset = .high
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
// 3. Discover and configure all cameras
|
|
@@ -258,8 +258,9 @@ extension CameraController {
|
|
|
258
258
|
guard let captureSession = self.captureSession else { throw CameraControllerError.captureSessionIsMissing }
|
|
259
259
|
|
|
260
260
|
// Update session preset based on aspect ratio if needed
|
|
261
|
+
var targetPreset: AVCaptureSession.Preset = .high // Default to high quality
|
|
262
|
+
|
|
261
263
|
if let aspectRatio = aspectRatio {
|
|
262
|
-
var targetPreset: AVCaptureSession.Preset
|
|
263
264
|
switch aspectRatio {
|
|
264
265
|
case "16:9":
|
|
265
266
|
targetPreset = captureSession.canSetSessionPreset(.hd1920x1080) ? .hd1920x1080 : .high
|
|
@@ -268,11 +269,16 @@ extension CameraController {
|
|
|
268
269
|
default:
|
|
269
270
|
targetPreset = .high
|
|
270
271
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Always try to set the best preset available
|
|
275
|
+
if captureSession.canSetSessionPreset(targetPreset) {
|
|
276
|
+
captureSession.sessionPreset = targetPreset
|
|
277
|
+
print("[CameraPreview] Updated preset to \(targetPreset) for aspect ratio: \(aspectRatio ?? "default")")
|
|
278
|
+
} else if captureSession.canSetSessionPreset(.high) {
|
|
279
|
+
// Fallback to high if target preset not available
|
|
280
|
+
captureSession.sessionPreset = .high
|
|
281
|
+
print("[CameraPreview] Fallback to high preset")
|
|
276
282
|
}
|
|
277
283
|
|
|
278
284
|
// Add photo output (already created in prepareOutputs)
|
|
@@ -306,6 +312,9 @@ extension CameraController {
|
|
|
306
312
|
// Optimize preview layer for better quality
|
|
307
313
|
self.previewLayer?.connection?.videoOrientation = .portrait
|
|
308
314
|
self.previewLayer?.isOpaque = true
|
|
315
|
+
|
|
316
|
+
// Set contentsScale for retina display quality
|
|
317
|
+
self.previewLayer?.contentsScale = UIScreen.main.scale
|
|
309
318
|
|
|
310
319
|
// Enable high-quality rendering
|
|
311
320
|
if #available(iOS 13.0, *) {
|