catchup with cspot "official" - release

This commit is contained in:
philippe44
2023-10-08 17:15:14 -07:00
parent 61f58f9a52
commit 8280bc4903
5 changed files with 56 additions and 49 deletions

View File

@@ -31,8 +31,10 @@ SpircHandler::SpircHandler(std::shared_ptr<cspot::Context> ctx) {
}
};
auto trackLoadedCallback = [this](std::shared_ptr<QueuedTrack> track, bool paused = false) {
playbackState->setPlaybackState(paused ? PlaybackState::State::Paused : PlaybackState::State::Playing);
auto trackLoadedCallback = [this](std::shared_ptr<QueuedTrack> track,
bool paused = false) {
playbackState->setPlaybackState(paused ? PlaybackState::State::Paused
: PlaybackState::State::Playing);
playbackState->updatePositionMs(track->requestedPosition);
this->notify();
@@ -78,9 +80,9 @@ void SpircHandler::subscribeToMercury() {
void SpircHandler::loadTrackFromURI(const std::string& uri) {}
void SpircHandler::notifyAudioEnded() {
playbackState->updatePositionMs(0);
notify();
trackPlayer->resetState(true);
playbackState->updatePositionMs(0);
notify();
trackPlayer->resetState(true);
}
void SpircHandler::notifyAudioReachedPlayback() {
@@ -234,7 +236,7 @@ void SpircHandler::notify() {
this->sendCmd(MessageType_kMessageTypeNotify);
}
bool SpircHandler::skipSong(TrackQueue::SkipDirection dir) {
bool SpircHandler::skipSong(TrackQueue::SkipDirection dir) {
bool skipped = trackQueue->skipTrack(dir);
// Reset track state