xamarin / Essentials

Xamarin.Essentials is no longer supported. Migrate your apps to .NET MAUI, which includes Maui.Essentials.
https://aka.ms/xamarin-upgrade
Other
1.53k stars 506 forks source link

[Bug] TextToSpeech on Android overrides system set speech rate with value 1.0 #2092

Open jpritchard-isl opened 1 year ago

jpritchard-isl commented 1 year ago

Description

The user set system speech rate value is overruled by TextToSpeech on the Android platform by the following line. The system configured speech rate should be used, rather than overruled.

/TextToSpeech/TextToSpeech.android.cs:150 tts.SetSpeechRate(1.0f);

https://github.com/xamarin/Essentials/blob/f264e71f8c816e742817330cc823db37733cf755/Xamarin.Essentials/TextToSpeech/TextToSpeech.android.cs#L150

Suggest removing this line until support for specifying speech rate is implemented as per feature request #715

Steps to Reproduce

  1. On Android, Settings, Text-to-speech output, set the Speech rate to an extreme value (high or low)
  2. Call Xamarin.Essentials.TextToSpeech.SpeakAsync(...)

Expected Behavior

Spoken at the speech rate set in Android settings.

Actual Behavior

Spoken at medium speech rate.

Basic Information

jpritchard-isl commented 1 year ago

For context, this is leading to unexpected results for our customers who expected the system speech settings to control the speech made by our application. By always setting this to 1.0 it breaks the users ability to control the speech rate consitently for all their applications.

jpritchard-isl commented 1 year ago

Further, in regards to the original bug fix #786 that introduced this issue, I would expect the behaviour to remain the same for android devices that have the system speech rate set to middle value. Only those were the value has been set lower of higher will see a change in behaviour to be consistent with other applications on those devices.