Commit a8152f26 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

[MPris Plugin] Support Seek()

Support Seek() command by issuing an appropriate SetPosition() call.
Fixes changing position through KDE Connect

Differential Revision: https://phabricator.kde.org/D15863
parent 97750093
......@@ -551,13 +551,26 @@ void MPrisPlugin::Play()
void MPrisPlugin::Seek(qlonglong offset)
{
Q_UNUSED(offset);
auto newPosition = position() + offset;
if (newPosition >= m_length) {
Next();
return;
}
if (newPosition < 0) {
newPosition = 0;
}
SetPosition(QDBusObjectPath() /*unused*/, newPosition);
}
void MPrisPlugin::SetPosition(const QDBusObjectPath &path, qlonglong position)
{
Q_UNUSED(path); // TODO use?
if (position < 0 || position >= m_length) {
return;
}
sendData(QStringLiteral("setPosition"), {
{QStringLiteral("position"), position / 1000.0 / 1000.0
} });
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment