Merge pull request #6475 from rohtie/bugfix-position-not-resumed

Fix resuming playback position on startup
This commit is contained in:
John Maguire 2019-12-15 11:21:00 +00:00 committed by GitHub
commit 9eeb6d3758
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -1342,7 +1342,19 @@ void MainWindow::ResumePlayback() {
app_->player()->Play();
connect(track_position_timer_, SIGNAL(timeout()),
SLOT(ResumePlaybackPosition()));
}
void MainWindow::ResumePlaybackPosition() {
// We must wait until the song has a length because
// seeking a song without length does not work
if (app_->player()->engine()->length_nanosec() > 0) {
disconnect(track_position_timer_, SIGNAL(timeout()), this,
SLOT(ResumePlaybackPosition()));
app_->player()->SeekTo(saved_playback_position_);
}
}
void MainWindow::PlayIndex(const QModelIndex& index) {

View File

@ -271,6 +271,7 @@ signals:
void SavePlaybackStatus(QSettings* settings);
void LoadPlaybackStatus();
void ResumePlayback();
void ResumePlaybackPosition();
void AddSongInfoGenerator(smart_playlists::GeneratorPtr gen);