-
Notifications
You must be signed in to change notification settings - Fork 328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WinUi 3 desktop app doesn't open camera. and is there any way that can open default system camera and capture image #1034
Comments
I think CameraCaptureUI requires you to invoke IInitializeWithWindow and pass the window handle. |
hi @JaiganeshKumaran , https://gist.github.com/wbokkers/cc8bcc7bc5a646b82a4d41b337330c69 here FileOpenPicker IInitializeWithWindow . I was same tried for CameraCaptureUI IInitializeWithWindow,but it's giving Exception "Element Not Found".I do not know CameraCaptureUI have different Guid or not. |
Looks like the |
Is there any workaround in the meantime? |
Just do exactly like Apple and everything will be fine. I know this new Windows SDK is 15 years behind the SDK of Android and Apple, so I won't be too mean. Our app cannot release until we have access to the camera, we need to be able to scan documents with a camera. |
CameraCaptureUI is probably implemented as a wrapper on Launcher::LaunchUriForResultsAsync as it opens the Windows Camera app in a modal dialog, but Launcher::LaunchUriForResultsAsync doesn't work in desktop apps. |
Any update on this issue? |
No, surely things will get resolved over time. After all, the hide-task-bar is still not working half the time 25 years later in Windows 11. |
@jonwis What happens with this issue, please? This bug is now included in official release of .NET MAUI. That's not good. |
Still wating for this issue to be resolved. |
+1 here. |
@jonwis any progress? |
So, is this bug the reason why the "Camera" permission is listed as not supported for Windows on this MAUI docs page? https://docs.microsoft.com/en-us/dotnet/maui/platform-integration/appmodel/permissions?tabs=ios#available-permissions |
You can use DirectShow (WinUI3_DirectShow_Capture) |
I used CameraCaptureUI with Winui 2 |
CameraCaptureUI works fine in UWP but doesn't work in WinUI3. |
Any progress on this? A similar thing is happening for me using the Windows.Devices.PointOfService.PosPrinter API, calling PosPrinter.FromIdAsync(deviceInfo.id) returns null in MAUI/WinUI3. Exactly the same code, with the same pointOfService capability enabled in the mainifest, works fine with Xamarin Forms/UWP. This would normally pop up a dialog for the user to confirm they want to pair with the printer, so I'm guessing this is a similar issue to this: |
Don't the docs say that the |
Well, they come under /UWP in the docs hierarchy but it seems strange that this whole swathe of useful, generic device functionality is only available to UWP apps. If it is UWP only, the namespace Windows.Devices.PointOfService is not very clear, it suggests to me that any Windows app whether written in C++, C# or VB.Net, and using any UI framework, should be able to use it. It's not like we have a choice - Xamarin is being deprecated, UWP is clearly being phased out and MAUI only supports WinUI3. Two years into a project to port a legacy system to modern cross-platform technologies we have essentially had the rug pulled from under us. After all, most of this stuff - cash drawers, stripe readers, receipt printers etc - does not require any UI, especially in a non-sandboxed world outside of UWP. The dialog that asks you to pair with the printer (it's not even bluetooth, just ethernet) is completely unnecessary in a commercial environment, it preferably just gets done silently in the background. Fortunately one of the brand of printers we use has their own SDK but we switched away from that to give us the flexibility to switch to any other brand that supports the POS standard. Hopefully there will be no issues with switching back... |
I have the same problems. Any info? |
My UWP app uses I know that I could implement this myself in a different way when migrating to the Windows App SDK. But why would I have to? A QR code scanner is such a standard building block that it just makes no sense at all not having it in the Windows App SDK. |
It is sad that nobody from Microsoft steps in to say when this will be fixed. As a result of WinUI's fault, this is broken in both Maui and Uno. And I must develop an app that captures pictures... Sweet, isn't it. |
@nikolayvpavlov I haven't tried this myself but I have seen a workaround for taking pictures here. Maybe it helps. |
@jonwis @btueffers after 6 months I am asking again, any progress? Who is responsible for these issues? Why is (seemingly) noone doing anything? |
Stop it, don't hurt yourself anymore. Microsoft has abandoned Windows 15 years ago. You should port your app to Android and it will run natively on Windows 11 from the Amazon Store. We are in the same situation, the code is done since 2019 but we are still waiting for MS to provide us with a working webview that support Web 2.0. Webview2 is still not working, It is unusable. We are stuck with a useless windows app for 3 years now and it will never work. MS is 15 years behind Android, iOS, macOS, Linux... They don't care about new apps. Microsoft is only used to run legacy software nowadays. Good luck my friend. You should not keep trying at this point, Microsoft does not love you. |
I think this PR will fix mui by using the cool community code, but maybe it can somehow be integrated into this SDK? dotnet/maui#13220 |
Or also IMFCaptureEngine that I tested on Windows 10 (WriteableBitmap + Image control), with audio/video recording easy to use (StartRecord does all the work, without implementing IMFCaptureSink) |
I found a work around that works in 1.2 it uses LaunchUriForResultsAsync in a self-contained WinUI3 x64 desktop app (which I put together from various partial examples I found online):
|
Thank you @NicholasChrzan for the workaround. Found this from this trail: I need this for a dotnet MAUI project. OK now @microsoft SERIOUSLY? This is STILL an issue after 2 years? Does anyone see the create date is JULY 3 2021? What's going on over there? |
Another vote from a Xamarin user currently converting to .net Maui. Rather surprised to find THIS still being an issue. |
I think we worked around this by launching the camera app directly in maui: dotnet/maui#13220 This should be working in .NET 8 now. Does Windows have the ability to change the "default camera app"? Not sure if we are losing a feature by launching the windows camera directly. Not sure I ever saw a way to set an alternate default. Another question would be if the code is correct (or as correct as a workaround can be) or if we are missing something? |
Hi everyone, To test, please retarget your project to WASDK version 1.7.241114004-experimental1. As an optional step, you can enable the "Send diagnostic data" option to help us gather data on the API’s reliability. Please check this box under: Privacy & security -> Diagnostics & Feedback -> Send Optional Diagnostic data! |
Last, but not least: all these helpers in MainWIndow.xaml.cs must be integral part of the API without need for interop with Win32. |
I think in the old days, UWP was sort of a "single window" world, so none of this mattered. But with WinUI and all the multi-window worlds, a modal dialog has to block some window and thus you need to specify which one. Some magic could be added if you only have one window, then just use that. But, this now adds a layer of "worked when I did this, but now crashes with missing window errors" because the first test you only had 1 window, and the second test you had 3 windows. I think it all has to do with the modal window idea. Maybe this API should not be blocking and have a non-modal option? So if you don't pass in a window ID then it just pops up a dialog with no blocking of the other windows. |
Hi @nikolayvpavlov Regarding your points: WindowId Constructor Parameters: We appreciate your suggestion to make the constructor more intuitive by passing the current page/window/parent directly. However, for now, we’ve kept the windowId parameter to ensure to support WinUi3 AppWindow (has Id()) & Window, and also Win32 apps which might be using HWNDs. Could you elaborate on the difficulties you see with the WindowId? Capture on Stream: Great feedback. For WASDK1.7 release, our primary goal is to uplift the original UWP CameraCaptureUI API and support it in the WinAppSDK. We will explore it in upcoming release. |
@mattleibow Thank you for sharing your thoughts. We believe the current behavior of blocking the window is by design. The CameraCaptureUI flow is intended to be a modal interaction, meaning it should start and complete before allowing other user interactions. This ensures the camera capture process is smooth and doesn’t conflict with other UI actions, there also might be hardware limitations. Could you elaborate on the issue you mentioned: "worked when I did this, but now crashes with missing window errors"? |
CameraCaptureUI captureUI = new CameraCaptureUI();
The text was updated successfully, but these errors were encountered: