Skip to content

Instantly share code, notes, and snippets.

@q-litzler
Created May 14, 2017 15:02
Show Gist options
  • Save q-litzler/0b5ed2ddf2b0516e2916724a55766d0d to your computer and use it in GitHub Desktop.
Save q-litzler/0b5ed2ddf2b0516e2916724a55766d0d to your computer and use it in GitHub Desktop.
ExoPlayer Tip 4: Bonus
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.txtPlayerContentProgression.text = timerFormat.format(Date(position))
view.txtPlayerContentDuration.text = timerFormat.format(Date(duration - position))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment