View SeekBarProgressionListener.kt
class SeekBarProgressionListener : Player.ProgressionListener {
override val interval: Long = 1000 / 60L
override fun progression(position: Long, duration: Long) {
val progress = (position * view.skbPlayerContent.max / duration).toInt()
val progressBuffer = (player.exoPlayer.bufferedPosition * view.skbPlayerContent.max / duration).toInt()
view.skbPlayerContent.progress = progress
view.skbPlayerContent.secondaryProgress = progressBuffer
View Player.kt
class Player {
interface ProgressionListener {
val interval: Long
fun progression(position: Long, duration: Long)
}
private inner class RunnableProgression(val progressionListener: ProgressionListener) : Runnable {
View Player.kt
class Player {
val player: ExoPlayer = ExoPlayerFactory.newInstance(...)
var wasPlaying = player.playWhenReady
fun start() {
wasPlaying = player.playWhenReady
player.playWhenReady = true
}
View ConcatenatingMediaSourceWindowIndex.kt
var currentIndex: Int = 0
var player : ExoPlayer
var handler = Handler()
fun onNewWindowIndex(index: Int) {
currentIndex = index
// Do something with your playlist using this reliable index
}
class PlayerEventListener: ExoPlayer.Listener {