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

Inconsistencies and unexpected behaviors in MediaPlayer component

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 6.2.0 Beta1
    • Fix Version/s: 6.2.0 Beta3, 6.3.0 Alpha
    • Component/s: Multimedia
    • Labels:
      None
    • Platform/s:
      Linux/X11
    • Commits:
      2d6789e108a845963dd33b89ca3a9b1bb97b7891 (qt/qtmultimedia/dev)

      Description

      Steps taken:

      1. Create MediaPlayer element in QML app
      2. Set MediaPlayer.source to a valid video resource
      3. Video buffers and can be played successfully, hasVideoChanged() is called with true
      4. Set MediaPlayer.source to empty string ""
      5. 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

          Activity

            People

            Assignee:
            laknoll Lars Knoll
            Reporter:
            spiderkeys Charles Cross
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes