Avalonia
Avalonia copied to clipboard
provide an camera control
Provide an basic camera control with support to
- Take photo
- Scan a barcode / qrcode
- take video
while avalonia essentias is too big and tooo far far away of stability, avalonia ui needs an basic camera control, because camera is an essential feature to developper.
Describe the solution you'd like A clear and concise description of what you want to happen.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
because camera is an essential feature to developer
I undestand that it may be neccessary to you, but this is a bit of a stretch
To me and to milions of mobile developers that need scan an qrcode to accept an visitor, or take a picture to get a profile photo, or to develop an social media aplication, or to ddvelop an payment aplication that scan an billing barcode, etc etc etc... camera is an essential multiplatafor resource.
It's unlikely to be included in Avalonia, but could be included in an additional Labs package. Or a third-party package.
For now, you can use native APIs from net6.0-android
and net6.0-ios
targets. If you need to embed native control, please use NativeControlHost.
Alternatively, you can use MAUI controls (which would do the same above, but with additional layer of abstractions), and then embed MAUI control inside of the Avalonia: https://github.com/AvaloniaUI/AvaloniaMauiHybrid. The same goes for MAUI.Essentials Camera/media APIs.
https://github.com/kekyo/FlashCap Perhaps this will be useful for you in Windows and Linux
It's unlikely to be included in Avalonia, but could be included in an additional Labs package. Or a third-party package.
For now, you can use native APIs from
net6.0-android
andnet6.0-ios
targets. If you need to embed native control, please use NativeControlHost.Alternatively, you can use MAUI controls (which would do the same above, but with additional layer of abstractions), and then embed MAUI control inside of the Avalonia: https://github.com/AvaloniaUI/AvaloniaMauiHybrid. The same goes for MAUI.Essentials Camera/media APIs.
this is the problem. I don't want to have to do hacks or use hybrid solutions in my development. If I need to go to Maui to develop, why use Avalonia and not develop everything directly in Maui? avalonia should be robust enough to read the camera and to display multimedia, which implies media control and camera control. WinUi and UWP has it, WPF has it, Maui has it, Android (java) has it, IOS has it, why won't Avalonia have it? Will avalonia be the only framwork that doesn't handle multimedia well? How to justify development in Avalonia to the “bosses”?
It's unlikely to be included in Avalonia, but could be included in an additional Labs package. Or a third-party package.
For now, you can use native APIs from
net6.0-android
andnet6.0-ios
targets. If you need to embed native control, please use NativeControlHost.Alternatively, you can use MAUI controls (which would do the same above, but with additional layer of abstractions), and then embed MAUI control inside of the Avalonia: https://github.com/AvaloniaUI/AvaloniaMauiHybrid. The same goes for MAUI.Essentials Camera/media APIs.
I looked at the sample but I do not tried. If we can use Camera like that, it do not look too complicated. But maybe the setup tu use Maui or Maui Essential can be integrated to the app creation wizard, in the same way as Compiled Bindings optin or Mvvm option.
Well... using Maui.Essentials works - at least on Android and iOS. However, our users were used to also take pictures on UWP - but with Avalonia, this is now not an option anymore.
Maui.Essentials implements "Taking a picture" for WinUI - but I know too little to say whether I can acutally use this in AvaloniaUI on Desktop (Windows) - I guess "no" :-|
As per https://www.nuget.org/packages/Microsoft.Maui.Essentials/, Maui.Essentials relies on net8.0-windows10.0.20348
and net8.0-windows10.0.19041
targets. Until you are fine with these targets, it should be possible to use them with Avalonia. Just update your Target Framework and include these packages.
AvaloniaMauiHybrid
doesn't include this target, so you likely will need Platform.Init. Or not, depends on the API you use.
nah not so much...
Checked out https://github.com/AvaloniaInside/Shell
Modified the ShellExample.Desktop csproj from
<TargetFramework>net8<TargetFramework/>
to
Got:
In order to get it to build, I had to add <UseMaui>True</UseMaui>
and set a <RuntimeIdentifier>win10-x86</RuntimeIdentifier>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<UseMaui>True</UseMaui>
<RuntimeIdentifier>win10-x86</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)"/>
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)"/>
</ItemGroup>
<PropertyGroup>
<UseMauiEssentials>true</UseMauiEssentials>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ShellExample\ShellExample.csproj"/>
</ItemGroup>
</Project>
Then it compiles but throws:
🙈