fix:多平台兼容

This commit is contained in:
2026-03-16 11:52:27 +08:00
parent b3836b8bf2
commit a79cf10bd4
18 changed files with 358 additions and 295 deletions
+12 -7
View File
@@ -327,19 +327,24 @@ const handleInitError = (err) => {
if (err.name === 'NotAllowedError' || err.name === 'PermissionDeniedError') {
errMsg = '摄像头权限被拒绝';
errDetail = '请在浏览器设置中允许访问摄像头';
} else if (err.name === 'NotFoundError' || err.name === 'DevicesNotFoundError') {
}
else if (err.name === 'NotFoundError' || err.name === 'DevicesNotFoundError') {
errMsg = '未找到可用的摄像头';
errDetail = '请确保设备有摄像头';
} else if (err.name === 'NotReadableError' || err.name === 'TrackStartError') {
}
else if (err.name === 'NotReadableError' || err.name === 'TrackStartError') {
errMsg = '摄像头被占用';
errDetail = '请关闭其他使用摄像头的应用';
} else if (err.name === 'NotSupportedError') {
}
else if (err.name === 'NotSupportedError') {
errMsg = '浏览器不支持';
errDetail = '请使用现代浏览器访问';
} else if (location.protocol !== 'https:' && location.hostname !== 'localhost' && location.hostname !== '127.0.0.1') {
errMsg = '需要 HTTPS 环境';
errDetail = '摄像头功能需要在安全环境下使用';
} else {
}
// else if (location.protocol !== 'https:' && location.hostname !== 'localhost' && location.hostname !== '127.0.0.1') {
// errMsg = '需要 HTTPS 环境';
// errDetail = '摄像头功能需要在安全环境下使用';
// }
else {
errMsg = err.message || '摄像头启动失败';
errDetail = '请尝试刷新页面或使用其他方式';
}