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

QMediaDevices::videoInputs returns empty list when used alone

    XMLWordPrintable

Details

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

    Description

      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();
      }

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated: