// FIXME: Workaround for pad.lv/1494031 by querying gst as it does not
// emit until it changes to the PLAYING state. But by asking for a
// value we get gst to perform a query and return a result
// However this has to be done once the source is set, hence the delay
//
// NOTE: This does not solve when the currentIndex is removed though
Timer {
id: refreshProgressTimer
interval: 48
repeat: false
onTriggered: {
if (!progressSliderMusic.seeking) {
musicToolbarFullPositionLabel.text = durationToString(player.mediaPlayer.position);
musicToolbarFullDurationLabel.text = durationToString(player.mediaPlayer.duration || 1);
progressSliderMusic.value = player.mediaPlayer.position
// fallback to 1 when 0 so that the progress bar works
progressSliderMusic.maximumValue = player.mediaPlayer.duration || 1
}
}
}
Connections {
target: player.mediaPlayer.playlist
// Call timer when source or index changes
// so we call even if there are duplicate sources or source removal
onCurrentItemSourceChanged: refreshProgressTimer.start()
onCurrentIndexChanged: refreshProgressTimer.start()
}