initialize camera on macos

and quiet warning re: NSCameraUseContinuityCameraDeviceType
This commit is contained in:
sneurlax 2024-07-26 04:19:52 -05:00 committed by julian-CStack
parent c708ace18c
commit cd38a5153b
2 changed files with 4 additions and 0 deletions

View file

@ -13,6 +13,7 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:camera_linux/camera_linux.dart'; import 'package:camera_linux/camera_linux.dart';
import 'package:camera_macos/camera_macos_arguments.dart';
import 'package:camera_macos/camera_macos_controller.dart'; import 'package:camera_macos/camera_macos_controller.dart';
import 'package:camera_macos/camera_macos_device.dart'; import 'package:camera_macos/camera_macos_device.dart';
import 'package:camera_macos/camera_macos_platform_interface.dart'; import 'package:camera_macos/camera_macos_platform_interface.dart';
@ -2054,6 +2055,7 @@ class _QrCodeScannerDialogState extends State<QrCodeScannerDialog> {
throw Exception('No cameras available'); throw Exception('No cameras available');
} }
_macOSDeviceId = videoDevices.first.deviceId; _macOSDeviceId = videoDevices.first.deviceId;
await CameraMacOS.instance.initialize(cameraMacOSMode: CameraMacOSMode.photo);
setState(() { setState(() {
_isCameraOpen = true; _isCameraOpen = true;

View file

@ -32,5 +32,7 @@
<string>QR Code scanning</string> <string>QR Code scanning</string>
<key>NSMicrophoneUsageDescription</key> <key>NSMicrophoneUsageDescription</key>
<string>QR Code Scanning. A temporary requirement due to limitations in the camera_macos package that are being worked on to remove the need for this permission.</string> <string>QR Code Scanning. A temporary requirement due to limitations in the camera_macos package that are being worked on to remove the need for this permission.</string>
<key>NSCameraUseContinuityCameraDeviceType</key>
<true/>
</dict> </dict>
</plist> </plist>