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

QML MediaPlayer documentation incorrectly uses VideoOutput

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 6.2.0
    • 6.2.0 RC
    • Multimedia
    • None
    • All
    • 627c0df99cd2bd5e0c66bf8b904bb9dc82f1ea98 (qt/qtmultimedia/dev) e92c867e805202defce668f170fb47526dc31305 (qt/qtmultimedia/6.2) 702dbfc7c293066a0ac4b6de9208faa7f7b81939 (qt/qtmultimedia/6.2.0)

    Description

      The MediaPlayer QML type documentation provides one code example using VideoOutput as a UI component to render the video that is played.

      However, the VideoOutput QML component doesn't have the source property anymore, making that example incorrect.

      Incorrect example:

      Item {
          MediaPlayer {
              id: mediaplayer
              source: "groovy_video.mp4"
          }
      
          VideoOutput {
              anchors.fill: parent
              source: mediaplayer
          }
      
          MouseArea {
              id: playArea
              anchors.fill: parent
              onPressed: mediaplayer.play();
          }
      }
      

      Here is a suggestion of revised version:

      import QtQuick
      import QtMultimedia
      
      Window {
          width: 1024
          height: 768
          visible: true
      
          MediaPlayer {
              id: player
              source: "file:groovy_video.mp4"
              audioOutput: AudioOutput {}
              videoOutput: videoOutput
          }
      
          VideoOutput {
              id: videoOutput
              anchors.fill: parent
          }
      
          MouseArea {
              id: playArea
              anchors.fill: parent
              onPressed: player.play();
          }
      }
      

      Attachments

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

        Activity

          People

            laknoll Lars Knoll
            c.lorquet Cyril Lorquet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes