Fix resume playback on startup for CUE

This commit is contained in:
Jonas Kvinge
2020-04-25 15:57:02 +02:00
parent f14c3654dc
commit c008ab6141
2 changed files with 11 additions and 1 deletions

View File

@@ -1234,8 +1234,9 @@ void MainWindow::ResumePlayback() {
if (playback_state == Engine::Paused) {
NewClosure(app_->player(), SIGNAL(Playing()), app_->player(), SLOT(PlayPause()));
}
// Seek after we got song length.
NewClosure(track_position_timer_, SIGNAL(timeout()), this, SLOT(ResumePlaybackSeek(int)), playback_position);
app_->player()->Play();
app_->player()->SeekTo(playback_position);
}
// Reset saved playback status so we don't resume again from the same position.
@@ -1247,6 +1248,14 @@ void MainWindow::ResumePlayback() {
}
void MainWindow::ResumePlaybackSeek(const int playback_position) {
if (app_->player()->engine()->length_nanosec() > 0) {
app_->player()->SeekTo(playback_position);
}
}
void MainWindow::PlayIndex(const QModelIndex &index) {
if (!index.isValid()) return;