github CommunityToolkit/Maui 1.0.0-camera
v1.0.0 CameraView: Smile for the Camera!

latest releases: 9.1.1, 2.0.4-maps, 4.1.2-mediaelement...
5 months ago

Get in line to high-five @zhitaop and take a selfie 🤳 with him through the new camera control we now have because of him!

Zhitao almost single-handedly did all the work to port CameraView over from Xamarin to .NET MAUI. In fact, its a great story, because the company where he works is a big fan of the .NET MAUI Community Toolkit (and open-source in general) and this is their way to contribute back by donating time to contribute code that they need themselves.

This release is a separate package from the main Toolkit, just like the Windows Maps and MediaElement. We decided to name the package to just Camera so that we can also add other things to this amazing control. But the control itself will still be named CameraView. If you want to install the NuGet, go look for CommunityToolkit.Maui.Camera.

For v1, we tried to stick with the core functionality first and make that work as stable as possible and from there branch out to all the amazing things we can come up with for a camera.

We think you will love this, please let us know!

If you decide to go try it out, maybe the docs will come in handy as well to get you started. Find those here: https://learn.microsoft.com/dotnet/communitytoolkit/maui/views/camera-view

Again, a big thank you to @zhitaop and his company and others who helped make this possible. A big milestone for our little project!

Added APIs

Have a look at all the APIs we added for this below.

public class CameraView
{
    public static readonly BindableProperty SelectedCameraProperty;
    public static readonly BindableProperty ZoomFactorProperty;
    public static readonly BindableProperty ResolutionProperty;
    public static readonly BindableProperty IsCameraBusyProperty;
    public static readonly BindableProperty IsAvailableProperty;
    public static readonly BindableProperty FlashModeProperty;
    public static readonly BindableProperty IsTorchOnProperty;

    public event EventHandler<MediaCapturedEventArgs> MediaCaptured;
    public event EventHandler<MediaCaptureFailedEventArgs> MediaCaptureFailed;

    public CameraInfo? SelectedCamera { get; set; } // To be discussed: ActiveCamera?
    public float ZoomFactor { get; set; }
    public Size CaptureResolution { get; set; } //  renamed from `Resolution`
    public bool IsCameraBusy { get; set; }
    public bool IsAvailable { get; set; }
    public bool IsTorchOn { get; set; }
    public CameraFlashMode FlashMode { get; set; }

    public void Shutter()
    public void Start()
    public void Stop()
}

public enum CameraFlashMode
{
    Off,
    On,
    Auto
}

public class CameraInfo
{
    public string Name { get; }
    public string DeviceId { get; }
    public CameraPosition Position { get; }
    public bool IsFlashSupported { get; } //To be discussed:  adding a list of capabilities like Auto Focus, etc?
    public float MinimumZoomFactor { get; }
    public float MaximumZoomFactor { get; }
    public IReadOnlyList<Size> SupportedResolutions { get; }
}

public enum CameraPosition
{
    Unknown,
    Rear,
    Front
}

public class CameraProvider
{
    public ObservableCollection<CameraInfo> AvailableCameras { get; }
    public void RefreshAvailableCameras();
}

What's Changed

New Contributors

Full Changelog: 9.0.1...1.0.0-camera

Don't miss a new Maui release

NewReleases is sending notifications on new releases.