更新记录
1.0.0(2024-10-18)
新版本上传
平台兼容性
App |
快应用 |
微信小程序 |
支付宝小程序 |
百度小程序 |
字节小程序 |
QQ小程序 |
HBuilderX 4.29,Android:6.0,iOS:不支持,HarmonyNext:不确定 |
× |
× |
× |
× |
× |
× |
钉钉小程序 |
快手小程序 |
飞书小程序 |
京东小程序 |
× |
× |
× |
× |
H5-Safari |
Android Browser |
微信浏览器(Android) |
QQ浏览器(Android) |
Chrome |
IE |
Edge |
Firefox |
PC-Safari |
× |
× |
× |
× |
× |
× |
× |
× |
× |
<template>
<view>
<laowu-uvccamera class="camera" @capture="captureSuccess" @deviceList="getDeviceList" ref="laowuCameraUvc"
style="width: 700px;height: 400px;" />
</view>
</template>
<script>
export default {
data() {
return {
}
},
onLoad() {},
methods: {
// 拍照成功
captureSuccess(e: UTSJSONObject) {
// 这里是拍照后的路径
console.log(e['path'])
},
// 获取设备成功
getDeviceList(str: string) {
this.showTimer = true
this.initdone()
let list = JSON.parse(str)
console.log(list);
// 这里获取所有的摄像头
const index: number[] = [];
for (let i = 0; i < (list as Array).length; i++) {
let row = (list[i] as UTSJSONObject)
let productName = (row['productName'] as string).toLowerCase();
// 这里是我写的判断 根据产品名称来的,但是不太确定
if (productName.includes("camera")) {
index.push(i)
}
}
if (index.length == 0) {
uni.showToast({
title: "摄像头获取失败",
icon: "none"
})
return;
}
(this.$refs['laowuCameraUvc'] as LaowuUvccameraElement).startApp(index[1] as Int);
}
}
}
</script>
<style>
</style>