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();