const plugin = requirePlugin( "WechatSI" );
const manager = plugin.getRecordRecognitionManager();
Page({
data: {
},
onLoad: function (options) {
this .initRecord();
},
onReady: function () {
},
initRecord: function () {
manager.onStart = function (res) {
console.log( "成功开始录音识别" , res)
}
manager.onStop( function (res) {
console.log( "onStop" );
console.log(res);
})
manager.onError( function (err) {
console.log(err);
});
manager.onRecognize = function (res) {
console.log( "current result" , res.result)
}
},
startRecord: function () {
console.log( "long" );
manager.start({ duration: 10000, lang: "zh_CN" });
},
endRecord: function () {
manager.stop();
}
})
|