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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.11
    • 5.9.1, 5.10.0 Alpha
    • Multimedia
    • 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

          For Gerrit Dashboard: QTBUG-63517
          # Subject Branch Project Status CR V

          Activity

            People

              valentyn.doroshchuk Valentyn Doroshchuk
              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