Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PlayerHolder(...) : AnkoLogger {
- ...
- fun start() {
- // Load media.
- player.prepare(...)
- // Restore state (after onResume()/onStart())
- with(playerState) {
- // Start playback when media has buffered enough
- // (whenReady is true by default).
- player.playWhenReady = whenReady
- player.seekTo(window, position)
- }
- info { "SimpleExoPlayer is started" }
- }
- fun stop() {
- with(player) {
- // Save state
- with(state) {
- position = currentPosition
- window = currentWindowIndex
- whenReady = playWhenReady
- }
- // Stop the player.
- stop()
- }
- info { "SimpleExoPlayer is released" }
- }
- }
Add Comment
Please, Sign In to add comment