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

[BUG] Cant Start Preview after Stop Preview on Huawei Nova 5T #2405

Open
2 tasks done
kwjcode opened this issue Dec 20, 2024 · 1 comment
Open
2 tasks done

[BUG] Cant Start Preview after Stop Preview on Huawei Nova 5T #2405

kwjcode opened this issue Dec 20, 2024 · 1 comment
Labels
bug Something isn't working unverified

Comments

@kwjcode
Copy link

kwjcode commented Dec 20, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

Hi all,

Currently using Community Toolkit Camera to develop a camera app. When I Stop Preview camera, it work properly. The issue was when I tried to use the StartCameraPreviewCommand, it didn't restart the camera preview at all. There are no exception occur or any errors captured.

Please refer to the screen recorder below and attached Debug log from VS2022.

Debug log.txt

SVID_20241220_154946_1.mp4

The code I using is from Microsoft documentation.
https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/views/camera-view?tabs=android

Any help would be appreciated.

Expected Behavior

Able to restart camera preview after stop

Steps To Reproduce

  1. Open and run solution from the repository

Link to public reproduction project repository

https://github.com/kwjcode/MobileApp.git

Environment

- Device: Huawei Nova 5T
- OS: EMUI 12
- Android version: 10
- .NET MAUI CommunityToolkit: 9.1.1
- .NET MAUI: 8.0
- .NET CommunityToolkit.Maui.Camera: 1.0.5

Anything else?

No response

@kwjcode kwjcode added bug Something isn't working unverified labels Dec 20, 2024
@kwjcode
Copy link
Author

kwjcode commented Dec 23, 2024

I solved it by using StartCameraPreview and StopCameraPreview method in code instead of binding command directly in XAML.

Not worked (not able to start camera preview after stop camera preview):
<Button Command="{Binding StartCameraPreviewCommand, Source={x:Reference Camera}, x:DataType=toolkit:CameraView}"
Text="StartCameraPreview" />
<Button Command="{Binding StopCameraPreviewCommand, Source={x:Reference Camera}, x:DataType=toolkit:CameraView}"
Text="StopCameraPreview" />

Worked (able to start camera and stop camera preview normally):
<Button Clicked="Button_Clicked"
Text="StartCameraPreview" />

<Button Clicked="Button_Clicked_1"
Text="StopCameraPreview" />

Code behind:

private async void Button_Clicked(object sender, EventArgs e)
{
    await Camera.StartCameraPreview(CancellationToken.None);
}

private void Button_Clicked_1(object sender, EventArgs e)
{
    Camera.StopCameraPreview();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unverified
Projects
None yet
Development

No branches or pull requests

1 participant