Details
-
Bug
-
Resolution: Done
-
P2: Important
-
6.2.0 Beta1
-
None
-
-
2d6789e108a845963dd33b89ca3a9b1bb97b7891 (qt/qtmultimedia/dev)
Description
Steps taken:
- Create MediaPlayer element in QML app
- Set MediaPlayer.source to a valid video resource
- Video buffers and can be played successfully, hasVideoChanged() is called with true
- Set MediaPlayer.source to empty string ""
- MediaPlayer.hasVideo still has a true value and hasVideoChanged() is not called
Expected behavior:
Upon setting the source to an invalid/null value, the media player element should clean up the previously buffered video resource and reset to a clean state, such that you can update other UI elements to indicate that there is no playable media loaded.
The above said, I did find that MediaPlayer.status does reset to 0 (NoMedia) after setting the source to "", so that can be successfully used to detect this event. However, there is an issue with this approach, as the MediaPlayer's default starting status even with source explicitly initialized to "" is 5 (Buffered), which seems to be erroneous. Because of this, you can't reliably determine whether or not there is media loaded or loading within the mediaplayer other than to check using the combination of:
var mediaAvailable: ( mediaPlayer.mediaStatus == 0 ) || ( mediaPlayer.source == "" )
It feels like the various properties of the media player should more consistently represent this state in all of their values. Furthermore, it seems like any buffered media should be dropped from a resource efficiency perspective if the status ever becomes NoMedia. This is currently not the case, as I was still able to play back a video that had been previously buffered after setting source="" and receiving an update that status=0.
These issues may only happen on the GStreamer backend, since it is ultimately responsible for choosing which of these states it is in and how media is loaded/unloaded. I don't have the means to test other backends.
Attachments
For Gerrit Dashboard: QTBUG-95317 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
362106,3 | Fix QMediaPlayer::hasAudio/Video() and related signals | dev | qt/qtmultimedia | Status: MERGED | +2 | 0 |