QCamera is not working on the Android Device



  • 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.



  • 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.)



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.