小程序
小游戏
企业微信
微信支付
扫描小程序码分享
在模拟器、真机均会返回
tempThumbPath和tempVideoPath属性
模拟器
真机
PC端则没有
4 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
我也是这个问题
遇到了一样的问题,大佬有解决了吗
开始录制:
start_recorder: function () { this.ctx = wx.createCameraContext(); let time = this.data.camera.timeout; let that = this; recorder_time_start = new Date().getTime(); this.ctx.startRecord({ timeout: time, success: (res) => { console.log('startRecord') console.log(res); this.setData({ button: 2 }); }, timeoutCallback: (res) => { console.log('录制超时') console.log(res); wx.showToast({ title: '录制超时', icon: 'error', duration: 2000 }); this.stop_recorder(); }, fail: (err) => { console.log(err); //wx.showToast({ title: JSON.stringify(err), icon: 'error', duration: 2000 }); setTimeout(() => { this.start_recorder(); }, 2000); }, complete: (res) => { console.log('调用完成') } }); },
停止录制:
stop_recorder: function () { console.log('test:', '::', 'stop') wx.showLoading({ title: '正在停止录制并压缩...', mask: true }); clearInterval(listener_interval); listener_interval = null; clearInterval(obj_interval); obj_interval = null; this.ctx.stopRecord({ compressed: true, success: (res) => { console.log('保存结果', res); wx.hideLoading({}); if (1 == stop_recorder_state) { let target = '/pages/record/answer'; wx.navigateTo({ url: target }); return; } let index = app.globalData.index; let question = app.globalData.investigation.question; let last = index == (question.length - 1); app.globalData.investigation.question[index].duration = this.data.count; this.setData({ imageSrc: res.tempThumbPath, videoSrc: res.tempVideoPath, stopbutton: false, button: 3, component: 2, counttext: '00:00', count: 0, last: last }); }, fail: (err) => { console.log('停止错误:', err); wx.showToast({ title: JSON.stringify(err), icon: 'error', duration: 2000 }); wx.hideLoading({}); }, complete: (res) => { console.log('停止完成', res) } }); },
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
start_recorder: function () {
this.ctx = wx.createCameraContext();
let time = this.data.camera.timeout;
let that = this;
recorder_time_start = new Date().getTime();
this.ctx.startRecord({
timeout: time,
success: (res) => {
console.log('startRecord')
console.log(res);
this.setData({
button: 2
});
},
timeoutCallback: (res) => {
console.log('录制超时')
console.log(res);
wx.showToast({ title: '录制超时', icon: 'error', duration: 2000 });
this.stop_recorder();
},
fail: (err) => {
console.log(err);
//wx.showToast({ title: JSON.stringify(err), icon: 'error', duration: 2000 });
setTimeout(() => {
this.start_recorder();
}, 2000);
},
complete: (res) => {
console.log('调用完成')
}
});
},
停止录制:
stop_recorder: function () {
console.log('test:', '::', 'stop')
wx.showLoading({ title: '正在停止录制并压缩...', mask: true });
clearInterval(listener_interval);
listener_interval = null;
clearInterval(obj_interval);
obj_interval = null;
this.ctx.stopRecord({
compressed: true,
success: (res) => {
console.log('保存结果', res);
wx.hideLoading({});
if (1 == stop_recorder_state) {
let target = '/pages/record/answer';
wx.navigateTo({ url: target });
return;
}
let index = app.globalData.index;
let question = app.globalData.investigation.question;
let last = index == (question.length - 1);
app.globalData.investigation.question[index].duration = this.data.count;
this.setData({
imageSrc: res.tempThumbPath,
videoSrc: res.tempVideoPath,
stopbutton: false,
button: 3,
component: 2,
counttext: '00:00',
count: 0,
last: last
});
},
fail: (err) => {
console.log('停止错误:', err);
wx.showToast({ title: JSON.stringify(err), icon: 'error', duration: 2000 });
wx.hideLoading({});
},
complete: (res) => {
console.log('停止完成', res)
}
});
},
我也是这个问题
遇到了一样的问题,大佬有解决了吗
开始录制:
start_recorder: function () { this.ctx = wx.createCameraContext(); let time = this.data.camera.timeout; let that = this; recorder_time_start = new Date().getTime(); this.ctx.startRecord({ timeout: time, success: (res) => { console.log('startRecord') console.log(res); this.setData({ button: 2 }); }, timeoutCallback: (res) => { console.log('录制超时') console.log(res); wx.showToast({ title: '录制超时', icon: 'error', duration: 2000 }); this.stop_recorder(); }, fail: (err) => { console.log(err); //wx.showToast({ title: JSON.stringify(err), icon: 'error', duration: 2000 }); setTimeout(() => { this.start_recorder(); }, 2000); }, complete: (res) => { console.log('调用完成') } }); },
停止录制:
stop_recorder: function () { console.log('test:', '::', 'stop') wx.showLoading({ title: '正在停止录制并压缩...', mask: true }); clearInterval(listener_interval); listener_interval = null; clearInterval(obj_interval); obj_interval = null; this.ctx.stopRecord({ compressed: true, success: (res) => { console.log('保存结果', res); wx.hideLoading({}); if (1 == stop_recorder_state) { let target = '/pages/record/answer'; wx.navigateTo({ url: target }); return; } let index = app.globalData.index; let question = app.globalData.investigation.question; let last = index == (question.length - 1); app.globalData.investigation.question[index].duration = this.data.count; this.setData({ imageSrc: res.tempThumbPath, videoSrc: res.tempVideoPath, stopbutton: false, button: 3, component: 2, counttext: '00:00', count: 0, last: last }); }, fail: (err) => { console.log('停止错误:', err); wx.showToast({ title: JSON.stringify(err), icon: 'error', duration: 2000 }); wx.hideLoading({}); }, complete: (res) => { console.log('停止完成', res) } }); },