fix(scanQRcode): 调整摄像头分辨率并优化iOS自动对焦逻辑
1. 将摄像头分辨率改为1920x1080,适配iOS系统自动对焦触发条件 2. 添加实际分辨率和FPS的调试日志 3. 仅在非iOS平台手动启动自动对焦协程
This commit is contained in:
parent
a3b29d5414
commit
25462f218e
@ -205,11 +205,14 @@ namespace Kill.UI.Pages
|
||||
}
|
||||
Debug.Log($"[ScanQRcode] 选中摄像头: {deviceName}");
|
||||
|
||||
webCamTexture = new WebCamTexture(deviceName, 2160, 30);
|
||||
// 使用 1080p 原生分辨率,iOS 会触发系统连续自动对焦
|
||||
webCamTexture = new WebCamTexture(deviceName, 1920, 1080, 30);
|
||||
webCamTexture.Play();
|
||||
|
||||
yield return new WaitUntil(() => webCamTexture.width > 100);
|
||||
|
||||
Debug.Log($"[ScanQRcode] 实际摄像头分辨率: {webCamTexture.width}x{webCamTexture.height} FPS:{webCamTexture.requestedFPS}");
|
||||
|
||||
AdjustPreviewAspect();
|
||||
|
||||
isScanning = true;
|
||||
@ -218,7 +221,11 @@ namespace Kill.UI.Pages
|
||||
|
||||
if (enableAutoFocus)
|
||||
{
|
||||
#if UNITY_IOS && !UNITY_EDITOR
|
||||
// iOS 通过高分辨率触发系统连续自动对焦,无需额外操作
|
||||
#else
|
||||
StartCoroutine(AutoFocusCoroutine());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user