Camera Feed
The SDK DataSource provides access to recorded and live frames from the device camera for both live camera feeds and recorded logs.
Recorded logs with camera data are MP4 files that can be played back using standard video players. Using external players such as video_player is the preferred approach for most log-playback scenarios, as they provide better performance.
Camera Player Widget
The GemCameraPlayer widget displays the camera feed on screen. Wrap the widget in a SizedBox or similar to control its size.
Parameters
controller— theGemCameraPlayerControllerthat drives playback and provides camera frames (required). Connects the widget to the source of frames, exposes playback status (loading, playing, error, ended), and is used internally to start/stop rendering and request frame updatesfallbackWidget— widget shown when a frame cannot be decoded or an error state is reported by the controllerloadingWidget— widget shown while the player is waiting for the first frame or is in a loading stateendWidget— widget shown once the camera feed or recording has finished and the controller reports an ended statefit—BoxFitdescribing how the decoded image should be sized into the available space. Defaults to cover-like behavior. See the BoxFit API reference for more information
Camera Player Controller
The GemCameraPlayerController is the main interface for controlling camera feed playback and accessing frames. Create it via the constructor with a DataSource as the required parameter. Optionally, provide a CameraConfiguration to the configurationOverride parameter to customize the frame size.
The DataSource provided to the GemCameraPlayerController must have the DataType.camera data type enabled. Providing a DataSource without camera data will result in an error state in the controller and cause the fallbackWidget to be shown in the GemCameraPlayer.
When presenting the live camera feed, a video recording session must be active on the DataSource. See the Video Recording guide for more information on starting a video recording session.
Properties
datasource— theDataSourceprovided during construction. Use it to query additional information about the source of camera frames and to control the playback sessionsize— the size of the camera frames being provided by the controller, taking into account any configuration overridesstatus— the current playback status of the controller:loading— the controller is waiting for the first frame to be availableerror— an error occurred while trying to provide frames (for example, the data source does not provide camera data or the raw camera frame data is in an unsupported format)playing— the controller is actively providing framespaused— the controller has paused frame deliveryended— the camera feed or recording has finished
camera— theCamerainstance providing camera parameters such as intrinsics and extrinsics. Returnsnullif no camera data is available from theDataSource
Pause and resume
pause()— pauses the camera feed. The controller's status changes topausedresume()— resumes the camera feed if it was paused. The controller's status changes back toplaying
Pausing and resuming the camera feed does not affect the underlying DataSource playback or recording session. It only controls the delivery of camera frames to the controller. Use the Playback API available on the DataSource to control overall playback or recording for log data sources.
Listen to changes
The GemCameraPlayerController extends ValueNotifier, so you can listen to it for changes in playback status and update your UI accordingly. The GemCameraPlayerValue provides access to the data source, the current playback status, the current Camera (if available), and the data source listener used internally to receive camera frames.
Lifecycle management
Dispose of the GemCameraPlayerController when it is no longer needed to free up resources. Disposing the controller stops the internal data source listener and releases any associated resources. The GemCameraPlayer widget does not automatically dispose of the controller, so manage its lifecycle appropriately in your application. Dispose of both the controller and the player widget when appropriate, as they can consume significant resources.