Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jfversluis/plugin.maui.screenrecording
Plugin.Maui.ScreenRecording provides the ability to record the screen from within your app
https://github.com/jfversluis/plugin.maui.screenrecording
android csharp dotnet dotnet-maui ios mac-catalyst macos maui screen-capture screen-recorder screen-recording
Last synced: 17 days ago
JSON representation
Plugin.Maui.ScreenRecording provides the ability to record the screen from within your app
- Host: GitHub
- URL: https://github.com/jfversluis/plugin.maui.screenrecording
- Owner: jfversluis
- License: mit
- Created: 2023-03-30T19:55:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-21T11:07:08.000Z (9 months ago)
- Last Synced: 2024-10-12T01:24:01.623Z (about 1 month ago)
- Topics: android, csharp, dotnet, dotnet-maui, ios, mac-catalyst, macos, maui, screen-capture, screen-recorder, screen-recording
- Language: C#
- Homepage:
- Size: 8.21 MB
- Stars: 76
- Watchers: 6
- Forks: 9
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
![](nuget.png)
# Plugin.Maui.ScreenRecording
`Plugin.Maui.ScreenRecording` provides the ability to record the screen from within your .NET MAUI app.
I have also recorded a video on how to get started with this plugin. [Watch it here!](https://www.youtube.com/watch?v=M9lDKEYzwn0&list=PLfbOp004UaYVgzmTBNVI0ql2qF0LhSEU1&index=35)
## Install Plugin
[![NuGet](https://img.shields.io/nuget/v/Plugin.Maui.ScreenRecording.svg?label=NuGet)](https://www.nuget.org/packages/Plugin.Maui.ScreenRecording/)
Available on [NuGet](http://www.nuget.org/packages/Plugin.Maui.ScreenRecording).
Install with the dotnet CLI: `dotnet add package Plugin.Maui.ScreenRecording`, or through the NuGet Package Manager in Visual Studio.
## API Usage
In `MauiProgram.cs` add the reference to the screen recording plugin:
```
using Plugin.Maui.ScreenRecording;
```Then add a call to `.UseScreenRecording()` on your `MauiAppBuilder`. For example:
```
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp()
.UseScreenRecording() // This line was added
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
```### Android
For Android you will need to setup a few things in your `AndroidManifest.xml` file. See an example below.\
You should already have a `AndroidManifest.xml` file in your project, make sure to compare it with the example below and add the missing things.```xml
```
### iOS / macOS
If you want to save recordings to the Photos app, you will need to declare the `NSPhotoLibraryAddUsageDescription` permission in your `info.plist` file.
For example:
```xml
NSPhotoLibraryAddUsageDescription
We'd like to add the screen recordings to your Photos app!
```The permission will automatically be requested by the library when needed.
## Windows Instructions
Not supported (yet).
# Usage:
On the page you want the screen recorder, create a variable and retrieve the static instance of the `ScreenRecording` object.
```csharp
readonly IScreenRecording screenRecording;
this.screenRecording = ScreenRecording.Default;
```To check if device is capable of making screen recordings:
`screenRecording.IsSupported;`
To start recording:
`screenRecording.StartRecording();`
Additionally you can provide `ScreenRecordingOptions` to influence the behavior:
```csharp
ScreenRecordingOptions options = new()
{
EnableMicrophone = true,
SaveToGallery = true,
SavePath = Path.Combine(Path.GetTempPath(), "myRecording.mp4"),
};screenRecording.StartRecording(options);
```To stop recording:
`ScreenRecordingFile screenResult = await screenRecording.StopRecording();`
## Acknowledgements
This project could not have came to be without these projects and people, thank you! <3
A big thank you to [@rdurish](https://github.com/rdurish) who provided the initial implementation for Android. Amazing work!