avoid fetching the player position while it is being initialized

This commit is contained in:
tibbi 2021-02-28 23:09:28 +01:00
parent b64335fe06
commit 602e21ad5f

View file

@ -895,8 +895,10 @@ class MusicService : Service(), MediaPlayer.OnPreparedListener, MediaPlayer.OnEr
if (isPlaying) {
mProgressHandler.post(object : Runnable {
override fun run() {
val secs = mPlayer!!.currentPosition / 1000
broadcastTrackProgress(secs)
if (mPlayer?.isPlaying == true) {
val secs = mPlayer!!.currentPosition / 1000
broadcastTrackProgress(secs)
}
mProgressHandler.removeCallbacksAndMessages(null)
mProgressHandler.postDelayed(this, PROGRESS_UPDATE_INTERVAL)
}