Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.6.1
-
macOS 14.2.1, MacBook Air 13" or iPadOS 17.2, 10th generation iPad (model MPQ13LL/A)
-
-
1f2f6d571 (dev)
Description
On iOS and macOS, when a QML Camera class is instantiated, it attempts to acquire access to the camera (even before a call to cameraInstance.start()). If permissions have not yet been granted, then the associated cameraInstance.cameraDevice instance becomes unusable until the cameraDevice is changed. This is visible in the sample code by a blank screen in the GUI, instead of a live video preview from the camera. On Windows and Android, these problems do not manifest.
The attached code is a lightly modified declarative-camera example; note that permissions are acquired using CameraPermissions based on the Qt docs. When permissions are acquired, the sample code attempts to assign camera.cameraDevice = mediaDevices.defaultVideoInput. However, this assignment does not create a new (valid) cameraDevice instance, since (I assume) the existing instance is already the "broken" (permission denied) cameraDevice. If more than one camera is available, then switching to another camera then switching back to the original camera causes the program to correctly display video. Another approach: quitting the application after granting camera access then immediately rerunning it correctly displays video, since the program at startup already has permission to access the camera.