官方不给解决啊。。。。。。
wx.getRecorderManager() 真机无法监听touchend事件长按录音后,手指离开未执行touchend事件 [图片] JS: [图片] [图片]
2018-12-21官方解决了吗?我也碰到这个问题了!
小程序录音- 当前 Bug 的表现(可附上截图) 快速点击时,不触发catch:touchend,还有catch:touchcancel,,以至于,不能停止录音 - 预期表现 像安卓一样,即使快速点击,也能触发catch:touchend,还有catch:touchcancel,,,,实现,不到一秒钟录音,弹出提示框 - 复现路径 - 提供一个最简复现 Demo [代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"modal modal-record"[代码] [代码]bind:tap[代码][代码]=[代码][代码]"toggleRecordModal"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"modal-body"[代码] [代码]catch:tap[代码][代码]=[代码][代码]"toggleWithoutAction"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]text[代码] [代码]class[代码][代码]=[代码][代码]"desc"[代码][代码]>{{ RecordDesc[recordStatus] }}</[代码][代码]text[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码][代码] [代码][代码]class[代码][代码]=[代码][代码]"dot"[代码][代码] [代码][代码]catch:touchstart[代码][代码]=[代码][代码]"handleRecording"[代码][代码] [代码][代码]catch:touchmove[代码][代码]=[代码][代码]"handleRecordingMove"[代码][代码] [代码][代码]catch:touchend[代码][代码]=[代码][代码]"handleRecordingCancel"[代码][代码] [代码][代码]catch:touchcancel[代码][代码]=[代码][代码]"handleRecordingCancel"[代码][代码] [代码][代码]catchtap[代码][代码]=[代码][代码]'dianji'[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]image[代码] [代码]class[代码][代码]=[代码][代码]"icon-mic"[代码] [代码]src[代码][代码]=[代码][代码]"../../img/mic@2x.png"[代码][代码]/>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码]</[代码][代码]view[代码][代码]>[代码][代码]Page({[代码][代码] [代码][代码]data: {[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]onLoad: [代码][代码]function[代码] [代码]() { [代码] [代码] [代码][代码]},[代码][代码] [代码][代码]onShow:[代码][代码]function[代码][代码](){[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]toggleWithoutAction(e) {[代码][代码] [代码][代码]// 阻止 tap 冒泡[代码][代码] [代码][代码]},[代码][代码] [代码][代码]asd: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]console.log([代码][代码]"123"[代码][代码])[代码][代码] [代码][代码]},[代码][代码] [代码][代码]toggleRecordModal() {[代码][代码] [代码][代码]console.log([代码][代码]"wrap"[代码][代码])[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]handleRecordingMove(e) {[代码][代码] [代码][代码]var[代码] [代码]touches = e.touches[0];[代码][代码] [代码][代码]var[代码] [代码]changedTouches = [代码][代码]this[代码][代码].data.changedTouches;[代码][代码] [代码][代码]if[代码] [代码](!changedTouches) {[代码][代码] [代码][代码]return[代码][代码];[代码][代码] [代码][代码]}[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]handleRecording(e) {[代码][代码] [代码][代码]console.log([代码][代码]"1"[代码][代码])[代码][代码] [代码][代码]let me = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]this[代码][代码].data.changedTouches = e.touches[0];[代码] [代码] [代码][代码]let recorderManager = wx.getRecorderManager();[代码][代码] [代码][代码]recorderManager.onStart(() => {[代码][代码] [代码][代码]console.log([代码][代码]"开始录音..."[代码][代码]);[代码][代码] [代码][代码]me.setData({[代码][代码] [代码][代码]num: 0[代码][代码] [代码][代码]})[代码][代码] [代码][代码]me.data.setInter = setInterval([代码][代码] [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]var[代码] [代码]numVal = me.data.num + 1;[代码][代码] [代码][代码]me.setData({ num: numVal });[代码][代码] [代码][代码]console.log([代码][代码]'setInterval=='[代码] [代码]+ me.data.num);[代码][代码] [代码][代码]}[代码][代码] [代码][代码], 1000);[代码][代码] [代码][代码]});[代码][代码] [代码][代码]recorderManager.start({[代码][代码] [代码][代码]format: [代码][代码]"mp3"[代码][代码] [代码][代码]});[代码][代码] [代码][代码]// 超时[代码][代码] [代码][代码]setTimeout([代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]me.handleRecordingCancel();[代码][代码] [代码][代码]}, 100000);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]handleRecordingCancel() {[代码][代码] [代码][代码]// 向上滑动状态停止:取消录音发放[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码] [代码] [代码][代码]let recorderManager = wx.getRecorderManager();[代码][代码] [代码][代码]recorderManager.onStop((res) => {[代码][代码] [代码][代码]console.log([代码][代码]"结束录音..."[代码][代码], res);[代码][代码] [代码][代码]clearInterval(that.data.setInter)[代码] [代码] [代码][代码]// 上传[代码][代码] [代码][代码]var[代码] [代码]mediaDuration = that.data.num[代码][代码] [代码][代码]if[代码] [代码](mediaDuration < 1) {[代码][代码] [代码][代码]// mediaDuration = 1[代码][代码] [代码][代码]wx.showModal({[代码][代码] [代码][代码]title: [代码][代码]'录音不能少于1s'[代码][代码],[代码][代码] [代码][代码]confirmText: [代码][代码]'OK'[代码][代码],[代码][代码] [代码][代码]showCancel: [代码][代码]false[代码][代码] [代码][代码]})[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]this[代码][代码].uploadRecord(res.tempFilePath);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码][代码] [代码][代码]// 停止录音[代码][代码] [代码][代码]recorderManager.stop();[代码][代码] [代码][代码]},[代码][代码] [代码][代码]uploadRecord(tempFilePath) {[代码][代码] [代码][代码]console.log(tempFilePath)[代码][代码] [代码][代码]}[代码][代码]})[代码]
2018-12-21咋解决,官方怎么不解决啊!
touched事件有时不触发问题[图片] [图片] 手指触模或移动,松开后有时没有触发touchend事件
2018-12-21