From 9bf68f10a961bee72ddbb9f37b55e1131a26fd0d Mon Sep 17 00:00:00 2001 From: "Drozdz, Dennis" Date: Thu, 25 Jul 2024 08:48:42 +0200 Subject: [PATCH] Add videoSize = maxVideoSize; --- Camera.MAUI/Platforms/Android/MauiCameraView.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Camera.MAUI/Platforms/Android/MauiCameraView.cs b/Camera.MAUI/Platforms/Android/MauiCameraView.cs index bb97d5e..7aa6fd5 100644 --- a/Camera.MAUI/Platforms/Android/MauiCameraView.cs +++ b/Camera.MAUI/Platforms/Android/MauiCameraView.cs @@ -179,8 +179,9 @@ internal async Task StartRecordingAsync(string file, Microsoft.Mau var maxVideoSize = ChooseMaxVideoSize(map.GetOutputSizes(Class.FromType(typeof(ImageReader)))); if (Resolution.Width != 0 && Resolution.Height != 0) maxVideoSize = new((int)Resolution.Width, (int)Resolution.Height); - mediaRecorder.SetVideoSize(maxVideoSize.Width, maxVideoSize.Height); + videoSize = maxVideoSize; + mediaRecorder.SetVideoSize(maxVideoSize.Width, maxVideoSize.Height); mediaRecorder.SetVideoEncoder(VideoEncoder.H264); mediaRecorder.SetAudioEncoder(AudioEncoder.Aac); IWindowManager windowManager = context.GetSystemService(Context.WindowService).JavaCast(); @@ -291,6 +292,8 @@ internal async Task StartCameraAsync(Microsoft.Maui.Graphics.Size var maxVideoSize = ChooseMaxVideoSize(map.GetOutputSizes(Class.FromType(typeof(ImageReader)))); if (PhotosResolution.Width != 0 && PhotosResolution.Height != 0) maxVideoSize = new((int)PhotosResolution.Width, (int)PhotosResolution.Height); + + videoSize = maxVideoSize; imgReader = ImageReader.NewInstance(maxVideoSize.Width, maxVideoSize.Height, ImageFormatType.Jpeg, 1); backgroundThread = new HandlerThread("CameraBackground"); backgroundThread.Start();