Maui icon indicating copy to clipboard operation
Maui copied to clipboard

Camera view initial work (iOS)

Open Dresel opened this issue 1 year ago • 19 comments

As discussed in Discord, this is the draft PR of my contribution for the iOS part for the camera view proposal, mostly as starting point for discussion / feedback.

It is based on the original branch / PR pj/cameraView-initial-work. These are the things I have done:

  • Added missing AndroidX Camera packages
  • Fixed some compiler warnings regarding IDisposable (CA1001)
  • Added the ViewHandler and CameraManager for iOS for previewing and photo triggering
  • Updated the sample page (iOS does not seem to be happy without height requests in the vertical stack layout, but I'm no definitely no expert on layouting)

The following things are still missing (might get it done until end of this week):

  • Flash & Availability check
  • General implementation and testing of the cleanup logic (Disconnect, Dispose, etc.)
  • Unify CameraViewHandler - most if not all of the code of the ios / android file could be moved to the shared handler

Dresel avatar Sep 05 '23 18:09 Dresel

@pictos I have integrated your feedback and added flash mode for ios. I have also created a gallery page (Views / Camera View).

Do we want to handle permissions? Or do we assume that the user only uses the camera view if permissions are granted? Connect obviously fails if permissions are not granted.

Cleanup / Error handling is still on my to-do but apart from that I think the ios implementation is good to go. Waiting for a colleague so I can test on macOS / MacBook.

Dresel avatar Sep 11 '23 11:09 Dresel

My colleague did check on macOS - apart from that flash modes might not be supported - everything works identical as on the iOS device.

We use the first supported flash mode as fallback if the given flash mode is not found. Might be something for the next api proposal (supported flash modes).

Dresel avatar Sep 19 '23 09:09 Dresel

@pictos Should I go on with the windows implementation? Should I wait for feedback and further iOS requests / changes? What do you think?

Dresel avatar Sep 19 '23 09:09 Dresel

@pictos Should I go on with the windows implementation? Should I wait for feedback and further iOS requests / changes? What do you think?

I'm happy to take a look at the current changes. If you are up for it and available then I would say please go ahead with the windows bits too. Thank you

bijington avatar Sep 21 '23 07:09 bijington

@pictos Should I go on with the windows implementation? Should I wait for feedback and further iOS requests / changes? What do you think?

I'm happy to take a look at the current changes. If you are up for it and available then I would say please go ahead with the windows bits too. Thank you

Would you consider a (preview) release without a windows implementation or is this mandatory? Asking for a customer who is not in the need of a windows implementation.

Dresel avatar Sep 25 '23 05:09 Dresel

Would you consider a (preview) release without a windows implementation or is this mandatory? Asking for a customer who is not in the need of a windows implementation.

@Dresel if there's a Windows control for CamareView (which I believe there isn't) we should implement it. I'll double-check if the winui team released something

pictos avatar Sep 25 '23 13:09 pictos

@pictos you might want to check https://github.com/hjam40/Camera.MAUI/tree/master/Camera.MAUI/Platforms/Windows

Dresel avatar Sep 25 '23 14:09 Dresel

@Dresel I'm aware of that repo, but we will not go to that path, where we need to create a CameraControl, we want to use whatever the platform gives to us. That said, we (probably) will not ship the CameraView for Windows until the winui team provides a control for it.

pictos avatar Sep 25 '23 14:09 pictos

I only found the "semi official" camera preview from the CommunityToolkit Windows repository which I guess we won't include?

Dresel avatar Sep 26 '23 05:09 Dresel

No, we're following this issue https://github.com/microsoft/microsoft-ui-xaml/issues/4710

pictos avatar Sep 26 '23 13:09 pictos

So I guess the Windows part is off the table? Just let me know if there is anything I can do to advance / finish this PR.

What about CameraLocation? Is this just for testing purpose or something you want to publish (couldn't find it in the initial proposal)?

Dresel avatar Sep 29 '23 05:09 Dresel

@pictos @Dresel Is it possible to move this forward without the Windows bits?

peruchali avatar Oct 26 '23 07:10 peruchali

@peruchali yes, that's the plan

pictos avatar Oct 26 '23 16:10 pictos

Hi, Some release forecast?

Thank you

ricardocesarcara avatar Nov 16 '23 11:11 ricardocesarcara

What is the status of this? @pictos I see you had some review comments left. Is there anything I can pick up to assist getting this completed?

bijington avatar Dec 04 '23 21:12 bijington

@bijington can't remember on the top of my mind, need to take a look into it and see... Will find find time to review this week

pictos avatar Dec 04 '23 23:12 pictos

@bijington @pictos I'm still eager to help - let me know if there is something for me to do.

Dresel avatar Dec 05 '23 05:12 Dresel

@Dresel I'm aware of that repo, but we will not go to that path, where we need to create a CameraControl, we want to use whatever the platform gives to us. That said, we (probably) will not ship the CameraView for Windows until the winui team provides a control for it.

Why can't we use either https://github.com/CommunityToolkit/Windows/blob/ce82ac235bded01f8bc2f2b6ff64a5b0574998b9/components/CameraPreview/src/CameraPreview.cs or https://github.com/hjam40/Camera.MAUI/tree/master/Camera.MAUI/Platforms/Windows for Windows until the WinUI team provides a control for Windows? I've been tinkering with various CameraView implementations on Windows with MAUI for some time, and I'd love to implement a temporary working CameraView for Windows (once you merge the Android and IOS implementations, so that I know the final version of the "interface" I need to provide).

It can always be swapped later once the WinUI control exists. [https://github.com/microsoft/microsoft-ui-xaml/issues/4710](The issue) you mentioned, which this problem is following, is almost 3 years old, so the chance of an "official" control being implemented soon is like zero. If by some miracle the WinUI team actually implements this control, you can literally click delete on the files I'd commit and use the WinUI thing. I get your point, that MAUI should always use the maximum amount of native controls, but why not have a working "less clean" solution until a native control exists?

I don't have the skills and knowledge to implement this for Android or IOS, but I'd love to implement it for Windows if you let me

StonedHackerman avatar Jan 09 '24 20:01 StonedHackerman

Hello all. I'm trying to find out if this is still being worked on. I have a Xamarin.Forms app that utilizes the XTC CameraView. It's a huge part of our app. XTC MauiCompat CameraView for iOS does not work and I was hoping that I would find that view here as I am in the process of converting the app to .NET MAUI. With the looming May 1st end of support deadline for Xamarin.Forms approaching fast, I would like to humbly ask if the CameraView will available in the near future? I read above that @Dresel said the iOS is pretty much ready to go. I see a lot of the latest dialogue is around the Windows version of the view. Is it possible to release the iOS and Android versions first without the Windows portion? Thanks.

mroseberry99 avatar Feb 06 '24 15:02 mroseberry99