Skip to content

Feature request: CameraPreviewReady event #194

@VagnerVit

Description

@VagnerVit

Problem

When CameraView is displayed, the first frame from the camera preview can appear rotated or frozen until CameraX fully initializes. There is no public event or callback to reliably detect when the camera preview is actually ready to be shown to the user.

Current workaround

The only proxy signal available without forking the library is subscribing to PropertyChanged on CurrentZoomFactor — it changes from -1 to a positive value when CameraX reaches CameraState.Open and sets the zoom. Combined with a small delay (~150ms for TextureView rendering), this allows a reasonably timed overlay fade-out.

private void OnCameraReady(object? sender, PropertyChangedEventArgs e)
{
    if (e.PropertyName != nameof(CameraView.CurrentZoomFactor))
        return;

    if (BarcodeReader.CurrentZoomFactor <= 0)
        return;

    BarcodeReader.PropertyChanged -= OnCameraReady;
    // fade out overlay
}

This works but is fragile — it relies on an implementation detail that could change.

Proposal

Add a public event (e.g. CameraPreviewReady) that fires when the camera preview surface is fully initialized and rendering. This would allow apps to:

  • Show a loading overlay and hide it at exactly the right moment
  • Avoid the visible rotated/frozen first frame
  • Remove fragile workarounds based on Task.Delay or property change side effects

Environment

  • BarcodeScanning.Native.Maui 3.0.0
  • .NET MAUI 10
  • Tested on Android (CameraX)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions