Can MediaDevices be used without blocking the app?
-
Whenever I want to get a list of cameras, on defining a MediaDevices component, the application blocks while finding the cameras, this is a big usability issue as I've seen this take many seconds and Windows shows the "application is not responding" prompt.
Is there a way to scan for cameras without blocking the app?
Thanks
-
I solved it by fetching media devices in C++ on a thread, and then through a callback function to QML, in QML I can fetch the cameras asynchronously.
There is a great article on doing async operations between C++ and QML in a very simple way using callbacks, for anyone wanting to do async operations like the one I needed with QML and C++, here's the link to the article http://www.mardy.it/blog/2019/02/invoking-a-c++-function-from-qml-asynchronously.html
Although it would be great that instead QML would handle it by itself, as it's a big UX problem blocking the whole application every time you need to use the MediaDevices type.
-