Skip to content

Add OnCameraPreviewReady event#195

Open
VagnerVit wants to merge 1 commit intoafriscic:masterfrom
VagnerVit:feature/camera-preview-ready-event
Open

Add OnCameraPreviewReady event#195
VagnerVit wants to merge 1 commit intoafriscic:masterfrom
VagnerVit:feature/camera-preview-ready-event

Conversation

@VagnerVit
Copy link
Copy Markdown

Summary

Adds a new OnCameraPreviewReady event and OnCameraPreviewReadyCommand bindable property to CameraView, fired once when the camera preview becomes ready.

Closes #194

Motivation

There is currently no public API to know when the camera preview is actually rendering. Users resort to fragile workarounds like fixed Task.Delay or monitoring CurrentZoomFactor via PropertyChanged to hide loading overlays at the right moment.

Changes

  • New OnCameraPreviewReadyEventArg — simple EventArgs subclass (follows existing pattern)
  • CameraView — new event, bindable command, and internal trigger method with a guard flag ensuring it fires only once per camera session (reset on Start)
  • Android — fires in CameraStateObserver.OnChanged() when CameraState.Type.Open is reached
  • iOS/macOS — fires at the end of the Start() dispatch block after session starts running

Usage

<scanner:CameraView OnCameraPreviewReady="OnCameraPreviewReady" />
// Event
cameraView.OnCameraPreviewReady += (s, e) => { /* hide overlay */ };

// Or via command binding
OnCameraPreviewReadyCommand="{Binding CameraReadyCommand}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: CameraPreviewReady event

1 participant