CameraPlugin class

The web implementation of CameraPlatform.

This class implements the package:camera functionality for the web.

Inheritance
  • Object
  • PlatformInterface
  • CameraPlugin

Constructors

CameraPlugin({required CameraService cameraService})
Creates a new instance of CameraPlugin with the given cameraService.

Properties

cameraEventStreamController StreamController<CameraEvent>
The controller used to broadcast different camera events.
final
cameras Map<int, Camera>
The cameras managed by the CameraPlugin.
final
camerasMetadata Map<CameraDescription, CameraMetadata>
Metadata associated with each camera description. Populated in availableCameras.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
window Window?
The current browser window used to access media devices.
getter/setter pair

Methods

availableCameras() Future<List<CameraDescription>>
Completes with a list of available cameras.
buildPreview(int cameraId) Widget
Returns a widget showing a live camera preview.
createCamera(CameraDescription cameraDescription, ResolutionPreset? resolutionPreset, {bool enableAudio = false}) Future<int>
Creates an uninitialized camera instance and returns the cameraId.
createCameraWithSettings(CameraDescription cameraDescription, MediaSettings mediaSettings) Future<int>
Creates an uninitialized camera instance and returns the cameraId.
inherited
dispose(int cameraId) Future<void>
Releases the resources of this camera.
getCamera(int cameraId) → Camera
Returns a camera for the given cameraId.
getExposureOffsetStepSize(int cameraId) Future<double>
Gets the supported step size for exposure offset for the selected camera in EV units.
getMaxExposureOffset(int cameraId) Future<double>
Gets the maximum supported exposure offset for the selected camera in EV units.
getMaxZoomLevel(int cameraId) Future<double>
Gets the maximum supported zoom level for the selected camera.
getMinExposureOffset(int cameraId) Future<double>
Gets the minimum supported exposure offset for the selected camera in EV units.
getMinZoomLevel(int cameraId) Future<double>
Gets the minimum supported zoom level for the selected camera.
initializeCamera(int cameraId, {ImageFormatGroup imageFormatGroup = ImageFormatGroup.unknown}) Future<void>
Initializes the camera on the device.
lockCaptureOrientation(int cameraId, DeviceOrientation orientation) Future<void>
Locks the capture orientation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onCameraClosing(int cameraId) Stream<CameraClosingEvent>
The camera started to close.
onCameraError(int cameraId) Stream<CameraErrorEvent>
The camera experienced an error.
onCameraInitialized(int cameraId) Stream<CameraInitializedEvent>
The camera has been initialized.
onCameraResolutionChanged(int cameraId) Stream<CameraResolutionChangedEvent>
Emits an empty stream as there is no event corresponding to a change in the camera resolution on the web.
onDeviceOrientationChanged() Stream<DeviceOrientationChangedEvent>
The ui orientation changed.
onStreamedFrameAvailable(int cameraId, {CameraImageStreamOptions? options}) Stream<CameraImageData>
A new streamed frame is available.
inherited
onVideoRecordedEvent(int cameraId) Stream<VideoRecordedEvent>
The camera finished recording a video.
pausePreview(int cameraId) Future<void>
Pause the active preview on the current frame for the selected camera.
pauseVideoRecording(int cameraId) Future<void>
Pause video recording.
prepareForVideoRecording() Future<void>
Prepare the capture session for video recording.
resumePreview(int cameraId) Future<void>
Resume the paused preview for the selected camera.
resumeVideoRecording(int cameraId) Future<void>
Resume video recording after pausing.
setDescriptionWhileRecording(CameraDescription description) Future<void>
Sets the active camera while recording.
inherited
setExposureMode(int cameraId, ExposureMode mode) Future<void>
Sets the exposure mode for taking pictures.
setExposureOffset(int cameraId, double offset) Future<double>
Sets the exposure offset for the selected camera.
setExposurePoint(int cameraId, Point<double>? point) Future<void>
Sets the exposure point for automatically determining the exposure values.
setFlashMode(int cameraId, FlashMode mode) Future<void>
Sets the flash mode for the selected camera. On Web FlashMode.auto corresponds to FlashMode.always.
setFocusMode(int cameraId, FocusMode mode) Future<void>
Sets the focus mode for taking pictures.
setFocusPoint(int cameraId, Point<double>? point) Future<void>
Sets the focus point for automatically determining the focus values.
setImageFileFormat(int cameraId, ImageFileFormat format) Future<void>
Sets the output image file format for the selected camera.
inherited
setZoomLevel(int cameraId, double zoom) Future<void>
Set the zoom level for the selected camera.
startVideoCapturing(VideoCaptureOptions options) Future<void>
Starts a video recording and/or streaming session.
startVideoRecording(int cameraId, {Duration? maxVideoDuration}) Future<void>
Starts a video recording.
stopVideoRecording(int cameraId) Future<XFile>
Stops the video recording and returns the file where it was saved.
takePicture(int cameraId) Future<XFile>
Captures an image and returns the file where it was saved.
toString() String
A string representation of this object.
inherited
unlockCaptureOrientation(int cameraId) Future<void>
Unlocks the capture orientation.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

registerWith(Registrar registrar) → void
Registers this class as the default instance of CameraPlatform.