AVFoundationCamera class

An iOS implementation of CameraPlatform based on AVFoundation.

Inheritance
  • Object
  • PlatformInterface
  • AVFoundationCamera

Constructors

AVFoundationCamera({@visibleForTesting CameraApi? api})
Creates a new AVFoundation-based CameraPlatform implementation instance.

Properties

cameraEventStreamController StreamController<CameraEvent>
The controller we need to broadcast the different events coming from handleMethodCall, specific to camera events.
final
hashCode int
The hash code for this object.
no setterinherited
hostCameraHandlers Map<int, HostCameraMessageHandler>
The per-camera handlers for messages that should be rebroadcast to clients as CameraEvents.
final
hostHandler HostDeviceMessageHandler
The handler for device-level messages that should be rebroadcast to clients as DeviceEvents.
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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.
dispose(int cameraId) Future<void>
Releases the resources of this camera.
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>
The camera's resolution has changed. On Web this returns an empty stream.
onDeviceOrientationChanged() Stream<DeviceOrientationChangedEvent>
The ui orientation changed.
onStreamedFrameAvailable(int cameraId, {CameraImageStreamOptions? options}) Stream<CameraImageData>
A new streamed frame is available.
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.
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.
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() → void
Registers this class as the default instance of CameraPlatform.