wx.startRecord怎么获取录音的时间

发布于 7 年前作者 gwu13197 次浏览最后编辑 7 年前来自 ask

文档上实在找不到

1 回复
gang94
gang941 楼5 年前

你真傻,我教你吧

var time=0;

var recordTime=null;

wx.startRecord({

 success: function(res) {    

    recordTime=setInterval(function(){time++;},1000);

 },  fail: function(res) {     //录音失败

 },

  complete:function(res){

    clearInterval(recordTime);

  //time就是录音时间

}

})