setPreviewCallback method
Installs a callback to be invoked for every preview frame in addition to displaying them on the screen.
The callback will be repeatedly called for as long as preview is active. This method can be called at any time, even while preview is live. Any other preview callbacks are overridden.
If you are using the preview data to create video or still images, strongly consider using MediaActionSound to properly indicate image capture or recording start/stop to the user.
callback
: a callback object that receives a copy of each preview frame,
or null to stop receiving callbacks.
Throws PlatformException if release has been called on this Camera instance.
Implementation
Future<void> setPreviewCallback(PreviewCallback? callback) {
if (callback != null) {
PreviewCallback._channel.$create$(
callback,
$owner: false,
onPreviewFrame: callback.onPreviewFrame,
);
}
return _channel.$setPreviewCallback(this, callback);
}