项目用到科大讯发的语音识别,希望在语音识别结束之后做一些搜索的工作。
现在捕获不到识别结束的事件。代码如下:
function startRecognize() {
if(plus.os.name=='Android'&&navigator.userAgent.indexOf('StreamApp')>0){
plus.nativeUI.toast('当前环境暂不支持语音识别插件');
return;
}
var options = {};
options.engine = 'iFly';
//options.punctuation = false; // 是否需要标点符号
** plus.speech.onend=function(){
console.log("stop speech");
}**
text.value = "";
outSet( "开始语音识别:" );
plus.speech.startRecognize( options, function ( s ) {
outLine( s );
text.value += s;
}, function ( e ) {
outSet( "语音识别失败:"+e.message );
} );
}
0 个回复