mirror of https://github.com/KDE/kasts.git
Fix directly jumping to chapter on a non-playing track
This commit is contained in:
parent
deaf7ebbb5
commit
7dcf3c52e2
|
@ -457,10 +457,12 @@ void AudioManager::seek(qint64 position)
|
|||
// if there is still a pending seek, then we simply update that pending
|
||||
// value, and then manually send the positionChanged signal to have the UI
|
||||
// updated
|
||||
if (d->m_pendingSeek != -1 && d->m_readyToPlay) {
|
||||
// NOTE: this can also happen while the streaming URL is still resolving, so
|
||||
// we also allow seeking even when the track is not yet readyToPlay.
|
||||
if (d->m_pendingSeek != -1 || !d->m_readyToPlay) {
|
||||
d->m_pendingSeek = position;
|
||||
Q_EMIT positionChanged(position);
|
||||
} else {
|
||||
} else if (d->m_pendingSeek == -1 && d->m_readyToPlay) {
|
||||
d->m_player.setPosition(position);
|
||||
}
|
||||
}
|
||||
|
@ -637,10 +639,14 @@ void AudioManager::prepareAudio(const QUrl &loadUrl)
|
|||
|
||||
qint64 startingPosition = d->m_entry->enclosure()->playPosition();
|
||||
qCDebug(kastsAudio) << "Changing position to" << startingPosition / 1000 << "sec";
|
||||
if (startingPosition <= newDuration) {
|
||||
d->m_pendingSeek = startingPosition;
|
||||
} else {
|
||||
d->m_pendingSeek = -1;
|
||||
// if a seek is still pending then we don't set the position here
|
||||
// this can happen e.g. if a chapter marker was clicked on a non-playing entry
|
||||
if (d->m_pendingSeek == -1) {
|
||||
if (startingPosition <= newDuration) {
|
||||
d->m_pendingSeek = startingPosition;
|
||||
} else {
|
||||
d->m_pendingSeek = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Emit positionChanged and durationChanged signals to make sure that
|
||||
|
|
|
@ -181,7 +181,7 @@ FocusScope {
|
|||
|
||||
Controls.Slider {
|
||||
id: durationSlider
|
||||
enabled: AudioManager.entry
|
||||
enabled: AudioManager.entry && AudioManager.PlaybackState != AudioManager.StoppedState && AudioManager.canPlay
|
||||
Layout.fillWidth: true
|
||||
padding: 0
|
||||
from: 0
|
||||
|
|
Loading…
Reference in New Issue