Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[camera] 4k camera #1186

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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 @@ -294,6 +294,9 @@ private class Camera {
try {
Size minPreviewSize;
switch (resolutionPreset) {
case "4k":
minPreviewSize = new Size(3840, 2160);
break;
case "high":
minPreviewSize = new Size(1024, 768);
break;
Expand Down
5 changes: 4 additions & 1 deletion packages/camera/ios/Classes/CameraPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ - (instancetype)initWithCameraName:(NSString *)cameraName
NSAssert(self, @"super init cannot be nil");
_captureSession = [[AVCaptureSession alloc] init];
AVCaptureSessionPreset preset;
if ([resolutionPreset isEqualToString:@"high"]) {
if ([resolutionPreset isEqualToString:@"4k"]) {
preset = AVCaptureSessionPreset3840x2160;
_previewSize = CGSizeMake(3840, 2160);
} else if ([resolutionPreset isEqualToString:@"high"]) {
preset = AVCaptureSessionPreset1280x720;
_previewSize = CGSizeMake(1280, 720);
} else if ([resolutionPreset isEqualToString:@"medium"]) {
Expand Down
4 changes: 3 additions & 1 deletion packages/camera/lib/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final MethodChannel _channel = const MethodChannel('plugins.flutter.io/camera');

enum CameraLensDirection { front, back, external }

enum ResolutionPreset { low, medium, high }
enum ResolutionPreset { low, medium, high, fourk }

typedef onLatestImageAvailable = Function(CameraImage image);

Expand All @@ -27,6 +27,8 @@ String serializeResolutionPreset(ResolutionPreset resolutionPreset) {
return 'medium';
case ResolutionPreset.low:
return 'low';
case ResolutionPreset.fourk:
return '4k';
}
throw ArgumentError('Unknown ResolutionPreset value');
}
Expand Down