引用的是lichenying的代码
原文链接:https://blog.csdn.net/lichenying/article/details/107244198

在安卓上测试可以

html

<button @click="voice">识别3</button>
			<view>{{ff}}</view>

js

voice() {
				var me = this;
				var options = {};
				options.engine = 'iFly';
				options.punctuation = false; // 是否需要标点符号 
				options.timeout = 10 * 1000;
				plus.speech.startRecognize(options, function(s) {
					me.searchText = me.searchText + s;
					console.log(me.searchText)//拿到语音识别的结果
					//下面是逻辑  
					me.ff = s;
					
					me.searchText = ""
					plus.speech.stopRecognize();
				});
			},
Logo

CSDN联合极客时间,共同打造面向开发者的精品内容学习社区,助力成长!

更多推荐