4***@qq.com
4***@qq.com
  • 发布:2022-12-21 08:17
  • 更新:2022-12-21 09:00
  • 阅读:150

各位大拿 ,问一下hbuilder怎么实现与海康摄像头对接

分类:HBuilderX

各位大拿 ,问一下hbuilder怎么实现与海康摄像头对接

2022-12-21 08:17 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com

index:1启用后置摄像头,0启用前置摄像头

var camera;
if (index == undefined) {
camera = plus.camera.getCamera();
} else {
camera = plus.camera.getCamera(index);
}
var res = camera.supportedImageResolutions[0];
var fmt = camera.supportedImageFormats[0];
var options = {
resolution: res,
format: fmt
}
camera.captureImage(function(e) {

            plus.io.resolveLocalFileSystemURL(e, function(entry) {  
                var path = entry.toLocalURL();  
                console.log('path=' + path);  
                if (isCompress) {  
                    success(path, path);  
                    return;  
                }  
                var combine = path.substring(path.lastIndexOf('.'));  
                var to = path.substring(0, path.lastIndexOf('.')) + "_zip";  
                to = to + combine;  
                compressImage(path, to, success, false, zipRate);  
            }, function(e) {  
                mui.toast("读取拍照文件错误:" + e.message);  
            });  

        }, function(args) {  
            error(args);  
        }, options);

要回复问题请先登录注册