wx.chooseImg & wx.chooseVideo 设置camera无效
发布于 4 年前 作者 yang95 11014 次浏览 来自 问答

设置 camera 属性没用,全是后置

chooseImgBack: function () {
   wx.chooseImage({
     count: 1,
     sizeType: ['original'],
     sourceType: ['camera'],
     camera: 'back',
     success(res) {
       // tempFilePath可以作为img标签的src属性显示图片
       const tempFilePaths = res.tempFilePaths
     }
   })
 },
 
 chooseImgFront: function () {
   wx.chooseImage({
     count: 1,
     sizeType: ['original'],
     sourceType: ['camera'],
     camera: 'front',
     success(res) {
       // tempFilePath可以作为img标签的src属性显示图片
       const tempFilePaths = res.tempFilePaths
     }
   })
 },
 
 chooseVideoBack: function () {
   wx.chooseVideo({
     sourceType: ['camera'],
     maxDuration: 10,
     camera: 'back',
     success(res) {
       console.log(res.tempFilePath)
     }
   })
 },
 
 chooseVideoFront: function () {
   wx.chooseVideo({
     sourceType: ['camera'],
     maxDuration: 30,
     camera: 'front',
     success(res) {
       console.log(res.tempFilePath)
     }
   })
 },
1 回复

请提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

回到顶部