Skip to content

v3.0.0 Preview 3: All Kinds of Options!

Pre-release
Pre-release
Compare
Choose a tag to compare
@jfversluis jfversluis released this 06 May 11:03
· 5 commits to main since this release
1cfdf4c

This is a crazy cool release thanks to @bijington and @borrmann! Why? Keep scrolling!

Please note, there is at least 1 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

And there is a good number of bugfixes too! Mostly related to seeking within audio as well as setting the speed and then there is something with removing the temporary file that is used while recording on Android... Well, see all the details in the PRs listed below 👇

What's Changed

  • Add README to NuGet Package by @jfversluis in #96
  • Make note on how to get file path from recording clearer by @jfversluis in #99
  • Provide options to allow for customising the iOS/macOS specific session settings by @bijington in #101
  • Swap to using MixWithOthers for the AVAudioSessionCategoryOptions by @bijington in #111
  • Recording options and Bug Fixes by @borrmann in #108
  • fixes issues with seek and speed by @borrmann in #109

New Contributors

Full Changelog: v3.0.0-preview2...v3.0.0-preview3