Appearance
切换摄像头
注意
- 该方法回调为异步事件,请参考切换摄像头
方法名
switchCamera
用法
js
function switchCamera() {
if (deviceList.value == null || deviceList.value.length == 0) {
uni.showToast({
title: "请先获取摄像头列表",
icon: "none"
})
return;
}
deviceIndex.value++;
if (deviceIndex.value >= deviceList.value.length) {
deviceIndex.value = 0;
}
const deviceName = deviceList.value[deviceIndex.value].getString("deviceName")
const params : JSONObject = new JSONObject();
params.put("deviceName", deviceName)
refLevenUvc.value?.switchCamera(params)
}参数说明
| 参数名 | 参数类型 | 是否必填 | 默认值 | 参数描述 |
|---|---|---|---|---|
| deviceName | String | 是 | 无 | 摄像头名称 |