-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[android] TTS fixes #11757
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
base: master
Are you sure you want to change the base?
[android] TTS fixes #11757
Conversation
a6788f8 to
6b4cade
Compare
|
It is said everywhere (docs and stackoverflow) that we have to call |
6b4cade to
adb4816
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delaying TTS announcements may lead to road accidents.
Right now they’re either not played at all, or the first announcement gets cut off. Please propose a better solution. |
|
|
Add check for bluetooth sco device. If BleSCO is used we wait 1500 ms before playing sound Updated utterance listener * do not re-request audio focus for each string - we already requested it at start * abandon audio focus only after all strings are played Added logs Updated play logic to reset old request: * Each time we ask TTS to play strings (on speak() or on playTurnNotifications()) we flush the buffer * The first string in the queue flushes the buffer * Other strings are added to the buffer Signed-off-by: Andrei Shkrob <github@shkrob.dev>
adb4816 to
7f75acc
Compare
|
Updated PR - removed 1500ms delay for bluetooth connection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM if it works )
|
|
||
| protected void onAudioFocusChange(int focusChange) | ||
| { | ||
| Logger.w(TAG, "Unexpected audio focus change: " + focusChange); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it unexpected?
| if (isBluetoothScoDeviceUsed()) | ||
| { | ||
| Logger.d(TAG, "Bluetooth SCO device is used for audio output"); | ||
| mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if active device changes after requestAudioFocus() was called? Does it make sense to monitor changes and use the related setMode if a new device is SCO/not SCO? https://developer.android.com/develop/connectivity/bluetooth/ble-audio/audio-manager#java
Add check for bluetooth sco device.
If BleSCO is used we wait 1500 ms before playing sound Updated utterance listener
Added logs
Updated play logic to reset old request:
Should be beta tested especially with bluetooth devices
Related issues:
#11429
#11339
#5176
#5661
#11369
#5109
Some of them may already be resolved by my other TTS fixes