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

Sample code in docs for QML video element is broken

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.0.1
    • 5.0.0
    • Multimedia
    • None
    • Ubuntu 12.04 (32-bit)
    • 304fdbeeb14c8f9e75cda99d2e4122b4dee1d952

    Description

      The documentation for the QML video element (http://qt-project.org/doc/qt-5.0/qtmultimedia/qml-qtmultimedia5-video.html) contains the following sample code:

      import QtQuick 2.0
      import QtMultimedia 5.0

      Video {
      id: video
      width : 800
      height : 600
      source: "video.avi"

      MouseArea {
      anchors.fill: parent
      onClicked:

      { video.play() }

      }

      focus: true
      Keys.onSpacePressed: video.paused = !video.paused
      Keys.onLeftPressed: video.position -= 5000
      Keys.onRightPressed: video.position += 5000
      }

      Using this code, when you press the space bar, left arrow, and right arrow keys, the video does not seek or pause. Instead, the following errors are logged:

      file:///home/kehres/Code/qmlvideo/bug_report.qml:18: Error: Cannot assign to read-only property "paused"
      file:///home/kehres/Code/qmlvideo/bug_report.qml:19: Error: Cannot assign to read-only property "position"
      file:///home/kehres/Code/qmlvideo/bug_report.qml:20: Error: Cannot assign to read-only property "position"

      The exact steps to reproduce are:

      1) Copy the above sample code into a qml file.
      2) Modify the "source" property to reference a valid video file.
      3) Use qmlscene to execute the qml file.
      4) Click the window to start video playback.
      5) Attempt to use the space bar and arrow keys to pause/seek.

      Attachments

        Activity

          People

            ylopes Yoann Lopes
            jkehres Jeff Kehres
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: