Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Can MediaDevices be used without blocking the app?

Can MediaDevices be used without blocking the app?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 196 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.
  • R Offline
    R Offline
    raulgd
    wrote on last edited by
    #1

    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

    Raul Guerrero
    http://jimi.mx

    1 Reply Last reply
    0
    • R Offline
      R Offline
      raulgd
      wrote on last edited by
      #2

      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.

      Raul Guerrero
      http://jimi.mx

      1 Reply Last reply
      0
      • R raulgd has marked this topic as solved on

      • Login

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