Fix resume playback on startup for CUE
This commit is contained in:
@@ -1234,8 +1234,9 @@ void MainWindow::ResumePlayback() {
|
|||||||
if (playback_state == Engine::Paused) {
|
if (playback_state == Engine::Paused) {
|
||||||
NewClosure(app_->player(), SIGNAL(Playing()), app_->player(), SLOT(PlayPause()));
|
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()->Play();
|
||||||
app_->player()->SeekTo(playback_position);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset saved playback status so we don't resume again from the same 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) {
|
void MainWindow::PlayIndex(const QModelIndex &index) {
|
||||||
|
|
||||||
if (!index.isValid()) return;
|
if (!index.isValid()) return;
|
||||||
|
|||||||
@@ -236,6 +236,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
void SavePlaybackStatus();
|
void SavePlaybackStatus();
|
||||||
void LoadPlaybackStatus();
|
void LoadPlaybackStatus();
|
||||||
void ResumePlayback();
|
void ResumePlayback();
|
||||||
|
void ResumePlaybackSeek(const int playback_position);
|
||||||
|
|
||||||
void Raise();
|
void Raise();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user