Commit 8315d92e authored by Matthieu Gallien's avatar Matthieu Gallien 🎵

emit Seeked on MPRIS2 interface when player really seeked

BUG: 428957
parent 904dc9fb
......@@ -58,6 +58,8 @@ MediaPlayer2Player::MediaPlayer2Player(MediaPlayListProxyModel *playListControle
this, &MediaPlayer2Player::playerIsSeekableChanged);
connect(m_manageAudioPlayer, &ManageAudioPlayer::playerPositionChanged,
this, &MediaPlayer2Player::audioPositionChanged);
connect(m_manageAudioPlayer, &ManageAudioPlayer::seek,
this, &MediaPlayer2Player::playerSeeked);
connect(m_manageAudioPlayer, &ManageAudioPlayer::audioDurationChanged,
this, &MediaPlayer2Player::audioDurationChanged);
connect(m_audioPlayer, &AudioWrapper::volumeChanged,
......@@ -214,8 +216,6 @@ void MediaPlayer2Player::setPropertyPosition(int newPositionInMs)
const auto incrementalProgress = static_cast<double>(newPositionInMs - mPreviousProgressPosition) / m_audioPlayer->duration();
if (mShowProgressOnTaskBar && (incrementalProgress > 0.01 || incrementalProgress < 0))
{
Q_EMIT Seeked(m_position);
mPreviousProgressPosition = newPositionInMs;
QVariantMap parameters;
parameters.insert(QStringLiteral("progress-visible"), true);
......@@ -358,6 +358,11 @@ void MediaPlayer2Player::audioPositionChanged()
setPropertyPosition(static_cast<int>(m_manageAudioPlayer->playerPosition()));
}
void MediaPlayer2Player::playerSeeked(qint64 position)
{
Q_EMIT Seeked(position * 1000);
}
void MediaPlayer2Player::audioDurationChanged()
{
m_metadata = getMetadataOfCurrentTrack();
......
......@@ -120,6 +120,8 @@ private Q_SLOTS:
void audioPositionChanged();
void playerSeeked(qint64 position);
void audioDurationChanged();
void playerVolumeChanged();
......
......@@ -236,7 +236,7 @@ Kirigami.ApplicationWindow {
playerControl.repeat: ElisaApplication.mediaPlayListProxyModel.repeatPlay
playerControl.shuffle: ElisaApplication.mediaPlayListProxyModel.shufflePlayList
playerControl.onSeek: ElisaApplication.audioPlayer.seek(position)
playerControl.onSeek: ElisaApplication.audioControl.playerSeek(position)
playerControl.onPlay: ElisaApplication.audioControl.playPause()
playerControl.onPause: ElisaApplication.audioControl.playPause()
......
Markdown is supported
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