Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CameraView] Android - Fix SetSurfaceProvider crash #2449

Merged
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
4 changes: 2 additions & 2 deletions src/CommunityToolkit.Maui.Camera/CameraManager.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ protected virtual async partial Task PlatformConnectCamera(CancellationToken tok

protected async Task StartUseCase(CancellationToken token)
{
if (resolutionSelector is null)
if (resolutionSelector is null || cameraExecutor is null)
{
return;
}
Expand All @@ -183,7 +183,7 @@ protected async Task StartUseCase(CancellationToken token)
imageCapture?.Dispose();

cameraPreview = new Preview.Builder().SetResolutionSelector(resolutionSelector).Build();
cameraPreview.SetSurfaceProvider(previewView?.SurfaceProvider);
cameraPreview.SetSurfaceProvider(cameraExecutor, previewView?.SurfaceProvider);

imageCapture = new ImageCapture.Builder()
.SetCaptureMode(ImageCapture.CaptureModeMaximizeQuality)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.3.1.1" />
<PackageReference Include="Xamarin.AndroidX.Camera.View" Version="1.3.1.1" />
<PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.4.1" />
<PackageReference Include="Xamarin.AndroidX.Camera.View" Version="1.4.1" />

<!-- Ensure Linker does not remove required libraries -->
<None Include="linker.xml" Pack="true" PackagePath="build\$(PackageId).LinkerConfigurationFile.xml" />
Expand Down
Loading