Update playback info on prepare
This commit is contained in:
parent
0686de36ba
commit
da6b2822cb
2 changed files with 3 additions and 1 deletions
|
@ -7,6 +7,7 @@ import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
|||
import com.simplemobiletools.musicplayer.models.Track
|
||||
import com.simplemobiletools.musicplayer.models.toMediaItems
|
||||
import com.simplemobiletools.musicplayer.playback.CustomCommands
|
||||
import com.simplemobiletools.musicplayer.playback.PlaybackService.Companion.updatePlaybackInfo
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
fun MediaController.sendCommand(command: CustomCommands) = sendCustomCommand(command.sessionCommand, Bundle.EMPTY)
|
||||
|
@ -34,6 +35,7 @@ fun MediaController.prepareUsingTracks(tracks: List<Track>, startIndex: Int = 0,
|
|||
runOnPlayerThread {
|
||||
setMediaItems(mediaItems, startIndex, startPosition)
|
||||
prepare()
|
||||
updatePlaybackInfo(this)
|
||||
callback(true)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import androidx.media3.common.util.UnstableApi
|
|||
import androidx.media3.exoplayer.ExoPlayer
|
||||
|
||||
@UnstableApi
|
||||
class SimpleMusicPlayer(val exoPlayer: ExoPlayer) : ForwardingPlayer(exoPlayer) {
|
||||
class SimpleMusicPlayer(private val exoPlayer: ExoPlayer) : ForwardingPlayer(exoPlayer) {
|
||||
|
||||
/**
|
||||
* The default implementation only advertises the seek to next and previous item in the case
|
||||
|
|
Loading…
Reference in a new issue