Closed aednlaxer closed 2 years ago
Can you point to any other audio apps that correctly handle the interruption?
After further investigation I can say it's not a bug of this plugin 🙂
I've checked Spotify, Youtube and Google Podcasts apps with ducking off and all these apps continue playback while TalkBack is in use. I'm using text to speech plugin along with audio_service
and audio_session
. Turns out TalkBack with ducking off stops TTS engine's playback directly but doesn't do anything with media players and their audio focus\session. TTS plugin I'm using receives a stop\interruption event but audio service and audio session don't and this is not an issue of this plugin but rather how things work on Android with that setting off.
That doesn't surprise me, Android considers TTS and music as different kinds of audio streams which is also why I provide that hack in audio_service to force the media buttons to show by playing a little bit of "real" audio (or what Android considers real audio. TTS doesn't count, since it's on it's own special audio stream.) Anyway, that's not exactly the same issue here, TalkBack could have been programmed to request audio focus if they wanted it to, but I guess the fact that they didn't is consistent with their overall approach to treat TTS output differently from normal audio output.
It seems that
interruptionEventStream
doesn't emit a new interruption event when certain conditions are met:Reproduction path:
Text
) so TalkBack can start speaking and current playback should be interruptedObserved behavior:
When changing focus the app doesn't receive a new
AudioInterruptionEvent
. This makes it impossible to do necessary changes in the audio playback (pause playback etc). The app is unable to update playback state (I'm using this plugin along withaudio_service
). There's playback state mismatch: app shows that playback is ongoing although it's actually not.Expected behavior:
App gets notified about new audio interruption via
AudioSession.interruptionEventStream
.My audio session configuration: