- Note: Renamed from MauiMediaRecorderVideoAndroidApp
An Android Maui App for video recording Athletcs (or similar sport) finish of a race and for sending it locally over TCP to a complementary Windows WPF app for Photo Finish processing.
This receives the video file transmitted from this app:
- AthStitcher project from the repository djaus2/PhotoTimingDjaus that does Photo Finish processing of video.
- Also simpler WPF app TransferVideoOverTcpthat only handles transfer from an Android MAUI app and reception by WPF app in repository: djaus2/TransferVideoOverTcp
- This app is used for testing the transfer protocol.
- SendVideo (The Maui-Android phone app)
- Uses SendVideoOverTcpLib
- An updated version of the lib is included here.
- GetVideo (The 2nd Complementary WPF app)
- Uses ReceiveVideoOverTcpLib
- As used in the AthStitcher App.
Note In most the recent version of this app, meta-information is no longer passed from recording to transmission as appendages to the filename but is added as a json string as a video file comment at the end of recording. This is then recovered prior to transmission and used to recreate the VideoInfo for transmission prior to the video's transmission.
-
Full-screen camera preview
-
Video recording with MediaRecorder
- Audio can be used for GunFire race start detection.
-
Image stabilization options (Standard or Locked)
-
Camera rotation support (0, 90, 180, 270 degrees)
-
Configurable video FPS (30, 60, or default)
- Note for 60 FPS with Google Pixel phone need to:
- Camera Settings
- Advanced
- Turn off Store videos efficiently
- Probably best to do that for 30 FPS as well otherwise get dynamic FPS
- Note for 60 FPS with Google Pixel phone need to:
-
Support for pausing and resuming recording
-
Proper handling of Android permissions
-
Screen dimensions detection for optimal preview.
-
At transmission the video's metadata is extracted and used to create a VideoInfo object which is then transmitted.
- Filename, Filepath, Filesize, Checksum
- TimeFromMode used for the recording
- DateTime of recording
- Start time of event (based on TimeFromMode setting)
- Gun time if TimeFromMode is WallClockSelect
-
The WPF then uses the Filename to store the transmitted data an dthe checksum to verify it. Other meta-info is then subsequently used as required.
- "Paper Airplane" button to send the recorded video file over TCP locally to a Windows WPF app.
- Can pick a video for transmission from sorted (latest first) list of videos from the Movies folder.
- Configurable IP address and port for the receiving app.
- Status messages to indicate connection status and transmission progress.
- Error handling for connection issues and transmission failures.
- Checksum and filename automatically transmitted as part of the protocol.
- No auto trasmit after recording. 2Do?
- Sportronics.MauiMediaRecorderVideoLib
- A .NET MAUI library for Android video recording using MediaRecorder with Camera Preview and Stabilization features
- djaus2MauiCountdownToolkit
- A .NET MAUI library for countdown popup with customizable appearance and behavior
Sportronics.SendVideoOverTcpLibHandles the TCP Video transmission to the WPF app...Now directly included in this repo as updated version.
- Sportronics.Sportronics.VideoEnums as required by SendVideoOverTcpLib to handle VideoInfo processing and provides app enums.
Clone and build the repository targeting an Android phone. Deploy and run. Need to accept permissions (2). First time might need to restart after accepting permissions. Need the e WPF app for receiving the video.
- TimeFromMode Property to VideoRecorderService allows for different ways of determining the start time of the event.
- As above included in VideoInfo and transmitted to the WPF app.
- The WPF app app uses this to determine how to determine the start time of the event.
- For WallClock mode, the gun time is also included in VideoInfo
- Note: Gun only shows if TimeFromMode is set to WallClock when ready to record.
- Can be pressed before or during video recording.
- TimeFromModes:
TimeFromMode.FromVideoStart ,
TimeFromMode.FromGunSound ,
TimeFromMode.FromGunFlash ,
TimeFromMode.ManuallySelect ,
TimeFromMode.WallClockSelect - In TimeFromMode WallClockSelect
(These features only show in this mode.)
- Can auto start video recording after a period
- 3 Modes for that:
- Soft: Just handled by automatically by VideoKapture as UI-less delay
- Can be cancelled by pressing video start (white) button.
- ATM it does this delay in both packages. 2Do
- Red and Rainbow: A popup with Cancel button
- Red: Popup border is Red. 2Do make color selectable
- Rainbow: Rainbow border, as below. Nice!
- There is a start gun icon. Race times are wrt to this.

- Can auto start video recording after a period
- Can use Icon from app but not Toolkit embedded versions
- 2 Nuget packages tried. Reverting at Version 1.1.6 where app icon works
- Found that it works in Release mode if AOT is disabled!
Both Bundle AND APK builds
Bundle-No AOT config here for Release config.
Nb: Video is stored /Movies folder. Filename is juxtaposed with date. Can optionally also optionally start time to the the video filename which this app can parse and use.
The library has being developed to target a this app.
Start by creating a new .NET MAUI project or using an existing one.
Install the package via NuGet:
dotnet add package MauiMediaRecorderVideoLibAlso need to install the following NuGet package:
dotnet add package CommunityToolkit.Maui.CameraNb: CommunityToolkit.Maui.Camera is in the library but needs a reference in the App as it uses the Toolkit Preview.
- Add the required permissions to your Android Manifest:
<uses-permission android:name="android.permission.CAMERA" />Note: In app Android//MainActivity calls permissions setup via static method in library that iterates through in-app Android/Manifest permissions.
- Initialize the video recorder service:
using MauiMediaRecorderVideoLib;
// Initialize the service
var videoRecorderService = new AndroidVideoRecorderService();
await videoRecorderService.InitializeAsync();- Start the camera preview:
// Assuming you have a GraphicsView named 'cameraPreview' in your XAML
videoRecorderService.SetPreviewSurface(cameraPreview);- Start recording:
// Configure recording options
videoRecorderService.SetVideoFPS(30); // Optional: Set FPS
videoRecorderService.SetImageStabilization(StabilizationMode.Locked); // Optional: Set stabilization
// Start recording
string outputFilePath = Path.Combine(FileSystem.CacheDirectory, "myVideo.mp4");
await videoRecorderService.StartRecordingAsync(outputFilePath);- Control recording:
// Pause recording
await videoRecorderService.PauseRecordingAsync();
// Resume recording
await videoRecorderService.ResumeRecordingAsync();
// Stop recording
await videoRecorderService.StopRecordingAsync();- Clean up resources:
// Release resources when done
await videoRecorderService.CleanupAsync();- .NET MAUI project targeting Android
- Android API level 21 or higher
- Requires Android device with camera