I\'m trying to execute QCamera example on Ubuntu, Qt 5.6. \"The camera service is missing\" message observed.
defaultServiceProvider::requestService(): no s
Check if you have all dependencies installed. They are:
qtmultimedia5-dev
_
libqt5multimedia5-plugins
Ex:
sudo apt-get install libqt5multimedia5-plugins
Checking the example code it seems the example tries to construct the camera object with default camera. Method setCamera
is obviously called with camera info which is not valid.
setCamera(QCameraInfo::defaultCamera());
You can verify that by changing it to
QCameraInfo info = QCameraInfo::defaultCamera();
if (!info.isNull())
{
setCamera(info);
}
else
{
qError() << "Default camera not found!";
}
It obviously expects the camera to be found from /dev/video0
. You could check if it exists. If your camera is something like video1 or video2, you could rename it to video0 and try again.
You can also add a debug message to the for-loop in Camera class constructor to see device names of available cameras (and modify the code to select other than default camera).
foreach (const QCameraInfo &cameraInfo, QCameraInfo::availableCameras()) {
{
qDebug() << cameraInfo.deviceName();
}