SUMMARY STEPS TO REPRODUCE 1. Move your mouse pointer over the seekbar in the media applet. 2. Scroll OBSERVED RESULT Nothing happens. EXPECTED RESULT Seek.
As of version 5.26.1, it seems that the slider does react to scrolling, but the position is almost immediately reset back to the current media position rather than changing the media position to the slider's position. This sometimes causes a slight stuttering effect in the audio. The behavior is defined in plasma-workspace/applets/mediacontroller/package/contents/ui/ExpandedRepresentation.qml. There are a few key parts to be aware of when fixing this bug. The `seekSlider` has its value set to the position of the MPRIS2 source whenever the MPRIS2 source position changes, unless the slider is currently being pressed. `disablePositionUpdate` is a bool property defined in expandedRepresentation. It is used to keep the slider from doing things when the MPRIS2 source info changes. ``` onPositionChanged: { // we don't want to interrupt the user dragging the slider if (!seekSlider.pressed && !keyPressed) { // we also don't want passive position updates disablePositionUpdate = true // Slider refuses to set value beyond its end, make sure "to" is up-to-date first seekSlider.to = length; seekSlider.value = position disablePositionUpdate = false } } ``` `seekTimer` can also change the value periodically and block slider input as long as the slider is not pressed. ``` PlasmaComponents3.Slider { // Slider id: seekSlider // [snip] value: 0 // [snip] onMoved: { if (!disablePositionUpdate) { // delay setting the position to avoid race conditions queuedPositionUpdate.restart() } } // [snip] Timer { id: seekTimer interval: 1000 / expandedRepresentation.rate repeat: true running: root.isPlaying && root.expanded && !keyPressed && interval > 0 && seekSlider.to >= 1000000 onTriggered: { // some players don't continuously update the seek slider position via mpris // add one second; value in microseconds if (!seekSlider.pressed) { disablePositionUpdate = true if (seekSlider.value == seekSlider.to) { retrievePosition(); } else { seekSlider.value += 1000000 } disablePositionUpdate = false } } } } ``` `queuedPositionUpdate` sets the value of the `seekSlider` as the MPRIS2 service's position 100ms after the timer is started. ``` Timer { id: queuedPositionUpdate interval: 100 onTriggered: { if (position == seekSlider.value) { return; } var service = mpris2Source.serviceForSource(mpris2Source.current) var operation = service.operationDescription("SetPosition") operation.microseconds = seekSlider.value service.startOperationCall(operation) } } ``` In order to fix this without changing a lot, we may need to accumulate wheel delta and then use it to set the slider's value or reset the accumulated delta after a short delay.
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5091
Git commit 8f6ee9e12bb1f2c79724b6838a365248f242a7cb by Kai Uwe Broulik. Committed on 20/01/2025 at 17:22. Pushed by broulik into branch 'master'. Set stepSize on seek slider to make wheel work MPRIS operates in microseconds, so the default step size of 1 makes no discernible difference in seeking the played track. Set it to 5 seconds so that wheel works as expected. It also has the nice side-effect of making the built-in left/right key handling work. Unfortunately, it might cause tick marks to appear for short tracks. M +1 -8 applets/mediacontroller/package/contents/ui/ExpandedRepresentation.qml https://invent.kde.org/plasma/plasma-workspace/-/commit/8f6ee9e12bb1f2c79724b6838a365248f242a7cb