Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-120567

Incorrect interactions between QML Camera and CameraPermission

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.8.0 FF
    • 6.6.1
    • Multimedia
    • macOS 14.2.1, MacBook Air 13" or iPadOS 17.2, 10th generation iPad (model MPQ13LL/A)
    • iOS/tvOS/watchOS, macOS
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpochep Timur Pocheptsov
            bjones Bryan Jones
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes