kiwix-android icon indicating copy to clipboard operation
kiwix-android copied to clipboard

"Read Aloud" Feature on the Wiki Med Offline App

Open AnneChase09 opened this issue 4 years ago • 16 comments

Describe the bug "Read Aloud" Feature on the Wiki Med App Stopped Functioning

*Expected behavior On Clicking the "Read Aloud" feature, the content of the page is meant to be read aloud

Steps to reproduce the behavior:

  1. Open the Wiki Med Offline App and any article in it.

  2. Click on: 'Menu Bar'

  3. Scroll down to: 'Read Aloud'

  4. See error : "The Language of this page is not supported or inappropriate language data was not installed. The article may not be properly read."

Screenshots Screenshot_20200504-093541

Environment

  • Version of Kiwix Android : 2020-03 Build: 5200810
  • Device : Techno Spark 2
  • OS version : Android 8.1.0

AnneChase09 avatar May 04 '20 08:05 AnneChase09

@mhutti1 @abdulwd @macgills Could you please quickly (before 3.3 release) verify we don't have created a regression here?

kelson42 avatar May 04 '20 17:05 kelson42

Have been trying to resolve this issue on my own, for quite a while now. So I decided to try fixing it by updating my Language Output.

Apparently it worked, after downloading "Google Text-to-speech [UNITED KINGDOM] voice data" on my device; the default language preference on my device is English (United States).

Inadvertently, I also found out that you can change the way the Voice-Output sounds by changing the Voices in the English (United Kingdom)Voice data Options.

AnneChase09 avatar May 05 '20 01:05 AnneChase09

@kelson42 This still works fine for me on 3.3

macgills avatar May 06 '20 15:05 macgills

@macgills @AnneChase09 Not sure what do to next, but I suspect a glitch if you have certain locales like en-US.

kelson42 avatar May 07 '20 16:05 kelson42

We could try giving a hint to the users that is better than?

image

I don't know particularly what we could say? Perhaps a button linking to Google Text To Speech?

macgills avatar May 08 '20 14:05 macgills

@macgills I thought our application install the package automatically! This was at least the behaviour before #1510 has been fixed I guess. What is the new one?

kelson42 avatar May 10 '20 08:05 kelson42

it should try to? That was the result of @mohamedsamehkhalil 's discovery

getFeatures(tts, locale).contains(TextToSpeech.Engine.KEY_FEATURE_NOT_INSTALLED) if that evaluates true then we show this error message

macgills avatar May 11 '20 15:05 macgills

I thought our application install the package automatically! This was at least the behaviour before #1510 has been fixed I guess.

I believe that before #1764, we never actively requested the package to be installed. the package was installed automatically only if Google TTS engine was used (possibly other engines too). in #1764 I just added that the toast but it should still install the package if Google TTS was used.

My theory is @AnneChase09 was initially using a TTS engine other than Google TTS, so it only showed the toast but did not install the package. which was the expected behaviour even before #1764.

mohamed-sameh-khalil avatar May 11 '20 16:05 mohamed-sameh-khalil

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.

stale[bot] avatar Jul 10 '20 23:07 stale[bot]

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.

stale[bot] avatar Oct 17 '20 02:10 stale[bot]

Clarifying questions: Is the goal to install TTS automatically if it is not detected? Is there a particular TTS kiwis-android uses?

jhbiggs avatar May 29 '21 14:05 jhbiggs

@jhbiggs At this level, I believe the ideas/comments done earlier should be confirmed. The analysis of the problem should be done. Here a few open questions I have:

  • Does the system seems to work correctly today?
  • What happens if the either the content or the voice at the country specificities like pt-PT for example?
  • Can we download automatically the voice?
  • ....

kelson42 avatar May 29 '21 14:05 kelson42

On initial launch, the readAloud does not appear to have initialized. The first tap shows the error toast, then on second tap the readAloud launches successfully. Perhaps the toast message should read, "Please wait, initializing text-to-speech"?

jhbiggs avatar Jun 05 '21 12:06 jhbiggs

@jhbiggs what is this init time? How long it takes? Is that normal?

kelson42 avatar Jun 05 '21 12:06 kelson42

I was wrong, a voice download is causing the delay and error toast.

The if condition on line 119 in KiwixTextToSpeech.kt triggers the toast. The Engine.KEY_FEATURE_NOT_INSTALLED evaluates to true. The line before it, tts.setLanguage(locale), triggers the download which has not yet completed by the time the KEY_FEATURE expression is evaluated. Documentation for the Engine.KEY_FEATURE_NOT_INSTALLED states "the voice may need to download additional data to be fully functional. The download will be triggered by calling TextToSpeech#setVoice(Voice) or TextToSpeech#setLanguage(Locale)." tts.setLanguage(locale) triggers the download.

Currently The Nexus 6 on API 26 shows the error toast and does not launch the new voice. The Pixel 3a API 30 shows the error toast once then launches the appropriate voice.

We can

  1. Remove the KEY_FEATURE expression; wait for the download to complete as needed; and allow the read-aloud to begin on its own,
  2. Update the toast message to "voice is downloading, please wait," and handle other potential outcomes, or
  3. Follow a third and better suggestion I haven't thought of.

jhbiggs avatar Jun 06 '21 02:06 jhbiggs

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.

stale[bot] avatar Aug 21 '21 04:08 stale[bot]

Same issue on samsung api 33 with en-us, voice data is not downloaded automatically and the toast error doesn't show which voice data it needs, thankfully i found this page and installing en-uk fixed it for me but the error message should show what exact voice it needs so users can download it manually if needed.

mansatan avatar Jan 20 '23 05:01 mansatan