Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
7 changes: 1 addition & 6 deletions src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,7 @@

public partial ValueTask UpdateCaptureResolution(Size resolution, CancellationToken token)
{
if (cameraView.SelectedCamera is null)
{
throw new CameraException($"Unable to update Capture Resolution because {nameof(ICameraView)}.{nameof(ICameraView.SelectedCamera)} is null.");
}

if (captureDevice is null)
if (cameraView.SelectedCamera is null || captureDevice is null)
{
return ValueTask.CompletedTask;
}
Expand Down Expand Up @@ -370,7 +365,7 @@
var photoOutputConnection = photoOutput.ConnectionFromMediaType(avMediaTypeVideo);
if (photoOutputConnection is not null)
{
photoOutputConnection.VideoOrientation = videoOrientation;

Check warning on line 368 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (macos-26)

This call site is reachable on: 'iOS' 15.0 and later, 'maccatalyst' 15.0 and later. 'AVCaptureConnection.VideoOrientation' is obsoleted on: 'ios' 17.0 and later (Use VideoRotationAngle instead.), 'maccatalyst' 17.0 and later (Use VideoRotationAngle instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 368 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (windows-latest)

This call site is reachable on: 'iOS' 15.0 and later, 'maccatalyst' 15.0 and later. 'AVCaptureConnection.VideoOrientation' is obsoleted on: 'ios' 17.0 and later (Use VideoRotationAngle instead.), 'maccatalyst' 17.0 and later (Use VideoRotationAngle instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 368 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (windows-latest)

This call site is reachable on: 'MacCatalyst' 15.0 and later. 'AVCaptureConnection.VideoOrientation' is obsoleted on: 'maccatalyst' 17.0 and later (Use VideoRotationAngle instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 368 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Sample App using Latest .NET SDK (macos-26)

This call site is reachable on: 'iOS' 15.0 and later, 'maccatalyst' 15.0 and later. 'AVCaptureConnection.VideoOrientation' is obsoleted on: 'ios' 17.0 and later (Use VideoRotationAngle instead.), 'maccatalyst' 17.0 and later (Use VideoRotationAngle instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 368 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Sample App using Latest .NET SDK (macos-26)

This call site is reachable on: 'MacCatalyst' 15.0 and later. 'AVCaptureConnection.VideoOrientation' is obsoleted on: 'maccatalyst' 17.0 and later (Use VideoRotationAngle instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)
}
}

Expand Down Expand Up @@ -422,13 +417,13 @@
{
interfaceOrientation = scenes.FirstOrDefault() is UIWindowScene windowScene
? windowScene.InterfaceOrientation
: UIApplication.SharedApplication.StatusBarOrientation;

Check warning on line 420 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (macos-26)

This call site is reachable on: 'MacCatalyst' 15.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 420 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (macos-26)

This call site is reachable on: 'iOS' 15.0 and later, 'maccatalyst' 15.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'ios' 9.0 and later, 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 420 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (windows-latest)

This call site is reachable on: 'iOS' 15.0 and later, 'maccatalyst' 15.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'ios' 9.0 and later, 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 420 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (windows-latest)

This call site is reachable on: 'MacCatalyst' 15.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 420 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Sample App using Latest .NET SDK (windows-latest)

This call site is reachable on: 'MacCatalyst' 15.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 420 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Sample App using Latest .NET SDK (macos-26)

This call site is reachable on: 'iOS' 15.0 and later, 'maccatalyst' 15.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'ios' 9.0 and later, 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 420 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Sample App using Latest .NET SDK (macos-26)

This call site is reachable on: 'MacCatalyst' 15.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)
}
else
{
interfaceOrientation = scenes.FirstOrDefault() is UIWindowScene windowScene
? windowScene.EffectiveGeometry.InterfaceOrientation
: UIApplication.SharedApplication.StatusBarOrientation;

Check warning on line 426 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (macos-26)

This call site is reachable on: 'MacCatalyst' 26.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 426 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (macos-26)

This call site is reachable on: 'iOS' 26.0 and later, 'maccatalyst' 15.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'ios' 9.0 and later, 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 426 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (windows-latest)

This call site is reachable on: 'iOS' 26.0 and later, 'maccatalyst' 15.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'ios' 9.0 and later, 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 426 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (windows-latest)

This call site is reachable on: 'MacCatalyst' 26.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 426 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Sample App using Latest .NET SDK (macos-26)

This call site is reachable on: 'iOS' 26.0 and later, 'maccatalyst' 15.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'ios' 9.0 and later, 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 426 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Sample App using Latest .NET SDK (macos-26)

This call site is reachable on: 'MacCatalyst' 26.0 and later. 'UIApplication.StatusBarOrientation' is obsoleted on: 'maccatalyst' 9.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)
}

return interfaceOrientation switch
Expand Down Expand Up @@ -523,7 +518,7 @@
{
if (PreviewLayer.Connection is not null)
{
PreviewLayer.Connection.VideoOrientation = videoOrientation;

Check warning on line 521 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (macos-26)

This call site is reachable on: 'MacCatalyst' 15.0 and later. 'AVCaptureConnection.VideoOrientation' is obsoleted on: 'maccatalyst' 17.0 and later (Use VideoRotationAngle instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 521 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (macos-26)

This call site is reachable on: 'iOS' 15.0 and later, 'maccatalyst' 15.0 and later. 'AVCaptureConnection.VideoOrientation' is obsoleted on: 'ios' 17.0 and later (Use VideoRotationAngle instead.), 'maccatalyst' 17.0 and later (Use VideoRotationAngle instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 521 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Library (windows-latest)

This call site is reachable on: 'MacCatalyst' 15.0 and later. 'AVCaptureConnection.VideoOrientation' is obsoleted on: 'maccatalyst' 17.0 and later (Use VideoRotationAngle instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 521 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Sample App using Latest .NET SDK (macos-26)

This call site is reachable on: 'iOS' 15.0 and later, 'maccatalyst' 15.0 and later. 'AVCaptureConnection.VideoOrientation' is obsoleted on: 'ios' 17.0 and later (Use VideoRotationAngle instead.), 'maccatalyst' 17.0 and later (Use VideoRotationAngle instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)

Check warning on line 521 in src/CommunityToolkit.Maui.Camera/CameraManager.macios.cs

View workflow job for this annotation

GitHub Actions / Build Sample App using Latest .NET SDK (macos-26)

This call site is reachable on: 'MacCatalyst' 15.0 and later. 'AVCaptureConnection.VideoOrientation' is obsoleted on: 'maccatalyst' 17.0 and later (Use VideoRotationAngle instead.). (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1422)
}
}
}
Expand Down
7 changes: 1 addition & 6 deletions src/CommunityToolkit.Maui.Camera/CameraManager.windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,11 @@ private partial void PlatformStopCameraPreview()

async Task PlatformUpdateResolution(Size resolution, CancellationToken token)
{
if (!IsInitialized || mediaCapture is null)
if (cameraView.SelectedCamera is null || !IsInitialized || mediaCapture is null)
{
return;
}

if (cameraView.SelectedCamera is null)
{
throw new CameraException($"Unable to update Capture Resolution because {nameof(ICameraView)}.{nameof(ICameraView.SelectedCamera)} is null.");
}

var filteredPropertiesList = cameraView.SelectedCamera.ImageEncodingProperties.Where(p => p.Width <= resolution.Width && p.Height <= resolution.Height).ToList();

if (filteredPropertiesList.Count is 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ protected virtual void Dispose(bool disposing)
{
cameraManager?.Dispose();
cameraManager = null;

cameraProvider.Dispose();
}
}

Expand Down
Loading