-
-
Notifications
You must be signed in to change notification settings - Fork 60
Description
I've been working on my own voice recognition using plugin.maui,.audio and got that working on Android, IoS, and Windows.
I started to add in playback items like wake tones. This is when I noticed something odd. On Android, the sounds work and text to speech works great.
On IoS, there's nothing. However, if I pause the startup (setting a breakpoint), the audio does play at least the first time.
If I let my main program start up and run without breakpoints, I get an error
The operation couldn’t be completed. (OSStatus error 561017449.)
So I assume that has something to do with what is going on... It's something about resources are already allocated or being used (or something like that)
Loading a wav file like this:
playerIsAwake = AudioManager.Current.CreatePlayer(await FileSystem.OpenAppPackageFileAsync("isAwake.wav"));
Both sound out lines:
await TextToSpeech.Default.SpeakAsync(text, cancelToken: token).ConfigureAwait(false)
and
playerIsAwake.Play();
Work on Android and Windows after initializing and fail to play anything in IoS, unless I comment out the line:
await _audioStreamer.StartAsync();
If that line is commented out, then the IoS playback works, but of course the streamer is not initialized.
Since my program has a lot of things in it, I decided to set up a minimal code test in an attempt to reproduce the issue.
When I did this, the above error goes away, probably due to the class injection in Maui which I'm not doing in this test app. However, the issue still exists. Android and Windows work great, IoS does not. (Again, unless I comment out the above line)
To help out, I created a repository with the demo code. You'll only need to add in your bundle signing to get it to deploy on IoS. The repository is here: [https://github.com/sej69/AudioManagerTest/tree/master/AudioManagerTest](GitHub AudioManagerTest)