public interface FrameListener

Receives camera frames from an active CameraSession.

Threading: #onFrame(CameraFrame) is invoked on a non-EDT background thread. Do not touch UI directly. The standard pattern is to hand the JPEG bytes to one of the com.codename1.ai.* modules (whose AsyncResource.ready(...) callbacks already hop back to EDT), or to call com.codename1.ui.Display#callSerially(Runnable) yourself before updating the UI.

Backpressure: only one frame is delivered at a time per session. If a previous onFrame call is still running when a new frame arrives, the older frame is dropped silently. This is the right default for AI scanning use cases.

Memory: the byte arrays returned by CameraFrame#getJpegBytes() and CameraFrame#getRawBytes() are owned by the framework and become invalid once onFrame returns. Listeners that need to retain bytes past the callback must clone them.

Methods

public abstract void onFrame(CameraFrame frame)

Method details

onFrame

public abstract void onFrame(CameraFrame frame)