~ahayzen/music-app/remix-remove-empty-year-label

« back to all changes in this revision

Viewing changes to MusicNowPlaying.qml

* Ignore first value back after seeking [Workaround]. Fixes: https://bugs.launchpad.net/bugs/1310706.

Approved by Victor Thompson, Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
201
201
                    anchors.left: parent.left
202
202
                    anchors.right: parent.right
203
203
                    objectName: "progressSliderShape"
204
 
                    function formatValue(v) { return durationToString(v) }
 
204
 
 
205
                    function formatValue(v) {
 
206
                        if (seeking) {  // update position label while dragging
 
207
                            musicToolbarFullPositionLabel.text = durationToString(v)
 
208
                        }
 
209
 
 
210
                        return durationToString(v)
 
211
                    }
205
212
 
206
213
                    property bool seeking: false
 
214
                    property bool seeked: false
207
215
 
208
216
                    onSeekingChanged: {
209
217
                        if (seeking === false) {
218
226
                    onPressedChanged: {
219
227
                        seeking = pressed
220
228
                        if (!pressed) {
221
 
                           player.seek(value)
 
229
                            seeked = true
 
230
                            player.seek(value)
222
231
                       }
223
232
                    }
224
233
 
229
238
                            progressSliderMusic.maximumValue = player.duration
230
239
                        }
231
240
                        onPositionChanged: {
232
 
                            if (progressSliderMusic.seeking === false) {
 
241
                            // seeked is a workaround for bug 1310706 as the first position after a seek is sometimes invalid (0)
 
242
                            if (progressSliderMusic.seeking === false && !progressSliderMusic.seeked) {
233
243
                                progressSliderMusic.value = player.position
234
244
                                musicToolbarFullPositionLabel.text = durationToString(player.position)
235
245
                                musicToolbarFullDurationLabel.text = durationToString(player.duration)
236
246
                            }
 
247
 
 
248
                            progressSliderMusic.seeked = false;
237
249
                        }
238
250
                        onStopped: {
239
251
                            musicToolbarFullPositionLabel.text = durationToString(0);