Repository navigation
v7.0.0 Camera Bug Fix-A-Palooza 🎉 #3385
TheCodeTraveler
announced in
Announcements
Replies: 1 comment 3 replies
|
When will it be available for download on NuGet? |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We have FINALLY implemented Device Tests! These are platform-specific unit tests that run on iOS, Android, MacCatalyst and Windows. This allows us to unit test all platform-specific code and has MASSIVELY increased our Unit Test Code Coverage to 96.7% Code Coverage on
CommunityToolkit.Maui.Camera.New APIs in This Release
CameraView.ErrorOccurredandErrorOccurredEventArgs(CameraView: Fixed crash on Windows when app has no camera access anymore #3299)Breaking Changes
To fix certain bugs, and re-align features to ensure they behave the same across all platforms, we did have to modify some APIs and the associated underlying behavior. Please find the features you use, below, and update your apps accordingly.
All packages
ArgumentNullExceptionat the call. Public and protected members of the five libraries now guard the non-nullable reference parameters they cannot handle (about 275 guards).NullReferenceExceptionlater (or was stored silently) fails at the call, with aParamName. What to do: fix the caller.IProgress<double>or aPaintbackground of null.BasePlatformBehaviorguards onlybindable. A null platform view passes through, because the AndroidIconTintColorBehavioraccepts it.<queries>entry for the launcher (MAIN/HOME) to the app's merged manifest through the package's library manifest (src/CommunityToolkit.Maui.Core/AndroidManifest.xml). Badge needs it on Android 11 and later. If your app or Play listing reviews<queries>, check the merged manifest.System.Speech10.0.11 (it was 10.0.1). No action is needed unless you pin the package. This comes from Update Unit Tests Packages #3288 on main, not from this PR.API
ErrorOccurredEventArgs,MediaCaptureFailedEventArgsandCameraInforeject null for their non-nullable members.Behavior
StartCameraPreview(CancellationToken)no longer throws for a camera that cannot start (except in the Android failed-connection case below). It raisesErrorOccurredon every platform.OperationCanceledException.InvalidOperationException.CaptureImageCommand,StartVideoRecordingCommandandStopVideoRecordingCommandreport throughMediaCaptureFailed.StartCameraPreviewCommandandStopCameraPreviewCommandreport throughErrorOccurred.SelectedCamera, applyingImageCaptureResolution) raiseErrorOccurredinstead of ending the app.CaptureImagebefore the camera has started throwsCameraExceptioninstead of waiting until its token is cancelled.ErrorOccurredandMediaCaptureFailedinstead of relying on try/catch.ErrorOccurredfor a failed connection. AStartCameraPreviewcalled while theCameraViewconnects to its camera waits for the connection.ErrorOccurred, thatStartCameraPreviewthrows the same failure to its caller instead of raisingErrorOccurredagain.StartCameraPreviewCommanddoesn't report it again.StopCameraPreviewcancels starts that still wait.StopCameraPreviewandStopCameraPreviewCommandnow cancel a pendingStartCameraPreview, a pendingStartVideoRecording(both overloads), the start the view makes when it connects its camera, and a camera switch.OperationCanceledException, with noErrorOccurredorMediaCaptureFailed. A start that a stop interrupted needs a new start.StartCameraPreviewwith an already-cancelled token throws and no longer starts the session.StartVideoRecordingduring a recording replaces it: the new stream receives the video, and the earlier recording's video is discarded. Camera 6.1.0 ignored the second start; iOS and Mac Catalyst already replaced it.StartVideoRecordingreturns only once the platform has started the recording (Await native video recording start acknowledgment #3311), soawaitit before relying on the recording. On iOS and Mac Catalyst, a start cancelled while it waits releases the recording state.StopVideoRecordingwaits for a pendingStartVideoRecording.StartVideoRecordingor a secondStopVideoRecordingthat arrives while a stop waits for Media Foundation to finish the recording waits for that stop.StopVideoRecordingthrowsCameraExceptionon Android, iOS and Mac Catalyst when the platform reports a recording with no playable video. A recording the platform ended early that has usable video is still returned.StopVideoRecordingstill returns the video, and the failure is raised throughErrorOccurred. Selecting another camera during a recording waits until the recording stops or is replaced.StopVideoRecordingwhose token is cancelled already or while the stop finishes the video:OperationCanceledException, as on Android, iOS and Mac Catalyst. It used to ignore the token and return the video.StopVideoRecordingreturns the video. AStartVideoRecordingthat comes first discards it and puts its stream back, as for a replaced recording.StopVideoRecordingreturnsStream.Nullon every platform.StopVideoRecordingCommandends without an event.OperationCanceledExceptionand callStopVideoRecordingagain to get the video.StartVideoRecordingduring a recording ends and finishes the running recording and discards its video.StopVideoRecordingbefore a new start.ErrorOccurredandCameraException. On Android, don't rely on a second start being ignored.StartVideoRecordingafterStopCameraPreview, or beforeStartCameraPreview, starts the camera and then the recording. Android already did; Camera 6.1.0 recorded nothing on iOS, Mac Catalyst and Windows.StopVideoRecordingon Android, iOS and Mac Catalyst, it turns off only once the next stop returns the video.StartVideoRecordingthrows the failure: for example aCameraExceptionwithout a camera or without the camera permission, or on Windows anUnauthorizedAccessExceptionwhen the privacy settings block the camera.StartVideoRecordingCommandreports it throughMediaCaptureFailed.StartCameraPreviewafterSetExtensionModeon a stopped preview shows theSelectedCamera. Camera 6.1.0 kept showing the camera that was selected whenSetExtensionModeran.StartCameraPreviewwhile the preview already runs is a no-op.StartCameraPreviewwhile an earlier start is still opening the camera releases that start'sMediaCapture, so the camera is never held twice.StopCameraPreviewduring a recording ends the recording, like on Android. A laterStopVideoRecordingreturnsStream.Null, so do not expect a video from a recording that a stop ended.Smaller changes
CameraViewHandler.PlatformViewFactory:MediaPlayerElementshows the preview. Another element shows none, and a warning is written to the trace output.ZoomFactorandIsTorchOnagain after another screen, such as FileSaver's save dialog or Home.What's Changed
This discussion was created from the release v7.0.0 Camera Bug Fix-A-Palooza 🎉.
All reactions