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

Background audio (Spotify) stops after speech_to_text stops ONLY when using bluetooth headphones #564

Open
masonjeffreys opened this issue Oct 10, 2024 · 1 comment

Comments

@masonjeffreys
Copy link

I am trying to get speech_to_text to work while Spotify is playing in the background.

Current Behavior

  1. Spotify playing over bluetooth headphones
  2. Start speech_to_text listening
  3. Spotify is ducked (decreases in quality) while speech_to_text listens (this is acceptable)
  4. After speech_to_text is done listening, Spotify stops entirely.

Expected Behavior
4. After speech_to_text is done listening, Spotify continues playing at the original quality.

I'm using the audio_session plugin to try different settings, but none has given me the desired result. Interestingly, if I am not using bluetooth headphones, the expected behavior is realized.

Current audio_session settings:
await session.configure(AudioSessionConfiguration( avAudioSessionCategory: AVAudioSessionCategory.playAndRecord, avAudioSessionCategoryOptions: AVAudioSessionCategoryOptions.mixWithOthers | AVAudioSessionCategoryOptions.allowBluetooth | AVAudioSessionCategoryOptions.allowBluetoothA2dp, avAudioSessionMode: AVAudioSessionMode.spokenAudio, avAudioSessionRouteSharingPolicy: AVAudioSessionRouteSharingPolicy.defaultPolicy, avAudioSessionSetActiveOptions: AVAudioSessionSetActiveOptions.none, androidAudioAttributes: const AndroidAudioAttributes( contentType: AndroidAudioContentType.speech, flags: AndroidAudioFlags.none, usage: AndroidAudioUsage.voiceCommunication, ), androidAudioFocusGainType: AndroidAudioFocusGainType.gain, androidWillPauseWhenDucked: true, ));

@sowens-csd
Copy link
Contributor

Looks like this is only on Android? Have you tried it on iOS?

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

No branches or pull requests

2 participants