首先是某些背景信息:
我有一个在ARM上运行的橙色馅饼(有点覆盆子pi 3),所以我无法安装真正的镀铬。
我有一个运行在chrome上的Node.js应用程序,语音识别是客户端。除了晚上8点到凌晨3点之外,语音识别效果很好。该应用程序每天都在运行。
部分代码:
var init = function (sandBox) {
_sandbox = sandBox;
_recognition = new webkitSpeechRecognition();
// Are we processing a short phrase or performing continuous dictation?
_recognition.continuous = true;
// Do we require interim results in addition to the final results?
//_recognition.interimResults = true;
_recognition.lang = 'fr-FR';
// Kick off the Speech to Text recognition process
_recognition.start();
notify('start recording');
// Set up
_recognition.onstart = function (event) {
if (_deaf) {
return;
}
};
_recognition.onerror = function (event) {
// console.log("onerror", event);
/*
_recognition.stop();
setTimeout(function () {
_recognition.start();
}, 1000);
*/
};
// Process parsed result
_recognition.onresult = function (event) {
notify('display bottom', 'listen : '+event.results[event.results.length - 1][event.results[event.results.length - 1].length - 1].transcript );
if (_deaf) {
return;
}
if (+event.results[event.results.length - 1][event.results[event.results.length - 1].length - 1].confidence > 0.5) {
_sandbox.notifyServer('speakable', event.results[event.results.length - 1][event.results[event.results.length - 1].length - 1].transcript);
}
};
// Housekeeping after success or failed parsing
_recognition.onend = function () {
try {
_recognition.start();
} catch (e) {
//console.info(e);
// do nothing
}
};
/*
setInterval(function () {
try {
_recognition.stop();
setTimeout(function () {
_recognition.start();
}, 1000);
} catch (e) {
//console.info(e);
// do nothing
}
}, 5000);*/
};
错误:
我收到网络错误。但这并不意味着网络运行良好。
问题: 为什么?说真的,为什么它很好用,除非我真的想用它?关闭浏览器并重新打开它似乎没有帮助。凌晨3点左右再次运作......这个问题让我发疯了。