Skip to content

Commit 69d887e

Browse files
authored
Fix camera view regression (#2951)
1 parent 3ba59e6 commit 69d887e

File tree

3 files changed

+2
-14
lines changed

3 files changed

+2
-14
lines changed

src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,7 @@ public partial void UpdateZoom(float zoomLevel)
106106

107107
public partial ValueTask UpdateCaptureResolution(Size resolution, CancellationToken token)
108108
{
109-
if (cameraView.SelectedCamera is null)
110-
{
111-
throw new CameraException($"Unable to update Capture Resolution because {nameof(ICameraView)}.{nameof(ICameraView.SelectedCamera)} is null.");
112-
}
113-
114-
if (captureDevice is null)
109+
if (cameraView.SelectedCamera is null || captureDevice is null)
115110
{
116111
return ValueTask.CompletedTask;
117112
}

src/CommunityToolkit.Maui.Camera/CameraManager.windows.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,11 @@ private partial void PlatformStopCameraPreview()
157157

158158
async Task PlatformUpdateResolution(Size resolution, CancellationToken token)
159159
{
160-
if (!IsInitialized || mediaCapture is null)
160+
if (cameraView.SelectedCamera is null || !IsInitialized || mediaCapture is null)
161161
{
162162
return;
163163
}
164164

165-
if (cameraView.SelectedCamera is null)
166-
{
167-
throw new CameraException($"Unable to update Capture Resolution because {nameof(ICameraView)}.{nameof(ICameraView.SelectedCamera)} is null.");
168-
}
169-
170165
var filteredPropertiesList = cameraView.SelectedCamera.ImageEncodingProperties.Where(p => p.Width <= resolution.Width && p.Height <= resolution.Height).ToList();
171166

172167
if (filteredPropertiesList.Count is 0)

src/CommunityToolkit.Maui.Camera/Handlers/CameraViewHandler.shared.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ protected virtual void Dispose(bool disposing)
107107
{
108108
cameraManager?.Dispose();
109109
cameraManager = null;
110-
111-
cameraProvider.Dispose();
112110
}
113111
}
114112

0 commit comments

Comments
 (0)