mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-29 14:35:45 +00:00
Langue parlée
This commit is contained in:
parent
e4d6c9f542
commit
4c6d2563cd
1 changed files with 12 additions and 1 deletions
|
|
@ -60,7 +60,18 @@ namespace AideDeJeu.ViewModels
|
|||
_CancellationTokenSource = new CancellationTokenSource();
|
||||
OnPropertyChanged(nameof(Speaking));
|
||||
OnPropertyChanged(nameof(NotSpeaking));
|
||||
await Xamarin.Essentials.TextToSpeech.SpeakAsync(md, _CancellationTokenSource.Token);
|
||||
var options = new Xamarin.Essentials.SpeechOptions();
|
||||
var locales = (await Xamarin.Essentials.TextToSpeech.GetLocalesAsync()).ToList();
|
||||
if (item.Id.Contains("_vo.md"))
|
||||
{
|
||||
options.Locale = locales.FirstOrDefault(l => l.Language.StartsWith("en"));
|
||||
}
|
||||
else
|
||||
{
|
||||
options.Locale = locales.FirstOrDefault(l => l.Language.StartsWith("fr"));
|
||||
}
|
||||
|
||||
await Xamarin.Essentials.TextToSpeech.SpeakAsync(md, options, _CancellationTokenSource.Token);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue