Commit ed222db7 authored by John Palmer's avatar John Palmer Committed by Commit Bot

Improve TTS announcements by not stopping existing ChromeVox announcements

Increasing delay also helps by making sure things aren't interrupted.

FIXES: 1148100

Change-Id: Ie6e4f696a23ca00b67d88be28d9a5b91ffef3282
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2530955Reviewed-by: default avatarJing Wang <jiwan@chromium.org>
Reviewed-by: default avatarMy Nguyen <myy@chromium.org>
Commit-Queue: John Palmer <jopalmer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827658}
parent d42a3fd0
...@@ -38,8 +38,10 @@ gfx::NativeView GetParentView() { ...@@ -38,8 +38,10 @@ gfx::NativeView GetParentView() {
return parent; return parent;
} }
// Delay messages when window is shown until after normal ChromeVox
// announcements are done.
constexpr base::TimeDelta kTtsShowDelay = constexpr base::TimeDelta kTtsShowDelay =
base::TimeDelta::FromMilliseconds(100); base::TimeDelta::FromMilliseconds(1200);
} // namespace } // namespace
...@@ -70,9 +72,9 @@ void TtsHandler::Speak(const std::string& text) { ...@@ -70,9 +72,9 @@ void TtsHandler::Speak(const std::string& text) {
content::TtsUtterance::Create(profile_); content::TtsUtterance::Create(profile_);
utterance->SetText(text); utterance->SetText(text);
utterance->SetEventDelegate(this); utterance->SetEventDelegate(this);
utterance->SetCanEnqueue(true);
auto* tts_controller = content::TtsController::GetInstance(); auto* tts_controller = content::TtsController::GetInstance();
tts_controller->Stop();
tts_controller->SpeakOrEnqueue(std::move(utterance)); tts_controller->SpeakOrEnqueue(std::move(utterance));
} }
......
...@@ -123,9 +123,9 @@ void TtsHandler::Speak(const std::string& text) { ...@@ -123,9 +123,9 @@ void TtsHandler::Speak(const std::string& text) {
content::TtsUtterance::Create(profile_); content::TtsUtterance::Create(profile_);
utterance->SetText(text); utterance->SetText(text);
utterance->SetEventDelegate(this); utterance->SetEventDelegate(this);
utterance->SetCanEnqueue(true);
auto* tts_controller = content::TtsController::GetInstance(); auto* tts_controller = content::TtsController::GetInstance();
tts_controller->Stop();
tts_controller->SpeakOrEnqueue(std::move(utterance)); tts_controller->SpeakOrEnqueue(std::move(utterance));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment