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. QMl Camera returns "Camera is in use" if restarted
Forum Updated to NodeBB v4.3 + New Features

QMl Camera returns "Camera is in use" if restarted

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 434 Views 1 Watching
  • 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.
  • MesrineM Offline
    MesrineM Offline
    Mesrine
    wrote on last edited by
    #1

    Hi everyone,

    I am using qt6.7.0.
    Using the camera QML type like

    import QtQuick 2.0
    import QtMultimedia
    
    Item
    {
        id:root
      
        function stop() {
            camera.stop();
            startcamera.visible=true;
            }
    
       
        Camera {
            id: camera
            active: false
            onErrorOccurred: (error,errorString)=> {
                                 console.log(errorString)
                                 console.log(error)
                             }
    
        }
        
        MyButton
        {
            id:startcamera
            anchors.centerIn: root
            text:qsTr("ScanQr")
            onClicked:
            {
                camera.start();
                startcamera.visible=false;
            }
        }
    }
    

    I see the webcam light turned on the first time the start function is called.
    The webcam light turns off when calling the stop function.
    But when calling start again the camera returns the error Camera is in use and the webcam light does not turn on.
    I am using Ubuntu on a laptop with a webcam.

    Any help on how to restart or rehuse the camera in a QML type will be much appreciated.

    M 1 Reply Last reply
    0
    • MesrineM Mesrine

      Hi everyone,

      I am using qt6.7.0.
      Using the camera QML type like

      import QtQuick 2.0
      import QtMultimedia
      
      Item
      {
          id:root
        
          function stop() {
              camera.stop();
              startcamera.visible=true;
              }
      
         
          Camera {
              id: camera
              active: false
              onErrorOccurred: (error,errorString)=> {
                                   console.log(errorString)
                                   console.log(error)
                               }
      
          }
          
          MyButton
          {
              id:startcamera
              anchors.centerIn: root
              text:qsTr("ScanQr")
              onClicked:
              {
                  camera.start();
                  startcamera.visible=false;
              }
          }
      }
      

      I see the webcam light turned on the first time the start function is called.
      The webcam light turns off when calling the stop function.
      But when calling start again the camera returns the error Camera is in use and the webcam light does not turn on.
      I am using Ubuntu on a laptop with a webcam.

      Any help on how to restart or rehuse the camera in a QML type will be much appreciated.

      M Offline
      M Offline
      MartinK1
      wrote on last edited by
      #2

      Hi,

      I am facing the same issue using Pyside6 on Debian. I was hoping the problem would be fixed with QTBUG-114174 in 6.5.3 but the problem is still there. The problem also shows in Qt 6.6.0.
      Restarting is working fine with the same webcam using Qt 5.15 and the old camera interface.

      Best wishes,
      Martin.

      MesrineM 1 Reply Last reply
      0
      • M MartinK1

        Hi,

        I am facing the same issue using Pyside6 on Debian. I was hoping the problem would be fixed with QTBUG-114174 in 6.5.3 but the problem is still there. The problem also shows in Qt 6.6.0.
        Restarting is working fine with the same webcam using Qt 5.15 and the old camera interface.

        Best wishes,
        Martin.

        MesrineM Offline
        MesrineM Offline
        Mesrine
        wrote on last edited by
        #3

        @MartinK1
        This one is newer and should be resolved, I have not tried it.
        https://bugreports.qt.io/browse/QTBUG-117735

        M 1 Reply Last reply
        0
        • MesrineM Mesrine

          @MartinK1
          This one is newer and should be resolved, I have not tried it.
          https://bugreports.qt.io/browse/QTBUG-117735

          M Offline
          M Offline
          MartinK1
          wrote on last edited by
          #4

          @Mesrine Thanks a lot. That looks like a good candidate! I will give it a try as soon as 6.5.4 is out.

          1 Reply Last reply
          0

          • Login

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