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

QMediaDevices::videoInputs returns empty list when used alone

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P1: Critical P1: Critical
    • None
    • 6.5.0
    • Multimedia
    • None
    • Windows 11 - MSVC2019
    • Windows

      As reported on SO, I'm getting an empty QList when using QMediaDevices::videoInputs().

      However I've noticed that if I make a call to QMediaDevices::audioInputs() (useless for me) before videoInputs(), this latter works fine.

       

      #include <QCoreApplication>
      #include <QtCore>
      #include <QCameraDevice>
      #include <QMediaDevices>
      #include <QAudioDevice>
      
      int main(int argc, char *argv[])
      {
          init_messages_name();    QCoreApplication app(argc, argv);
          // If this is left out, videoInputDevices.count() is zero, otherwise 1 and returns the correct webcam.
          const auto audioInputs = QMediaDevices::audioInputs();
          const auto videoInputDevices = QMediaDevices::videoInputs();
          qDebug() << videoInputDevices.count();    
          return app.exec();
      }

        For Gerrit Dashboard: QTBUG-112702
        # Subject Branch Project Status CR V

            laknoll Lars Knoll
            buzzita buzzita
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes