mirror of
https://github.com/KDE/kasts.git
synced 2025-02-02 10:26:52 +01:00
More elegant solution for setting MPRIS2 audio duration when changing tracks
This commit is contained in:
parent
a624040ef3
commit
49baa7915b
@ -219,7 +219,6 @@ void AudioManager::setEntry(Entry* entry)
|
||||
if (startingPosition > 1000) d->m_player.setPosition(startingPosition);
|
||||
d->m_player.pause();
|
||||
d->m_readyToPlay = true;
|
||||
Q_EMIT entryChanged(d->m_entry); // TODO: this is a hack to get MPRIS to show correct duration; should be split off into a separate signal
|
||||
Q_EMIT canPlayChanged();
|
||||
Q_EMIT canPauseChanged();
|
||||
Q_EMIT canSkipForwardChanged();
|
||||
|
@ -280,6 +280,18 @@ void MediaPlayer2Player::audioPositionChanged()
|
||||
|
||||
void MediaPlayer2Player::audioDurationChanged()
|
||||
{
|
||||
qDebug() << "Signal change of audio duration through MPRIS2";
|
||||
// We reset all metadata in case the audioDuration changed
|
||||
// This is done because duration is not yet available when setEntry is
|
||||
// called (this is before the QMediaPlayer has read the new track
|
||||
if (m_audioPlayer) {
|
||||
if (m_audioPlayer->entry()) {
|
||||
m_metadata = getMetadataOfCurrentTrack();
|
||||
signalPropertiesChange(QStringLiteral("Metadata"), Metadata());
|
||||
}
|
||||
}
|
||||
|
||||
// for progress indicator on taskbar
|
||||
if (m_audioPlayer) {
|
||||
setPropertyPosition(static_cast<int>(m_audioPlayer->position()));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user