Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
549 views
in Technique[技术] by (71.8m points)

speech synthesis - Can't Chrome's speechSynthesis work offline?

I was playing with Chrome's speechSynthesis

msg = new SpeechSynthesisUtterance("some text");
msg.lang = "fr-FR" ;
window.speechSynthesis.speak(msg);  

when I discovered this strange issue : it can't speak anymore if your device is offline. I searched the web but did not find any explanation.
Can't this work offline ?
(If you know the reason why it needs to be online, please tell me it too in the comments.)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Speech synthesis voices are either local on the device or come from remote speech synthesizer services. If the voice is a remote service, the browser will only be able to use it if it is online and can connect to it.

You don't say which environment you are on, but the Google Fran?ais voice that would be used for fr-FR on Windows and OS X is a remote service, so it doesn't work offline.

You can check which voices are available on a device by calling speechSynthesis.getVoices() and checking the localService property for each voice.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...