Skip to content

Commit

Permalink
calls speech synthesis if async not finished
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramComputer committed Dec 31, 2023
1 parent 8100db5 commit f87876e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions edit_languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,12 @@ function (translation) {
LWT_DATA.language.ttsVoiceApi = api_value;
const text = document.forms.lg_form.LgVoiceAPIDemo.value;
const lang = <?php echo json_encode($sourceLg); ?>;
readTextAloud(text, lang);
LWT_DATA.language.ttsVoiceApi = prevApi;

if( readTextAloud(text, lang))
{
LWT_DATA.language.ttsVoiceApi = prevApi;
}

},

fullFormCheck: function () {
Expand Down
3 changes: 2 additions & 1 deletion js/pgm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/js/user_interactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,12 @@ function readTextAloud(text, lang, rate, pitch, voice) {
readRawTextAloud(
data.phonetic_reading, lang, rate, pitch, voice
);
return true;
}
);
} else {
readRawTextAloud(text, lang, rate, pitch, voice);
return true;
}
return false;
}

0 comments on commit f87876e

Please sign in to comment.