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

MediaPlayer mediaStatus field starts in Buffered (=5)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.4
    • 6.2.0 Beta1
    • Multimedia
    • None
    • Linux/X11

    Description

      Follow-up on the mediaStatus related issues from: https://bugreports.qt.io/browse/QTBUG-95317

      Note: Observations were made using Gstreamer backend.

      Observed behavior:

      • Upon the creation of the MediaPlayer item (as sampled within Component.onComplete), and before the loading/selection of any source media, the value of mediaStatus starts with a default value of 5, which corresponds to BufferedMedia in Q_ENUM(MediaStatus).
      • After setting the source URL to a valid video file, the status changes in the following sequence:
        • BufferedMedia (5)
        • NoMedia (0)
        • LoadingMedia (1)
        • LoadedMedia (2)
      • Upon clicking play, the media status changes to BufferedMedia (5)
      • Upon stopping the video, the status returns to LoadedMedia (2)
      • Upon setting the source url to "", the status returns to NoMedia (0).

      Expected behaviors:

      • MediaPlayer status should start with a NoMedia (0) value.
      • The status should never reflect any state other than NoMedia if the source url is empty
      • The BufferedMedia status should probably be preceeded by the BufferingMedia status? This may not be an issue in that it may happen all in one tick in certain situations so BufferingMedia essentially appears to be skipped.

       

      Methods to reproduce in qtmultimedia/examples/multimedia/video/mediaplayer:

      • Add the following debug statements to the MediaPlayer in main.qml:

       

          MediaPlayer {
              id: mediaPlayer
              videoOutput: videoOutput
      
      
              audioOutput: AudioOutput {
                  id: audio
                  muted: playbackControl.muted
                  volume: playbackControl.volume
              }
      
              onErrorOccurred: { mediaErrorText.text = mediaPlayer.errorString; mediaError.open() }
              onMetaDataChanged: { metadataInfo.read(mediaPlayer.metaData) }
      
              // Debugging
              onSourceChanged: {
                  console.log( "Source changed: " + source )
              }
      
              onMediaStatusChanged: {
                  console.log( "Media Status: " + mediaStatus + " Playback State: " + playbackState )
              }
      
              Component.onCompleted: {
                  console.log( "Setting source to empty" )
                  source = ""
              }
          }
      
      • In PlayerMenuBar.qml, comment out the stop() and play() calls in FileDialog.onAccepted() to prevent automatic state changes and allow us to see things at a more fine-grain level:
          FileDialog {
              id: fileDialog
              title: "Please choose a file"
              onAccepted: {
                  // mediaPlayer.stop()
                  mediaPlayer.source = fileDialog.currentFile
                  // mediaPlayer.play()
              }
          }
      • In PlaybackControl.qml, add a "source reset button" beside the AudioControl item:
      RoundButton {
                          id: resetButton
                          radius: 50.0
                          text: "Src=''";
                          onClicked: {
                              console.log( "resetting source" )
                              mediaPlayer.source = ""
                          }
                          anchors.right: audio.left
                          anchors.top: audio.top
                      }

      Then to produce the results:

      1. Launch the program. The following should be printed:
      QML debugging is enabled. Only use this in a safe environment.
      qml: Setting source to empty
      qml: Media Status: 5 Playback State: 0

      2. Load a video.

      qml: Media Status: 0 Playback State: 0
      qml: Media Status: 1 Playback State: 0
      qml: Source changed: file:///home/spiderkeys/cave/cave_3.mp4
      qml: Media Status: 2 Playback State: 0

      3. Click play.

      qml: Media Status: 5 Playback State: 0

      4. Click pause.

      5. Click the "source reset" button to set the mediaPlayer.source=""

      qml: resetting source
      qml: Media Status: 2 Playback State: 0
      qml: Media Status: 0 Playback State: 0
      qml: Source changed: 

      Attachments

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

        Activity

          People

            piotr Piotr Srebrny (Inactive)
            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