diff --git a/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisPlugin.java b/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisPlugin.java index 2f2e6773..0d1a1505 100644 --- a/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisPlugin.java @@ -44,6 +44,7 @@ public class MprisPlugin extends Plugin { private String albumArtUrl = ""; private String url = ""; private String loopStatus = ""; + private double rate = 1.0; private boolean loopStatusAllowed = false; private boolean shuffle = false; private boolean shuffleAllowed = false; @@ -89,6 +90,10 @@ public class MprisPlugin extends Plugin { return loopStatus; } + public double getRate() { + return rate; + } + public boolean getShuffle() { return shuffle; } @@ -157,7 +162,7 @@ public class MprisPlugin extends Plugin { public long getPosition() { if (playing) { - return lastPosition + (System.currentTimeMillis() - lastPositionTime); + return (int) Math.round(lastPosition + (System.currentTimeMillis() - lastPositionTime) * rate); } else { return lastPosition; } @@ -201,6 +206,10 @@ public class MprisPlugin extends Plugin { MprisPlugin.this.sendCommand(getPlayer(), "setLoopStatus", loopStatus); } + public void setRate(double rate) { + MprisPlugin.this.sendCommand(getPlayer(), "setRate", rate); + } + public void setShuffle(boolean shuffle) { MprisPlugin.this.sendCommand(getPlayer(), "setShuffle", shuffle); } @@ -326,6 +335,7 @@ public class MprisPlugin extends Plugin { playerStatus.loopStatus = np.getString("loopStatus", playerStatus.loopStatus); playerStatus.loopStatusAllowed = true; } + playerStatus.rate = np.getDouble("rate", playerStatus.rate); if (np.has("shuffle")) { playerStatus.shuffle = np.getBoolean("shuffle", playerStatus.shuffle); playerStatus.shuffleAllowed = true;