问题模块 框架类型 问题类型 操作系统 操作系统版本 手机型号 微信版本
客户端 微信小程序 Bug iOS ios12.0.1 iphone 8 plus 6.7.3
- 当前 Bug 的表现(可附上截图)
快速点击时,不触发catch:touchend,还有catch:touchcancel,,以至于,不能停止录音
- 预期表现
像安卓一样,即使快速点击,也能触发catch:touchend,还有catch:touchcancel,,,,实现,不到一秒钟录音,弹出提示框
- 复现路径
- 提供一个最简复现 Demo
{{ RecordDesc[recordStatus] }}
class="dot"
catch:touchstart="handleRecording"
catch:touchmove="handleRecordingMove"
catch:touchend="handleRecordingCancel"
catch:touchcancel="handleRecordingCancel"
catchtap='dianji'>
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)
}
})
代码片段
{{ RecordDesc[recordStatus] }} 微信小程序开发问题解答
微信小程序开发者回答:
麻烦给个相关的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html),我们定位下问题
微信小程序开发者回答:
wechatide://minicode/6lX2bLmd7a3z
谢谢
本文网址:http://www.91bianli.com/weixinxiaochengxu/37565.html