1

I have a video player make in qml. Slider value is binded to Mediaplayer's position as I need to show slider moving along with the video.

Also I need to move the video position to the slider position if slider is moved manually.

I wrote the below code, but i get warning and video is playing each small portion repeatedly when slide bar is moved.

warning is: qt-reserved-files/qml/QtQuick/Controls/Slider.qml:199:5: QML RangeModel: Binding loop detected for property ""

MediaPlayer {
    id: idVideo
}

Slider {
    id: idSlider
    anchors.bottom: idrow.top
    anchors.right: parent.right
    anchors.rightMargin: 85
    width: 400
    value: idVideo.position // for slider to move along with movie
    minimumValue: 0
    maximumValue: idVideo.duration

    // for movie to move as slider is moved to manually.
    onValueChanged: { 
        idVideo.seek(idSlider.value)
    }
}

If I do not set onValueChanged movie will not seek as slider bar is moved. Is there a solution to this?

Cœur
  • 37,241
  • 25
  • 195
  • 267
A.J
  • 725
  • 10
  • 33
  • You should fix the warning ;-). – sk2212 Dec 11 '15 at 09:47
  • @sk2212: I know that I should fix, but do not have any clue how to... – A.J Dec 11 '15 at 09:51
  • You bind the slider value to the video position. When the slider value changes, you seek, which changes the video position => that changes the slider value… and so on. That’s your loop, it will show all kinds of weird behavior. You must react on the user using the slider, not on the value changing. – Frank Osterfeld Dec 11 '15 at 12:00
  • @FrankOsterfeld: I do not find any other property to get a change in slider :( – A.J Dec 11 '15 at 12:14
  • And also same i did for audio player and for my wonder it works fine. :| – A.J Dec 11 '15 at 12:17

1 Answers1

0

The issue is on android platform and I solved by below code:

onPressedChanged: {
    idVideo.seek(idSlider.value)
}
A.J
  • 725
  • 10
  • 33