CameraController class

Controls a device camera.

Use availableCameras to get a list of available cameras.

Before using a CameraController a call to initialize must complete.

To show the camera preview on the screen use a CameraPreview widget.

Inheritance

Constructors

CameraController(ResolutionPreset resolutionPreset, {bool enableAudio = true, bool androidUseOpenGL = false})

Properties

androidUseOpenGL bool
final
enableAudio bool
Whether to include audio when recording a video.
final
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
resolutionPreset ResolutionPreset
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value CameraValue
The current value stored in this notifier.
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() Future<void>
Releases the resources of this camera.
override
getHasAudio() Future<bool?>
Obtain whether to temporarily mute Only supports ios
getHasVideo() Future<bool?>
Obtain whether to temporarily video Only supports ios
getStreamStatistics() Future<StreamStatistics>
Get statistics about the rtmp stream.
initialize(CameraDescription cameraDesc) Future<void>
Initializes the camera on the device.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pauseVideoRecording() Future<void>
Pause video recording. Only supports Android This feature is only available on iOS and Android sdk 24+.
pauseVideoStreamPlay() Future<void>
Pause video stream play. Only supports ios
prepareForVideoStreaming() Future<void>
Prepare the capture session for video streaming.
removeFilter(int type) Future<void>
The remove filter
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
resumeVideoRecording() Future<void>
Resume video recording after pausing. Only supports Android This feature is only available on iOS and Android sdk 24+.
resumeVideoStreamPlay() Future<void>
resume video stream play. Only supports ios
setAudioSettings(int bitrate) Future<void>
set Audio Settings Only supports ios
setFilter(int type, {String? filePath}) Future<void>
The set filter
setFrameRate(int frameRate) Future<void>
set Frame Rate Only supports ios
setHasAudio(bool isEnable) Future<void>
Set temporary mute Only supports ios
setHasVideo(bool isEnable) Future<void>
Set temporary Video Only supports ios
setScreenSettings(int width, int height) Future<void>
set Screen Settings Only supports ios
setSessionPreset(String sessionPreset) Future<void>
set Session Preset Only supports ios
setVideoSettings({int? bitrate, int? width, int? height, int? frameInterval, String? profileLevel}) Future<void>
set video Settings Only supports ios
startVideoRecording(String filePath) Future<void>
Start a video recording and save the file to path.
startVideoRecordingAndStreaming(String filePath, String url, {int bitrate = 1200 * 1024, bool? androidUseOpenGL}) Future<void>
Start a video streaming to the url in url`.
startVideoStreaming(String url, {int bitrate = 1200 * 1024, bool? androidUseOpenGL}) Future<void>
Start a video streaming to the url in url`.
stopRecordingOrStreaming() Future<void>
Stop streaming and Recording.
stopVideoRecording() Future<void>
Stop recording.
stopVideoStreaming() Future<void>
Stop streaming.
switchAudio(bool isEnable) Future<void>
switch Audio
switchCamera(String cameraId) Future<void>
switch CameracameraId`.
switchFlashLight(bool isEnable) Future<void>
switch Flash Light
takePicture(String path) Future<void>
Captures an image and saves it to path.
toString() String
A string representation of this object.
inherited

Operators

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