service/mpris: reset position timestamps on seek

Moving the onPositionUpdated callback to a bpPosition binding caused
it not to fire when Position was changed to the same value, which can
happen when quickly changing tracks before the player has sent a new
position.

This reverts the above change while still updating position on seek.
This commit is contained in:
outfoxxed 2025-01-05 01:55:33 -08:00
parent fca058e66c
commit 761d99d644
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 10 additions and 5 deletions

View file

@ -237,7 +237,7 @@ void MprisPlayer::setPosition(qreal position) {
this->player->Seek(target - pos);
}
this->bpPosition = target;
this->setPosition(target);
}
void MprisPlayer::onPositionUpdated() {
@ -248,11 +248,16 @@ void MprisPlayer::onPositionUpdated() {
if (firstChange) emit this->positionSupportedChanged();
}
void MprisPlayer::setPosition(qlonglong position) {
this->bpPosition = position;
this->onPositionUpdated();
}
void MprisPlayer::onExportedPositionChanged() {
if (!this->lengthSupported()) emit this->lengthChanged();
}
void MprisPlayer::onSeek(qlonglong time) { this->bpPosition = time; }
void MprisPlayer::onSeek(qlonglong time) { this->setPosition(time); }
qreal MprisPlayer::length() const {
if (this->bInternalLength == -1) {