Plugin.Maui.Audio
3.0.0-preview3
See the version list below for details.
dotnet add package Plugin.Maui.Audio --version 3.0.0-preview3
NuGet\Install-Package Plugin.Maui.Audio -Version 3.0.0-preview3
<PackageReference Include="Plugin.Maui.Audio" Version="3.0.0-preview3" />
paket add Plugin.Maui.Audio --version 3.0.0-preview3
#r "nuget: Plugin.Maui.Audio, 3.0.0-preview3"
// Install Plugin.Maui.Audio as a Cake Addin #addin nuget:?package=Plugin.Maui.Audio&version=3.0.0-preview3&prerelease // Install Plugin.Maui.Audio as a Cake Tool #tool nuget:?package=Plugin.Maui.Audio&version=3.0.0-preview3&prerelease
Plugin.Maui.Audio
Plugin.Maui.Audio
provides the ability to play and record audio inside a .NET MAUI application.
Getting Started
- Available on NuGet: http://www.nuget.org/packages/Plugin.Maui.Audio
API Usage
Plugin.Maui.Audio
provides the AudioManager
class that allows for the creation of AudioPlayer
s and AudioRecorder
s. The AudioManager
can be used with or without dependency injection.
AudioManager
There are two different ways in which you can interact with the AudioManager
implementation provided by this plugin, they are:
Dependency Injection
You will first need to register the AudioManager
with the MauiAppBuilder
based on the following example:
builder.AddAudio();
[!NOTE]
You can also customize the shared settings for both audio playback and recording.
You can then enable your classes to depend on IAudioManager
as per the following example.
public class AudioPlayerViewModel
{
readonly IAudioManager audioManager;
public AudioPlayerViewModel(IAudioManager audioManager)
{
this.audioManager = audioManager;
}
public async void PlayAudio()
{
var audioPlayer = audioManager.CreatePlayer(await FileSystem.OpenAppPackageFileAsync("ukelele.mp3"));
audioPlayer.Play();
}
}
Straight usage
Alternatively if you want to skip using the dependency injection approach you can use the AudioManager.Current
property.
public class AudioPlayerViewModel
{
public async void PlayAudio()
{
var audioPlayer = AudioManager.Current.CreatePlayer(await FileSystem.OpenAppPackageFileAsync("ukelele.mp3"));
audioPlayer.Play();
}
}
Now that you know how to use the AudioManager
class, please refer to the following sections:
Acknowledgements
This project could not have came to be without these projects and people, thank you! ❤️
SimpleAudioPlayer for Xamarin
Basically this plugin, but then for Xamarin. We have been using this in our Xamarin projects with much joy and ease, so thank you so much Adrian (and contributors!) for that. Find the original project here where we have based our project on and evolved it from there.
The Happy Ukelele Song
As a little sample song we wanted something Hawaii/Maui themed obviously, and we found The Happy Ukelele Song which seems to fit that description. Thank you Stanislav Fomin and AudioHero for making it available.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-android34.0 is compatible. net8.0-browser was computed. net8.0-ios was computed. net8.0-ios17.2 is compatible. net8.0-maccatalyst was computed. net8.0-maccatalyst17.2 is compatible. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows10.0.19041 is compatible. |
-
net8.0
- Microsoft.Maui.Controls (>= 8.0.7)
-
net8.0-android34.0
- Microsoft.Maui.Controls (>= 8.0.7)
-
net8.0-ios17.2
- Microsoft.Maui.Controls (>= 8.0.7)
-
net8.0-maccatalyst17.2
- Microsoft.Maui.Controls (>= 8.0.7)
-
net8.0-windows10.0.19041
- Microsoft.Maui.Controls (>= 8.0.7)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Plugin.Maui.Audio:
Package | Downloads |
---|---|
PolyhydraGames.Core.Maui
Package Description |
|
FireSoft.Maui.Ui
Librerie per lo sviluppo di App Maui di FireSoft Italia Srl |
|
fair.maui
fair maui client |
|
fairdao.maui.shared
fair maui client |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Plugin.Maui.Audio:
Repository | Stars |
---|---|
VladislavAntonyuk/MauiSamples
.NET MAUI Samples
|
|
bijington/orbit
The Orbit engine is a game engine built on top of .NET MAUI Graphics. The objective is to firstly enjoy the journey of building a game engine and secondly providing a framework that allows us to utilise the best parts of a cross-platform framework while building a 'typical' game.
|
Version | Downloads | Last updated |
---|---|---|
3.0.1 | 18,383 | 9/10/2024 |
3.0.0 | 44,961 | 6/3/2024 |
3.0.0-preview3 | 1,683 | 5/6/2024 |
3.0.0-preview2 | 7,496 | 11/30/2023 |
3.0.0-preview1 | 209 | 11/27/2023 |
2.1.0 | 64,489 | 11/27/2023 |
2.0.0 | 22,705 | 9/29/2023 |
2.0.0-preview2 | 913 | 9/11/2023 |
2.0.0-preview1 | 572 | 9/4/2023 |
1.0.0 | 75,329 | 11/29/2022 |
0.1.0-preview2 | 1,487 | 11/3/2022 |
0.1.0-preview1 | 2,243 | 8/22/2022 |