Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-104041

QAudioRecorder outputLocation set only after recording stop

XMLWordPrintable

    • Android
    • 1dca8d87a1 (qt/tqtc-qtmultimedia/5.15) 1dca8d87a1 (qt/tqtc-qtmultimedia/5.15-vxworks)
    • 2022wk24FOQtforAndroid

      When using QAudioRecorder, the actualLocation(https://doc.qt.io/qt-5/qmediarecorder.html#actualLocation-prop) property is set as soon as recording starts on Windows, iOS and MacOS, but on android this is set only after  recording is finished.

       

      This can be reproduced with Audio Recorder example(https://doc.qt.io/qt-5/qtmultimedia-multimedia-audiorecorder-example.html). When  recording  starts on a platform other than android,  actualLocation.(Refer attached screenshot) can be seen. However, with Android, this path remains empty.

      Following tiny patch seems to work:

        
       diff --git a/qandroidcapturesessioncopy.cpp b/qandroidcapturesession.cpp
      index 276bc49..2423c42 100644
      --- a/qandroidcapturesessioncopy.cpp
      +++ b/qandroidcapturesession.cpp
      @@ -261,7 +261,8 @@ void QAndroidCaptureSession::start()
       
           m_usedOutputLocation = QUrl::fromLocalFile(filePath);
           m_mediaRecorder->setOutputFile(filePath);
      -
      +    m_actualOutputLocation = m_usedOutputLocation;
      +    emit actualLocationChanged(m_actualOutputLocation);
           // Even though the Android doc explicitly says that calling MediaRecorder.setPreviewDisplay()
           // is not necessary when the Camera already has a Surface, it doesn't actually work on some
           // devices. For example on the Samsung Galaxy Tab 2, the camera server dies after prepare()
      irfans-MacBook-Pro-2:mediacapture irfanomair$ 

       

            samuelmira Samuel Mira
            irfan.omair@digia.com Irfan Omair
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: