Using the Camera in .NET MAUI with CameraView
Working with the camera is a staple of mobile apps, and the .NET MAUI Community Toolkit’s CameraView lets you build that experience without punting to an external app. Héctor Pérez shows how to take full control of preview, flash, zoom, and capture — and where the files end up.
What you’ll learn
- Setting up CameraView — installing
CommunityToolkit.Maui.Camera(plus MVVM) and initializing withUseMauiCommunityToolkitCamera() - Per-platform permissions — Android manifest
CAMERA/RECORD_AUDIOentries, iOSNSCameraUsageDescription/NSMicrophoneUsageDescription, and requesting them at runtime - An MVVM view model — observable properties for camera name, zoom range, flash mode, recording state, and last photo/video paths
- Building the UI — binding
CameraFlashMode,IsTorchOn,SelectedCamera, andZoomFactor, with controls for zoom, torch, and flash - Capturing media —
CaptureImage,StartVideoRecording/StopVideoRecordingwith streams, enumerating cameras viaGetAvailableCameras, and handlingMediaCaptureFailed
Read the full article for the complete view model, XAML page, and code-behind capture handlers.