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="..\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\$(Configuration)\$(TargetFramework)\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.
Acceptance Issue
Running app type 2. from Visual Studio.
- When deploying app from Visual Studio, get the Allow TheApp to take pictures and record video prompt
- Upon accept splash screen shows but goes nowhere.
- Have to close app and run from phone, but get the same prompt again.
- Have to close app and run 3rd time from phone again but works this time and subsequently.
- If instead, activate run from VS then keep get the prompt each time.
- So can’t debug app.
Some output
When running with type 2. solution get he following at startup:
Android application is running (debug is disabled in android project properties).
Forwarding debugger port 8806
Detecting existing process> am start -a "android.intent.action.MAIN" -c "android.intent.category.LAUNCHER" -n "au.com.sportronics.mauiandroidvideocaptureapp/crc644e8ab2d73d770d6b.MainActivity"> Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=au.com.sportronics.mauiandroidvideocaptureapp/crc644e8ab2d73d770d6b.MainActivity }
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? |

