question

Matthias-7869 avatar image
0 Votes"
Matthias-7869 asked ·

UWP: CameraCaptureUI starts new Camera Task if no photo is taken

Hello,

i have a Xamarin.Forms app. In the UWP project i have code to take an photo which i call using the DependencyService.

The code is very similar to the example code from here: https://docs.microsoft.com/en-us/uwp/api/windows.media.capture.cameracaptureui

 public async Task TakePhoto()
 {
     CameraCaptureUI captureUI = new CameraCaptureUI();
     captureUI.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
     captureUI.PhotoSettings.CroppedSizeInPixels = new Windows.Foundation.Size(200, 200);
     StorageFile photo = await captureUI.CaptureFileAsync(CameraCaptureUIMode.PhotoOrVideo);
 
     if (photo == null)
         return;
 }
 

What happens:

  • The camera opens as desired

  • if i take a photo everything is fine

  • if i decide to close the camera app using the x in the top right corner, the camera app is closed as desired

  • but i can see a new "Camera" thread in task manager

  • This new thread is blocking other apps from using the camera (e.g. barcode scanner)

This behavior is reproducible with other apps already in the store (e.g. Ultimate Photo Editor).

My test device is an "Surface Go Model 1824" and i'am using "Rear" camera, not the "Front" camera.

Kind Regards

Matthias

uwp
· 5
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I test with latest version 1909, everything works fine, even I close the camera without taking photo, and it will not block other camera using apps.

0 Votes 0 · ·

1824 is the version of the tablet. The windows version is 1903. I'll try to get an update.

What device are you testing? Meanwhile i tested a notebook which has only a webcam and it worked fine.

Kind Regards

Matthias

0 Votes 0 · ·

I test within desktop and my camera is Microsoft lifecam hd-3000.

0 Votes 0 · ·
Show more comments

0 Answers