Appearance
初始化配置
注意
- uniappx项目中组合式api中需要在onMounted生命周期内处理,并调用组件提供的startLoad方法配置
- uniapp项目或uniappx项目的选项式api直接在data方法中配置即可
配置方式
vue
onMounted(() => {
nextTick(() => {
const config : JSONObject = new JSONObject();
//视图的圆角值
config.put("radius", 10)
//摄像头旋转角度
config.put("rotation", 90)
//图片文件保存目录
config.put("pictureDir", "/storage/emulated/0/Pictures/LevenUvcCamera/")
//视频保存目录
config.put("videoDir", "/storage/emulated/0/Movies/LevenUvcCamera/")
//默认打开的摄像头deviceName,如果不是通过这个打开默认摄像头请不需要此参数
// config.put("deviceName", "/dev/bus/usb/003/003")
//默认打开的摄像头产品名称
// config.put("productName", "RXGD-CAMERA")
//默认分辨率
// const size : JSONObject = new JSONObject();
// size.put("width", 800);
// size.put("height", 600);
// size.put("fps", 30);
// config.put("size", size);
refLevenUvc.value?.startLoad(config)
})
})vue
data() {
return {
config: {
//视图的圆角值
radius: 10,
//摄像头旋转角度
rotation: 90,
//图片文件保存目录
pictureDir: "/storage/emulated/0/Pictures/LevenUvcCamera/",
//视频保存目录
videoDir: "/storage/emulated/0/Movies/LevenUvcCamera/",
//默认打开的摄像头deviceName,如果不是通过这个打开默认摄像头请留空
// deviceName: "/dev/bus/usb/003/003",
//默认打开的摄像头产品名称
// productName: "RXGD-CAMERA",
//默认分辨率
// size: {
// width: 800,
// height: 600,
// fps: 30
// }
}
}
},参数说明
| 参数名 | 参数类型 | 是否必填 | 默认值 | 参数描述 |
|---|---|---|---|---|
| radius | Integer | 否 | 0 | 摄像头预览圆角 |
| rotation | Integer | 否 | 0 | 摄像头旋转角度 |
| pictureDir | String | 否 | 项目目录下 | 图片保存目录 |
| videoDir | String | 否 | 项目目录下 | 录像保存目录 |
| deviceName | String | 否 | 无 | 默认打开的摄像头路径,如:/dev/bus/usb/003/003 |
| productName | String | 否 | 无 | 默认打开的摄像头产品名称,如:RXGD-CAMERA |
| size | Object | 否 | 无 | 默认分辨率 |
| size.width | Integer | 否 | 无 | 分辨率的宽 |
| size.height | Integer | 否 | 无 | 分辨率的高 |
| size.fps | Integer | 否 | 30 | 帧率 |