Added multi-platform speech of cchars

This commit is contained in:
BOT Alex 2023-07-17 14:08:47 +08:00
parent bcec11c238
commit eabb06d90f

View file

@ -378,7 +378,7 @@
if (firstRender) if (firstRender)
{ {
// Gets chinese voice on windows or iphone. // Gets chinese voice on windows or iphone.
this.SpeechVoice = ((IEnumerable<SpeechSynthesisVoice>)(await this.SpeechSynthesis.GetVoicesAsync())).FirstOrDefault(v => v.Name.Contains("Yaoyao") || v.Name.Contains("Ting-Ting")); this.SpeechVoice = ((IEnumerable<SpeechSynthesisVoice>)(await this.SpeechSynthesis.GetVoicesAsync())).FirstOrDefault(v => v.Name.Contains("Yaoyao") || v.Name.Contains("Ting-Ting") || v.Name.ToLower().Contains("cn"));
this.StateHasChanged(); this.StateHasChanged();
} }
} }
@ -387,7 +387,7 @@
{ {
if (SpeechVoice == null) if (SpeechVoice == null)
{ {
Snackbar.Add("Couldn't play sound", Severity.Error); Snackbar.Add("Couldn't play sound.\nLikely reason: Chinese speech not installed", Severity.Error);
return; return;
} }