Tweak code

This commit is contained in:
vfsfitvnm 2022-07-18 15:22:47 +02:00
parent f5716937d1
commit f4edfaefd2
2 changed files with 3 additions and 11 deletions

View file

@ -225,7 +225,10 @@ class PlayerService : InvincibleService(), Player.Listener, PlaybackStatsListene
override fun onMediaItemTransition(mediaItem: MediaItem?, reason: Int) {
maybeNormalizeVolume()
maybeProcessRadio()
}
private fun maybeProcessRadio() {
radio?.let { radio ->
if (player.mediaItemCount - player.currentMediaItemIndex <= 3) {
coroutineScope.launch(Dispatchers.Main) {

View file

@ -1,11 +0,0 @@
package it.vfsfitvnm.vimusic.utils
import android.os.Bundle
fun Bundle.getFloatOrNull(key: String): Float? =
if (containsKey(key)) getFloat(key) else null
fun Bundle.getLongOrNull(key: String): Long? =
if (containsKey(key)) getLong(key) else null