missfei
missfei
  • 发布:2025-04-07 10:54
  • 更新:2025-04-09 15:58
  • 阅读:59

【报Bug】plus.camera.getCamera 不能默认使用前置摄像头

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10 64

HBuilderX类型: 正式

HBuilderX版本号: 4.61

手机系统: Android

手机系统版本号: Android 12

手机厂商: HT10

手机机型: HT10

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

操作步骤:

也就是 几句代码  var cmr = plus.camera.getCamera(2);
var res = cmr.supportedImageResolutions[0];
var fmt = cmr.supportedImageFormats[0];
console.log("Resolution: "+res+", Format: "+fmt);
cmr.captureImage( function( path ){
console.log(res);

},
function( error ) {
alert( "Capture image failed: " + error.message );
},
);

预期结果:

想默认打开前置

实际结果:

一直打开的都是后置

bug描述:

uniapp 安卓上面不能使用前置摄像头? ,我试了下 plus 也不行呢
也就是 几句代码  var cmr = plus.camera.getCamera(2);
var res = cmr.supportedImageResolutions[0];
var fmt = cmr.supportedImageFormats[0];
console.log("Resolution: "+res+", Format: "+fmt);
cmr.captureImage( function( path ){
console.log(res);

},
function( error ) {
alert( "Capture image failed: " + error.message );
},
);

2025-04-07 10:54 负责人:无 分享
已邀请:
DCloud_UNI_yuhe

DCloud_UNI_yuhe

  • missfei (作者)

    不行啊还是不能打开前置摄像头,只能打开后面的

    2025-04-07 11:57

  • missfei (作者)

    //获取摄像头管理对象

    var camera = plus.camera.getCamera(2);

    //分辨率

    var res = camera.supportedImageResolutions[0];

    //文件格式

    var fmt = camera.supportedImageFormats[0];

    //图片文件保存的路径

    console.log(camera)

    camera.captureImage(

    (path) => {

    console.log("拍照成功,图片路径是: " + path);

    },

    (error) => {

    console.log("拍照失败: " + error.message);

    },

    {

    resolution: res,

    format: fmt,

    index:"2"

    }

    );

    2025-04-07 11:59

j***@163.com

j***@163.com

安卓好像只能切换

  • missfei (作者)

    本来以为是个很简单的事情,没想到这么扯淡

    2025-04-09 18:01

要回复问题请先登录注册