xamarin/ios-samples

Error in SpeakToMe setting the audio session category and mode

stephen-hawley opened this issue · 1 comments

The sample as written calls SetCategory and SetMode early on in StartRecording.
It needs to either save their initial values and set them back on completion or set them to defaults (Playback and ModeDefault).

Failing to do so inhibits audio output on devices (although it works in simulator).

Example code:

				if (error != null || isFinal) {
					audioSession.SetCategory (AVAudioSessionCategory.Playback);
					audioSession.SetMode (AVAudioSession.ModeDefault, out err);
					node.RemoveTapOnBus (0);
					audioEngine.Dispose ();
					recognitionRequest.Dispose ();
					recognitionTask.Dispose ();
					recognitionRequest = null;
					recognitionTask = null;
				}

Microsoft support for Xamarin will end on May 1, 2024 for all Xamarin SDKs. In preparation for this, all issues and PRs in this repository are being closed.