Difference between stopping the player vs releasing the player - devrath/MediaAlchemySuite GitHub Wiki

What happens when we call stop from the mediaController()

  • It will stop the playback immediately.
  • It will move the player to STATE_IDLE.
  • It frees the current loaded media/buffers/decoders.
  • But it will keep the player instance active.
  • It also keeps the playlist active.
  • If an error occurred, it will not clear it either.
  • You can prepare() and play() again on the same player instance.
  • With the MediaSessionService, A stopped player may still show a notification unless the playlist is removed or player is released.

What happens when we call release from the mediaController()

  • This is the final step, and it is like the final teardown.
  • It will free the player and all its resources and make it unusable.
  • You should make a new player/controller next time you want to play.

When to use which

  • Pause UI but keep everything "warm" -> pause()
  • Free decoders/buffers now but keep the player+playlist to resume later -> stop() then prepare()/play()
  • We just want to leave the service and not start again -> release()