Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AudioSession: Failed to set mode #238

Open
pax-k opened this issue Apr 30, 2024 · 0 comments
Open

AudioSession: Failed to set mode #238

pax-k opened this issue Apr 30, 2024 · 0 comments

Comments

@pax-k
Copy link

pax-k commented Apr 30, 2024

I'm using Whisper.rn together with my own Text-to-Speech library (Swift + Expo).

Flow:

  1. Run transcribeRealtime()
  2. Start speaking
  3. Run stop()
  4. My TTS library starts to playback the transcribed text

It works on the first run of the flow, but running it a second time, updateAudioSession() throws the error:

Error: Failed to set mode. Domain=NSOSStatusErrorDomain Code=-50 "(null)"

I suspect something happens when whisper.rn tries to restore the audio session a second time (after my TTS library sets its own session).

This is how whisper.rn is configured:

audioSessionOnStartIos: {
          category: AudioSessionIos.Category.Record,
          options: [
            AudioSessionIos.CategoryOption.InterruptSpokenAudioAndMixWithOthers,
            AudioSessionIos.CategoryOption.AllowBluetooth,
            AudioSessionIos.CategoryOption.AllowBluetoothA2DP,
          ],
          mode: AudioSessionIos.Mode.VoiceChat,
        },
        audioSessionOnStopIos: 'restore',

This is how my TTS lib sets its session:

self.audioSession = AVAudioSession.sharedInstance()
            try self.audioSession.setCategory(.playback, mode: .voicePrompt, options: [.duckOthers, .allowBluetooth, .allowBluetoothA2DP, .allowAirPlay])
            try self.audioSession.setActive(true, options: .notifyOthersOnDeactivation)

Do you have any clues? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant