Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

AccessibilityService + TTS/STT: How to keep YouTube playing, silence STT beeps, and make TTS↔STT handoff feel natural?

Aperta
#116 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
kotlin

Direzione di ricerca

Inizia riproducendo l’interazione su Android 14/15, inclusi i dispositivi Samsung e Pixel, usando AccessibilityService, TextToSpeech, SpeechRecognizer e la riproduzione multimediale. Traccia UtteranceProgressListener.onDone attraverso startListening e confronta il focus audio, AudioAttributes, il comportamento dei beep e ERROR_NO_MATCH durante la riproduzione di YouTube. Il lavoro è completo quando viene documentato o dimostrato un passaggio tra dispositivi che preservi la riproduzione multimediale, sopprima i beep o li gestisca in modo sicuro e apra in modo affidabile la finestra di ascolto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment

Android 14/15 (including Samsung devices)
An AccessibilityService detects order popups from a dispatch app overlay
Order details are spoken with TextToSpeech, and SpeechRecognizer listens for voice commands such as “confirm” / “cancel”
Drivers often keep YouTube playing while using the app

Goals (all three at once)

Do not interrupt YouTube (or other media) — no pause / stop, and avoid 1-second ducking loops
No STT start/stop/error beeps (the system “ding / ting” sound)
TTS and STT should work smoothly together — STT should become ready right after (or overlapping with) TTS so voice confirm feels natural

What we’ve tried / side effects

Audio focus

TTS with AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK → YouTube sometimes ducks or pauses
Requesting audio focus before/during STT → LOSS_TRANSIENT kills STT, or YouTube pauses
Requesting no focus keeps YouTube alive, but during media playback STT onReady is often late and ERROR_NO_MATCH (7) becomes common

Beep suppression

RecognizerIntent extras such as android.speech.extra.BEEP_SOUND=false, sound_start_beep=0 → ignored on some devices/engines
Temporarily muting only STREAM_NOTIFICATION / STREAM_SYSTEM → reduces beeps, but mute/restore ping-pong can still affect YouTube or system volume
Muting STREAM_MUSIC is unacceptable because it kills YouTube

TTS ↔ STT timing

Blocking startListening during TTS → STT resume after TTS is often delayed (seconds to tens of seconds)
Opening TTS and STT at the same time → mic contention with Google STT/SODA: TTS delay, or “ghost listen” (isListening=true but no onReady / no RMS)
Lost or delayed TTS onDone can leave the STT window never opened

Media + NO_MATCH

Immediately calling startListening again on every ERROR_NO_MATCH while YouTube plays causes ~1s pause/duck ping-pong
Backing off too much (e.g. 4–8s) makes users miss the confirm window

Questions
For an Accessibility-based field voice UI, is there a recommended pattern that satisfies all of the following?

STT that coexists with YouTube / isMusicActive media (do not disable STT just because a media app is in the foreground)
Fully suppress SpeechRecognizer/system beeps without volume hacks — or with the safest minimal hack
Start STT listening within ~1 second after TTS speak, ideally with an overlapping handoff that doesn’t fight for the mic/focus

In particular:

Which AudioAttributes / usage / contentType should TTS and STT each use?
Should we request audio focus at all — and if so, when and which type (MAY_DUCK vs none vs a short STT-only request)?
Is there an official or semi-official API to disable SpeechRecognizer beeps across OEMs / Google engine?
For accessibility voice commands, is on-device speech recognition / AudioRecord + custom VAD a better fit than SpeechRecognizer?
What is the recommended handoff from TTS UtteranceProgressListener.onDone to STT startListening (delay, audio session, mic release)?

Constraints

Accessibility is used only for core functionality (Play policy)
We can’t ask users to “turn off YouTube” or “accept beeps”
Needs to work across Samsung, Pixel, and similar devices

I can share repro logs or a minimal sample project. Looking for real-world patterns from anyone who has shipped something similar.

Lingua principale
Kotlin
Stelle
1.4k
Fork
782
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di android/media-samples

Tutte le issue di android/media-samples

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.