AccessibilityService + TTS/STT: How to keep YouTube playing, silence STT beeps, and make TTS↔STT handoff feel natural?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- kotlin
- Lĩnh vực
- accessibility, audio-video-rtc, mobile-dev
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện tương tác trên Android 14/15, bao gồm các thiết bị Samsung và Pixel, sử dụng AccessibilityService, TextToSpeech, SpeechRecognizer và phát media. Theo dõi UtteranceProgressListener.onDone thông qua startListening, đồng thời so sánh audio focus, AudioAttributes, hành vi của tiếng bíp và ERROR_NO_MATCH trong khi phát YouTube. Hoàn tất nghĩa là ghi lại tài liệu hoặc trình diễn một quy trình chuyển giao giữa các thiết bị có thể duy trì media, tắt hoặc xử lý an toàn tiếng bíp và mở cửa sổ lắng nghe một cách đáng tin cậy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Kotlin
- Star
- 1.4k
- Fork
- 782
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của android/media-samples
-
i whin you help me a little bitĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
android/media-samples#117 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
android/media-samples#112 ·
-
بانلبرلبتĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 1/100
android/media-samples#111 ·
-
How to use "setCloseAction"?Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
android/media-samples#97 · 3 bình luận · 2 reaction ·
-
I can't start MovieActivityĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
android/media-samples#92 · 3 bình luận ·
Tất cả issue của android/media-samples
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SimonHalvdansson/Harmonic-HN#363 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ionic-team/capacitor-file-transfer#83 · 1 bình luận ·
-
Meta request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
keiyoushi/extensions-source#19500 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
go 🏃 testing 🧪
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
valkey-io/valkey-glide#7239 ·
Maintainer thường phản hồi trong vòng 2 ngày