Guest User

Untitled

a guest
Mar 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. class PlayerHolder(...) : AnkoLogger {
  2. ...
  3. fun start() {
  4. // Load media.
  5. player.prepare(...)
  6. // Restore state (after onResume()/onStart())
  7. with(playerState) {
  8. // Start playback when media has buffered enough
  9. // (whenReady is true by default).
  10. player.playWhenReady = whenReady
  11. player.seekTo(window, position)
  12. }
  13. info { "SimpleExoPlayer is started" }
  14. }
  15.  
  16. fun stop() {
  17. with(player) {
  18. // Save state
  19. with(state) {
  20. position = currentPosition
  21. window = currentWindowIndex
  22. whenReady = playWhenReady
  23. }
  24. // Stop the player.
  25. stop()
  26. }
  27. info { "SimpleExoPlayer is released" }
  28. }
  29. }
Add Comment
Please, Sign In to add comment