Video Capture: Maui Android Phone App ... With Issues
Using CommunityToolkit.Maui.Camera to implement Video Capture on an Android phone first as a self contained app, then separate video into a class library and finally using that functionality as a NuGet package. NuGet package has been published and the app that uses is available on GitHub. Some issues remain though.
Links
- App Version 3 GitHub Repository: djaus2/MauiMediaRecorderVideoAndroidApp
- GitHub Repositories for version 1. and 2. not yet public
- NuGet Package: djaus2_MauiMediaRecorderVideoLib
Situation
#### 1. Have created an MAUI Android app that can capture video using the phone’s rear facing camera.
- Video Preview
- No audio, no front facing camera option.
- FPS and Image Stabilization options.
- Built initially as a self contain app with UI and Video as one project.
#### 2. Modularisation of Video Functionality
- Object is to encapsulate the Video functionality in a reusable Class Library
- First step was to partition app into Class library with Video functionality and leave UI in app
- Implemented by making 2 copies of original app
- Modify one to just have video functionality as the Class Library
- Remove video functionality as much as is possible from app, but link to Class Library project
#### 3. NuGet Package version
- Build and publish class library from 2. as NuGet package.
- Create new solution including copy of app project from second solution but install NuGet package for video functionality
Outcomes
- Works as Debug and Release builds
- Tested on Google Pixel 6 phone
- Debug build works but needs direct link the lib’s built DLL. Method (b) below.
- Release build fail
- Debug build works
- Release build fails
Linkage of the library
(a) Normal “Add Project Reference” approach
In app project file:
<ItemGroup>
<ProjectReference Include="..\..\MauiMediaRecorderVideoSample7a\MauiMediaRecorderVideolib\MauiMediaRecorderVideoLib.csproj" />
</ItemGroup>
(b) Direct Assembly Reference
In app project file:
<ItemGroup>
<!-- Replace project reference with direct assembly reference -->
<Reference Include="MauiMediaRecorderVideoLib">
<HintPath>..\MauiMediaRecorderVideolib\bin\Release\net9.0-android\MauiMediaRecorderVideoLib.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
(c) Nuget Package
In app project file:
<ItemGroup>
<PackageReference Include="djaus2_MauiMediaRecorderVideoLib" Version="1.0.2" />
</ItemGroup>
Achievements thus far.
- Can get video capture working
- Can do so for all 3 versions as Debug builds
- Can get version 1. of the app to run in Release mode.
Remaining Tasks
Overall the main objective is to the NuGet package working with version 3 of the app.
- In project 2 get link to class library via that’s project file.
- Get Release version of project 2 working with both ways of linking.
- Get NuGet package Release build to work.
Topic | Subtopic | |
< Prev: | GitHub Copilot v Documentation | How far can you go with Copilot |
This Category Links | ||
Category: | Xamarin Index: | Xamarin |
< Prev: | Introduction | What is this sequence of posts about? |

