onLoad() {
this.ctx = uni.createCameraContext();
uni.authorize({
scope: 'scope.camera',
success() {
console.log('授权了摄像头')
}
})
},
onShow() {
this.animate()
this.startRecord()
},
// 保存拍照画面
takePhoto() {
this.ctx.takePhoto({
quality: 'high',
success: (res) => {
this.src = res.tempImagePath
},
fail: (err) => {
// not allow to invoke takephoto in 'scancode' mode
//不允许在“扫描代码”模式下调用takephoto
console.log('err1', err)
}
});
},
startRecord() {
this.ctx.startRecord({
success: (res) => {
console.log('startRecord', res)
},
fail: (err) => {
console.log('err2', err)
}
})
},
stopRecord() {
this.ctx.stopRecord({
success: (res) => {
console.log('暂停录制参数', res)
// this.setData({
// src: res.tempThumbPath,
// videoSrc: res.tempVideoPath
// })
},
fail: (err) => {
console.log('err3', err)
}
})
},

- 发布:2021-08-09 11:24
- 更新:2021-08-09 11:24
- 阅读:1813
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: windows10企业版64位操作系统
HBuilderX类型: 正式
HBuilderX版本号: 3.1.12
第三方开发者工具版本号: 1.05.2107221
基础库版本号: 2.19.0
项目创建方式: HBuilderX
App下载地址或H5⽹址: https://www.dcloud.io/hbuilderx.html
示例代码:
操作步骤:
会打印出err2 然后提示not allow to invoke takephoto in 'scancode' mode
会打印出err2 然后提示not allow to invoke takephoto in 'scancode' mode
预期结果:
打印出startRecord和回调参数
打印出startRecord和回调参数
实际结果:
err1,{errMsg:'not allow to invoke takephoto in 'scancode' mode'}
err2,{errMsg:'not allow to invoke takephoto in 'scancode' mode'}
err1,{errMsg:'not allow to invoke takephoto in 'scancode' mode'}
err2,{errMsg:'not allow to invoke takephoto in 'scancode' mode'}
bug描述:
在进入页面中 马上调用 相机录制 然后提示not allow to invoke takephoto in 'scancode' mode 不能在扫码模式下 拍照 但是我是调用的录像啊,然后在扫码成功之后停止录制,获取到最后一针图像 显示在扫码区域 以便后续的页面停留操作。
0 个回复