RSATom / QmlVlc

[ABANDONED] libvlc wrapper for Qt Quick 2/Qml
Other
139 stars 56 forks source link

Change the player position #25

Closed AndreaD82 closed 9 years ago

AndreaD82 commented 9 years ago

Hi RSATom, i would like to add one feature at QmlVlcDemo, when I press the mouse button on the progress bar, the video needs to move forward in the chosen point.

I've added a MouseArea with [onClicked: vlcPlayer.position = mouseX]

this is what i've done, but it doesn't work,

        Rectangle {
            Layout.fillWidth: true
            height: 10
            color: 'transparent'
            border.width: 1
            border.color: 'white'
            anchors.verticalCenter: parent.verticalCenter
            Rectangle {
                width: (parent.width - anchors.leftMargin - anchors.rightMargin) * vlcPlayer.position
                color: 'white'
                anchors.margins: 2
                anchors.top: parent.top
                anchors.left: parent.left
                anchors.bottom: parent.bottom

                MouseArea {
                    anchors.fill: parent
                    onClicked: vlcPlayer.position = mouseX
                }
            }                                
        }

Greetings

RSATom commented 9 years ago

What video source do you use?

position should be in interval 0.0...1.0

RSATom commented 9 years ago

something like

MouseArea {
    anchors.fill: parent
    onClicked: vlcPlayer.position = ( mouse.x / width );
}
AndreaD82 commented 9 years ago

Thanks! it works!