Last active
January 29, 2023 12:04
-
-
Save ademirqueiroga/78f1a0ec7516ac6cbeb3a3d364dcf7ea to your computer and use it in GitHub Desktop.
Update BaseTransportControlGlue content information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val currentMovie: Movie | |
get() = playerAdapter.playlist[playerAdapter.playlistPosition] | |
// Event when ready state for play changes. | |
override fun onPreparedStateChanged() { | |
super.onPreparedStateChanged() | |
playWhenPrepared() | |
updateMovieInfo(currentMovie) | |
} | |
private fun updateMovieInfo(movie: Movie?) { | |
title = movie?.title | |
subtitle = movie?.description | |
} | |
fun loadMovie(playlistPosition: Int) { | |
playerAdapter.loadMovie(playlistPosition) | |
} | |
fun setPlaylist(movies: List<Movie>) { | |
playerAdapter.playlist.clear() | |
playerAdapter.playlist.addAll(movies) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment