Skip to content

v3.0.0: Recording Options

Compare
Choose a tag to compare
@jfversluis jfversluis released this 03 Jun 11:16
· 4 commits to main since this release
94ad09f

It's time! Version 3.0 of this plugin is hereby released!

If you have been on preview 3 of 3.0 then nothing has changed other than that this is labeled stable now. If you're coming from v2.1, find all the details and changes below.

Please note, there is a breaking change in here which has to do with setting the AsyncAudioPlayer.Speed. This property does not have a setter anymore. Instead use the new SetSpeed() method.

iOS & macOS Recording Session Options

For iOS (and macOS) you have different session options you can configure which determine how sound behaves whenever you start recording or playing something. Up until this version, we decided for you how that was handled, now we're putting this power in your hands!

While initializing this plugin you can now do this:

var builder = MauiApp.CreateBuilder();
    builder
        .UseMauiApp<App>()
	.AddAudio(
		playbackOptions =>
		{
#if IOS || MACCATALYST
			playbackOptions.Category = AVFoundation.AVAudioSessionCategory.Playback;
#endif
		},
		recordingOptions =>
		{
#if IOS || MACCATALYST
			recordingOptions.Category = AVFoundation.AVAudioSessionCategory.Record;
			recordingOptions.Mode = AVFoundation.AVAudioSessionMode.Default;
			recordingOptions.CategoryOptions = AVFoundation.AVAudioSessionCategoryOptions.DefaultToSpeaker;
#endif
		})

And set the right recording and/or playback options for you.

If you're using the static instance, you can simply set it like this:

AudioManager.Current.SharedPlayerOptions = new
{
    Category = AVFoundation.AVAudioSessionCategory.Playback;
}

Or if you want to create a player/recorder through the manager, you can pass in the options there too:

var player = AudioManager.Current.CreatePlayer(new
 {
    Category = AVFoundation.AVAudioSessionCategory.Playback;
 });

AudioRecordingOptions

With the new AudioRecordingOptions object we have gained fine-grained control over the different options that you can use for recording audio. You can now set sample rate, channels, bit depth and encoding and to top it all off there is a switch that allows you to throw an exception if one of the configured options is not supported on the platform you're running on. The power is in your hands!

Thank you @borrmann for all this goodness!

Bugfixes & other changes

And there is a good number of other changes too! Well, see all the details in the PRs listed below 👇

What's Changed

New Contributors

Full Changelog: v2.1.0...v3.0.0