Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved QMultimeida CameraRecorder not recording. (Erro: Failed to get the video control)

    General and Desktop
    1
    1
    1150
    Loading More Posts
    • 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.
    • F
      Fortune last edited by SGaist

      Hi guys. I'm a beginner with qml and am already getting frustrated and discouraged. I'm having problems with getting my webcam to work with qml! Am not sure what am doing wrong but here is my code.

      import QtQuick 2.0
      import QtQuick.Controls 1.3
      import QtMultimedia 5.0
      
      Item {
          id:root
          Button{
              id:recordButton
              x: 0
              y: parent.height-height
              width: parent.width/2
              height: 80
              text:"Record"
              onClicked:{
                  
                  camera.videoRecorder.record();
                  console.log(camera.videoRecorder.recorderStatus==CameraRecorder.UnavailableStatus)
                  
              }
          }
          Button{
              id:stopButton
              x: parent.width/2
              y: parent.height-height
              width: parent.width/2
              height: 80
              text:"Stop"
              onClicked: {
                  camera.videoRecorder.stop();
                  console.log()
                  console.log()
                  
                  console.log("output location: " +camera.videoRecorder.outputLocation)
                  console.log("actual location: " +camera.videoRecorder.actualLocation)
              }
          }
          
          VideoOutput{
              id:preview
              width: parent.width
              height: parent.height-stopButton.height
              source:camera
              anchors.top:parent.top;
              anchors.right: parent.right
              anchors.left: parent.left
              anchors.bottom: stopButton.top
              Camera{
                  id:camera
                  videoRecorder.audioEncodingMode: CameraRecorder.ConstantBitRateEncoding
                  videoRecorder.audioBitRate: 128000
                  videoRecorder.mediaContainer: "mp4"
                  videoRecorder {
                      resolution: "640x480"
                      frameRate: 30
                  }
              }
          }
          
      }
      

      here is my application output windows

      When I click on "Record" I get this

      "QML debugging is enabled. Only use this in a safe environment.
      Failed to get the video control"

      and when I click on stop, I get this

      "qml:
      qml:
      qml: output location:
      qml: actual location: "

      Note that my webcam works fine. I use it many times to record videos of myself and I also use it for skype so it definitely not a hardware problem. Please help me

      [edit: Added missing coding tags ``` SGaist]

      1 Reply Last reply Reply Quote 0
      • First post
        Last post