<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>416128</bug_id>
          
          <creation_ts>2020-01-11 18:11:15 +0000</creation_ts>
          <short_desc>Seekbar on applet doesn&apos;t respond to scrolling</short_desc>
          <delta_ts>2025-01-24 05:38:14 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>plasmashell</product>
          <component>Media Player widget</component>
          <version>5.17.5</version>
          <rep_platform>Arch Linux</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.0</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="D. Debnath">d_debnath</reporter>
          <assigned_to name="Kai Uwe Broulik">kde</assigned_to>
          <cc>bugseforuns</cc>
    
    <cc>nate</cc>
    
    <cc>noahadvs</cc>
    
    <cc>plasma-bugs-null</cc>
    
    <cc>postix</cc>
          
          <cf_commitlink>https://invent.kde.org/plasma/plasma-workspace/-/commit/8f6ee9e12bb1f2c79724b6838a365248f242a7cb</cf_commitlink>
          <cf_versionfixedin>6.4.0</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1901758</commentid>
    <comment_count>0</comment_count>
    <who name="D. Debnath">d_debnath</who>
    <bug_when>2020-01-11 18:11:15 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2244155</commentid>
    <comment_count>1</comment_count>
    <who name="Noah Davis">noahadvs</who>
    <bug_when>2023-08-02 20:59:55 +0000</bug_when>
    <thetext>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&apos;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&apos;t want to interrupt the user dragging the slider
    if (!seekSlider.pressed &amp;&amp; !keyPressed) {
        // we also don&apos;t want passive position updates
        disablePositionUpdate = true
        // Slider refuses to set value beyond its end, make sure &quot;to&quot; 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 &amp;&amp; root.expanded &amp;&amp; !keyPressed &amp;&amp; interval &gt; 0 &amp;&amp; seekSlider.to &gt;= 1000000
        onTriggered: {
            // some players don&apos;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&apos;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(&quot;SetPosition&quot;)
        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&apos;s value or reset the accumulated delta after a short delay.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2390916</commentid>
    <comment_count>2</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2025-01-19 08:50:39 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5091</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2391151</commentid>
    <comment_count>3</comment_count>
    <who name="Kai Uwe Broulik">kde</who>
    <bug_when>2025-01-20 18:12:41 +0000</bug_when>
    <thetext>Git commit 8f6ee9e12bb1f2c79724b6838a365248f242a7cb by Kai Uwe Broulik.
Committed on 20/01/2025 at 17:22.
Pushed by broulik into branch &apos;master&apos;.

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</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>