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

QMediaPlayer: Wrong mediaStatus after play->pause->stop

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4: Low
    • Resolution: Done
    • Affects Version/s: 5.9.1, 5.10.0 Alpha
    • Fix Version/s: 5.11
    • Component/s: Multimedia
    • Labels:
      None

      Description

      Based on http://doc.qt.io/qt-5/qmediaplayer.html

      QMediaPlayer::LoadedMedia	-	The current media has been loaded. The player is in the StoppedState.
      QMediaPlayer::BufferedMedia-	The player has fully buffered the current media. The player is in the PlayingState or PausedState.
      

      If play->stop, mediaStatus would be LoadedMedia
      If play->pause->Stop it will be BufferedMedia
      Due to no event stateChanged emitted.

      #include <QMediaPlayer>
      #include <QDebug>
      #include <QCoreApplication>
      #include <QFileInfo>
      #include <QTest>
      int main(int argc, char *argv[])
      {
          QCoreApplication app(argc, argv);
      
      	QMediaPlayer player;
      	QMediaContent localWavFile;
          
          const QString testFileName = "test.wav";
          QFileInfo wavFile(testFileName);
      	localWavFile = QMediaContent(QUrl::fromLocalFile(wavFile.absoluteFilePath()));
      	player.setMedia(localWavFile);
      	player.play();
      
      	QTest::qWait(1000);
      	qDebug() << player.mediaStatus();
      	player.pause();
      
      	QTest::qWait(1000);
      	qDebug() << player.mediaStatus();
      	player.stop();
      	QTest::qWait(1000);
      	qDebug()<<player.mediaStatus();
      	
          return app.exec();
      }
      

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              valentyn.doroshchuk Valentyn Doroshchuk
              Reporter:
              valentyn.doroshchuk Valentyn Doroshchuk
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes