还记得曾经那个能识别语音的API吗?当时一直在想,如果能让浏览器替我念出文字就好了。现在chrome的最新版本Version 33 中您只要按F12然后在console里面输入这段代码,您就能听到浏览器阅读。
var msg = new SpeechSynthesisUtterance('ni hao,zhi hui xing qiu qunhao:281151953');
msg.lang = 'zh';
msg.voice = speechSynthesis.getVoices().filter(function(voice) {
return voice.name == 'Whisper';
})[0];
speechSynthesis.speak(msg);
var msg = new SpeechSynthesisUtterance('ni hao,zhi hui xing qiu qunhao:281151953');
msg.lang = 'zh';
msg.voice = speechSynthesis.getVoices().filter(function(voice) {
return voice.name == 'Whisper';
})[0];
speechSynthesis.speak(msg);