-
Bug
-
Resolution: Done
-
P2: Important
-
5.9.5, 5.10.1
-
None
-
Kubuntu Linux 17.10, 64 bit.
GStreamer 1.0.
When loading Camera element on Linux desktop, there are 2 issues:
- Camera startup takes a long time (15 seconds). Much longer than QtWidgets camera, and much much longer than on Android.
- And more crucially: while Camera is starting, the app semi-freezes (user input is impossible, mouse clicks do not work, some UI animations stop).
This issue is reproducible at least on Qt 5.8, 5.9 and 5.10. Older releases are possibly affected as well (I have not tested them, though). I can live with 1), but 2) is a real problem.
The only workaround I know is to use QtWidgets, and load camera in another thread. That works, but after camera is loaded it is noticeably slower than QML camera.
JIRA does not allow me to attach example app, so I'll paste the code here instead:
import QtQuick 2.9 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 import QtMultimedia 5.9 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Rectangle { id: root anchors.fill: parent Loader { id: loader asynchronous: true anchors.fill: parent sourceComponent: Item { anchors.fill: parent Camera { id: camera imageCapture { onImageCaptured: { photoPreview.source = preview // Show the preview in an Image } } } VideoOutput { source: camera anchors.fill: parent focus : visible // to receive focus and capture key events when visible } } } Image { id: photoPreview } BusyIndicator { running: true } MouseArea { anchors.fill: parent onClicked: console.log("Click! " + mouse.x + ", " + mouse.y) } } }
Once you start the app, try clicking on the window - notice that mouse click events will be handled after camera loads. During loading, no reaction to input will be visible.