diff --git a/src/core/media_player.cc b/src/core/media_player.cc index d6d1d43e..bb02faa6 100644 --- a/src/core/media_player.cc +++ b/src/core/media_player.cc @@ -170,7 +170,7 @@ MediaPlayer::MediaPlayer(int volume) d->pos_timer = new NUGUTimer(); d->pos_timer->setInterval(POSITION_POLLING_TIMEOUT_500MS); d->pos_timer->setCallback([&]() { - if (!isPlaying()) + if (!isActive()) return; updatePosition(); @@ -495,4 +495,9 @@ NuguPlayer* MediaPlayer::getNuguPlayer() return d->player; } +bool MediaPlayer::isActive() +{ + return isPlaying() || d->state == MediaPlayerState::PAUSED; +} + } // NuguCore diff --git a/src/core/media_player.hh b/src/core/media_player.hh index 6a39c94e..b9882e89 100644 --- a/src/core/media_player.hh +++ b/src/core/media_player.hh @@ -75,6 +75,7 @@ public: private: void setPositionWithSeek(int position); + bool isActive(); MediaPlayerPrivate* d; };