Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QCamera is not working on the Android Device
Qt 6.11 is out! See what's new in the release blog

QCamera is not working on the Android Device

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 3 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Ibrahim
    wrote on last edited by
    #1

    Hi; I am working QCamera application on the desktop application but this application is not working on the Android device. Just opening the application. Code:

    MainWindow::MainWindow(QWidget* parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
    {
      ui->setupUi(this);
      QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
      for (const QCameraInfo& camera : cameras)
        QMessageBox::information(this, "Cameras", camera.deviceName());
      QCamera* camera = new QCamera(QCamera::BackFace);
      QCameraViewfinder* viewfinder = new QCameraViewfinder(ui->frame);
      camera->setViewfinder(viewfinder);
      camera->start();
    }
    

    MainWindow and a QFrame. Device: Android 4.4.4 and Qt 5.5.1. Thanks.

    M 1 Reply Last reply
    0
    • I Ibrahim

      Hi; I am working QCamera application on the desktop application but this application is not working on the Android device. Just opening the application. Code:

      MainWindow::MainWindow(QWidget* parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
      {
        ui->setupUi(this);
        QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
        for (const QCameraInfo& camera : cameras)
          QMessageBox::information(this, "Cameras", camera.deviceName());
        QCamera* camera = new QCamera(QCamera::BackFace);
        QCameraViewfinder* viewfinder = new QCameraViewfinder(ui->frame);
        camera->setViewfinder(viewfinder);
        camera->start();
      }
      

      MainWindow and a QFrame. Device: Android 4.4.4 and Qt 5.5.1. Thanks.

      M Offline
      M Offline
      mvuori
      wrote on last edited by
      #2

      You should try the beta of Qt 5.6 (the latest is in https://download.qt.io/snapshots/qt/5.6/5.6.0-beta/324). QCamera has had problems, most of which should be fixed in 5.6.

      (I have QCamera working on Android, but I grab the feed as individual frames via QAbstractVideoSurface so I don't know whether the "simple way" works or not.)

      1 Reply Last reply
      0
      • PowerNowP Offline
        PowerNowP Offline
        PowerNow
        wrote on last edited by
        #3

        Hi, I'm new by Qt and until now I learned the basic concepts of it. Now I want to program a frame grabber for win desktop and android smartphones. My first try was to use the same way as Ibrahim. It works great for win desktop but on my LG G2 smartphone the viefinder stay unfortentately dark. Nevertheless I'm using QT 5.6.0. Do you know if it should work already with this Qt version or what else could be the reason?
        The next step is using a methode with QVideoFrame. Do you know it works on android? Could you maybe help me with a small code example? Thanks.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved