jfversluis / Plugin.Maui.Audio

Plugin.Maui.Audio provides the ability to play audio inside a .NET MAUI application
MIT License
263 stars 46 forks source link

3.0.1 CategoryOptions is undefined #132

Closed cagriy closed 2 months ago

cagriy commented 2 months ago

The example on this page:

https://github.com/jfversluis/Plugin.Maui.Audio/blob/main/docs/audio-player.md

that sets Category options as

audioManager.CreatePlayer(
    await FileSystem.OpenAppPackageFileAsync("ukelele.mp3"),
    new AudioPlayerOptions
    {
#if IOS || MACCATALYST
        CategoryOptions = AVFoundation.AVAudioSessionCategoryOptions.MixWithOthers
#endif
    });

works well up to and including 3.0.0, however, it starts failing on 3.0.1 with an error suggesting that CategoryOptions is undefined.

I may be doing something wrong but wanted to share.

bijington commented 2 months ago

The property still exists in the code. Can you try a clean and rebuild?

cagriy commented 2 months ago

Thank you @bijington ,

I noticed that 3.0.1 wasn't touching this property at all. I started a fresh project, it builds just fine with 3.0.0 and fails when I upgrade to 3.0.1.

Here is the new repo, does this build fine for you? https://github.com/cagriy/AudioTest/tree/main

Thanks

bijington commented 2 months ago

That repo builds fine for me

image

This is with Rider on a Mac.

cagriy commented 2 months ago

Thanks for checking @bijington. My Rider must be confused, I just tried on another Mac/Rider, and it was working fine. Who knows what has been cached where :)

cagriy commented 2 months ago

@bijington , just wanted to follow up, this was related to the .NET version, I was also having the crash issues people were mentioning on the CommunityToolkit repo. Upgrade to 8.0.400 solved the problems. I wonder if this needs documentation (for both repos) ? Happy to help if that's a good idea.

bijington commented 2 months ago

That is helpful thanks. @jfversluis could it be that our pipeline builds using the latest version of MAUI at the time of building?