手动转帖 @mashiro @hello.2heng.xin
const synth = window.speechSynthesis;
export const textToSpeech = (message: string) => {
const msg = new SpeechSynthesisUtterance();
msg.lang = 'zh-CN';
msg.text = message;
synth.speak(msg);
};
textToSpeech('我去你大爷');
const synth = window.speechSynthesis;
const textToSpeech = (message) => {
const msg = new SpeechSynthesisUtterance();
msg.lang = 'zh-HK';
msg.text = message;
synth.speak(msg);
};
textToSpeech('扑街仔');