-
-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Working with this lib my team has found several issues that could be improved.
-
the Command creation in example MVVM code should/could be integrated into the
CameraViewitself to make it easier to use by simply binding to the commands in application code instead of every application having to re-create this. https://github.com/hjam40/Camera.MAUI/blob/master/Camera.MAUI.Test/MVVM/CameraViewModel.cs -
ICameraViewis virtually useless as it lacks most of the public members. -
Several of the open issues relate to the commands for Async-method access/binding not being included, and the way the
Camerascollection loads async (or at least after the view is on screen and binding has already run), combined withAutoStartPreviewPropertyandAutoStartRecordingPropertynot usable until after the.Cameraproperty is set AND they hide the async methods inside of PropertyChanged event handlers. This hiding can cause crashes when navigating away from a page hosting this view since there's no way to really await the stopCamera()...
I'll see if I have time to push up a branch to start at least addressing # 2 above. We are currently wrapping this view in our own view to allow injecting a service to redirect some of these issues, and this interface is a starting point to allow for that.
public interface ICameraViewEx : Camera.MAUI.ICameraView
{
/// <summary>
/// The camera view is currently mirroring the image.
/// </summary>
bool MirroredImage { get; set; }
Task<CameraResult> StartRecordingAsync(string file, Size Resolution = default(Size));
Task<CameraResult> StopCameraAsync();
int NumCamerasDetected { get; }
ObservableCollection<CameraInfo> Cameras { get; }
int NumMicrophonesDetected { get; }
ObservableCollection<MicrophoneInfo> Microphones { get; }
bool AutoStartPreview { get; set; }
}
The best options for adding async-commands are covered here:
https://stackoverflow.com/questions/72277317/asynccommand-in-net-maui