feat:摄像头选择,副屏页面修改

This commit is contained in:
dzc committed 2026-09-10 15:25:41 +08:00
1 parent 2e929c199b
commit a81a79b69f
9 files changed
+613 -10

No files matched your search

@@ -142,6 +142,25 @@ abstract class FaceDiscernPlugs {
return _invokeRecognizeConfiguration('resetRecognizeConfiguration');
}
/// 枚举终端摄像头并逐一做预览帧色度探测;探测需短暂打开摄像头,耗时数秒。
static Future<TerminalCameraSelection> getCameraChoices() async {
final map = await _channel.invokeMethod<dynamic>('getCameraChoices');
if (map is! Map) throw StateError('原生未返回有效的摄像头列表');
return TerminalCameraSelection.fromMap(map);
}
/// 保存人工选择的识别摄像头;-1 恢复自动选择。空闲时立即生效,识别中延迟到会话结束。
static Future<void> setCameraSelection(int cameraId) async {
await _channel.invokeMethod<void>('setCameraSelection', {
'cameraId': cameraId,
});
}
/// 只读当前人工选择的识别摄像头编号;-1 表示自动,不触发摄像头探测。
static Future<int> getCameraSelection() async {
return await _channel.invokeMethod<int>('getCameraSelection') ?? -1;
}
static Stream<FaceRecognitionSessionEvent> get sessionStream {
_sessionStream ??= _sessionEventChannel
.receiveBroadcastStream()