Closed kelson42 closed 4 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
Is this issue still open ? if so, I would like to work on it
@mohamedsamehkhalil Can you reproduce the problem?
@kelson42 No, I tried 3 different foreign languages (Arabic, Abkhazian, chinese) and each time I would get a toast telling me the following :
The language of this page is not supported, or appropriate data was not installed. The article may not be properly read
@mohamedsamehkhalil Will be hard for you to fix the pb if you can not reproduce it
Well it sounds like it could be fixed? @mohamedsamehkhalil after trying multiple times did it eventually start reading aloud? If the original hypothesis about the voice needing to be downloaded is correct then after a while it may start working. Your scenario with an error message seems a lot better than the initial behaviour described in the ticket
@macgills, No it did not, I keep trying and I still get the same toast. And so far there is no indication that anything is being downloaded in the background. It could also be that the languages I chose all did not have tts support. @kelson42 could you tell me what languages resulted in the behaviour described by the ticket
I was able to reproduce the problem exactly as described. I have a galaxy phone so it used the Samsung TTS engine by default but when I switched to the Google TTS engine the described behaviour occurs. The problem seems to exist only when using Google TTS engine because instead of reporting a missing language it jumps to downloading the data. I would like to continue working on this issue if it's okay.
@mohamedsamehkhalil please do, you have been assigned
So I think I found the problem and have a solution for it, however I am new here and don't know if I am putting too much details or not enough details in this comment. if I am doing either, please excuse me tell me how I should clarify and I will be glad to hear your improvements to my solution. @kelson42 @macgills
the problem occurs at line 134 in KiwixTextToSpeech.java
tts.setLanguage(locale);
if (requestAudioFocus()) {
loadURL(webView);
}
it happens because the google TTS engine (possibly other engines too) does not return LANG_MISSING_DATA
when the voice data is not available, instead it schedules it for download when internet is available which can cause the application to request audio focus without any voice being produced. I have tried it with the Samsung TTS engine but it returns LANG_MISSING_DATA
as expected. I did not try any other engines.
after assigning The locale we can get The used voice and check if one of it's features is KEY_FEATURE_NOT_INSTALLED
which is returned only if the voice data is not installed and requires installation. more details can be found here and [here](https://developer.android.com/reference/android/speech/tts/Voice.html#getFeatures()).
I suggest that whenever the voice data is not available the app will show a toast to inform the user that the download will start when internet is available and skip requesting Audio Focus
Sounds great @mohamedsamehkhalil , I look forward to the pull request
If I start to read an article in a language in which I never have use read aloud before, it won't work immediatly. First the feature won't generate any sounds for many minutes.... But after trying maybe 10 minutes, then it looks like that it will start to work.
I strongly suspect that in the background Android has to download the voice and that explains why it does not work immediatly. But that should be clearly communicated to the user.
Would be great if my theory could be confirmed.