Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
5.1.1
-
None
-
Windows 7
Description
In the docs for QMediaPlayer::setMedia() it says:
Setting this property to a null QMediaContent will cause the player to discard all information relating to the current media source and to cease all I/O operations related to that media.
But doing so on Windows does not release the file handle on the last played audio file. On the contrary! I connected a slot to the mediaStatusChanged signal. I use this slot to start playback after status is QMediaPlayer::LoadedMedia.
void AudioPlayer::playerStatus(QMediaPlayer::MediaStatus status) { //Do not start playing before media is loaded. if (status == QMediaPlayer::MediaStatus::LoadedMedia) { this->mediaPlayer->play(); } if (status == QMediaPlayer::MediaStatus::EndOfMedia) { this->mediaPlayer->setMedia(QMediaContent()); } }
Using it like this is resulting in an "infinite loop" as the last loaded media (which should no longer be available to QMediaPlayer Object as I passed a null QMediaContent()) is played back over and over again.