Audio.MAUI 1.0.0

dotnet add package Audio.MAUI --version 1.0.0                
NuGet\Install-Package Audio.MAUI -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Audio.MAUI" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Audio.MAUI --version 1.0.0                
#r "nuget: Audio.MAUI, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Audio.MAUI as a Cake Addin
#addin nuget:?package=Audio.MAUI&version=1.0.0

// Install Audio.MAUI as a Cake Tool
#tool nuget:?package=Audio.MAUI&version=1.0.0                

Audio.MAUI

An audio controller for play and record audio in .net Maui applications

AudioController

A multiplatform control for play and record audio files.

Properties and Events:

/// List of available microphones in the device.
public List<MicrophoneInfo> Microphones
/// Set the microphone to use by the controler. Only available for Windows
public MicrophoneInfo Microphone
/// Set properties for record file output
public RecordConfiguration RecordConfiguration
/// Set the volume for audio playing
public double Volume
/// Set the speed for audio playing
public double PlaySpeed
/// Indicates the actual status of the controller
public AudioControllerStatus Status 
/// Total duration of playback
public TimeSpan Duration
/// Elapsed time of the current recording or playback
public TimeSpan ElapsedTime

/// Invoked every time the controller Status changes
public event AudioControllerStatusChangedHandler StatusChanged

Methods:

/// Start recording an audio file async. "RecordConfiguration" property must not be null.
public async Task<AudioControllerResult> StartRecordAsync(string file)
/// Pause the current recording async.
public Task PauseRecordAsync()
/// Resume the current recording async from pause state.
public Task ResumeRecordAsync()
/// Stop the current recording async.
public Task StopRecordAsync()

/// Initializes a new Player with the specific file.
public AudioControllerResult NewPlay(string file)
/// Starts the current playback
public AudioControllerResult Play()
/// Pause the current playback
public void Pause()
/// Resume the current playback
public void Resume()
/// Stops the current playback
public void Stop()
/// Seeks the current playback to the time position indicated
public void SeekTo(TimeSpan position)

Install and configure AudioController

  1. Download and Install Audio.MAUI NuGet package on your application.

  2. Add microphone permissions to your application:

Android

In your AndroidManifest.xml file (Platforms\Android) add the following permission:

<uses-permission android:name="android.permission.RECORD_AUDIO" />
iOS/MacCatalyst

In your info.plist file (Platforms\iOS / Platforms\MacCatalyst) add the following permission:

<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to the microphone for record audios</string>

Make sure that you enter a clear and valid reason for your app to access the microphone. This description will be shown to the user.

Windows

In your Package.appxmanifest file (Platforms\Windows) go to Capabilities and mark Microphone.

For more information on permissions, see the Microsoft Docs.

Using AudioController

In your c# file, make sure to add the right using:

using Audio.MAUI;

Use the control:

        private async void Button_Clicked(object sender, EventArgs e)
        {
            file = Path.Combine(FileSystem.Current.CacheDirectory, "prueba.wav");
            aController.RecordConfiguration.AudioFormat = AudioFormat.WAV;
            aController.RecordConfiguration.Channels = 2;
            var result = await aController.StartRecordAsync(file);
            Debug.WriteLine("Start recording result " + result.ToString());
        }
        private async void Button_Clicked_8(object sender, EventArgs e)
        {
            file = Path.Combine(FileSystem.Current.CacheDirectory, "prueba.mp4");
            aController.RecordConfiguration.AudioFormat = AudioFormat.M4A;
            aController.RecordConfiguration.Channels = 2;
            var result = await aController.StartRecordAsync(file);
            Debug.WriteLine("Start recording result " + result.ToString());
        }

        private void Button_Clicked_1(object sender, EventArgs e)
        {
            aController.PauseRecordAsync();
        }

        private void Button_Clicked_2(object sender, EventArgs e)
        {
            aController.ResumeRecordAsync();
        }

        private async void Button_Clicked_3(object sender, EventArgs e)
        {
            await aController.StopRecordAsync();
            var result = aController.NewPlay(file);
            Debug.WriteLine("New Play result " + result.ToString());
        }

        private void Button_Clicked_4(object sender, EventArgs e)
        {
            aController.Play();
        }

        private void Button_Clicked_5(object sender, EventArgs e)
        {
            aController.Pause();
        }

        private void Button_Clicked_6(object sender, EventArgs e)
        {
            aController.Resume();
        }

        private void Button_Clicked_7(object sender, EventArgs e)
        {
            aController.Stop();
        }
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-android33.0 is compatible.  net7.0-ios was computed.  net7.0-ios16.1 is compatible.  net7.0-maccatalyst was computed.  net7.0-maccatalyst16.1 is compatible.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net7.0-windows10.0.19041 is compatible.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.
  • net7.0-android33.0

    • No dependencies.
  • net7.0-ios16.1

    • No dependencies.
  • net7.0-maccatalyst16.1

    • No dependencies.
  • net7.0-windows10.0.19041

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 572 5/4/2023