Say your app simply plays the video/audio when your app is in the foreground, this is a good system.
All the components like player, media-session, UI are contained within the activity.
Here the media session facilitates the PIP Mode if involved by communicating from the player to the controls.
Problems with the previous API
Till now the media session could not communicate directly with the player.
Instead there has to be a connector that translates the commands and callbacks between the session and the player.
The session calls a command say play-command which is a call-to-interface method, This implementation is done in the connector which later passes the command to the player. Similarly, the player updates the state to media-session.
This will lead to bugs because many of the bugs come with connector integration between sessions and the player.
What changed in Media-3
We use the ExoPlayer instead of Player
Now by avoiding the need for a connector, the integration bugs were not possibly there.
So the UI will take the player and the Session will also take the player. The ExoPlayer will implement the player interface.
Background playback
What is the objective
This involves enabling the player to play even if the activity is not in the foreground.
Problems with the previous API
Here also observe we have two connectors
Between Player and MediaSession
Between UI and MediaController
so communication between the components is more complicated since a lot of code is involved and might lead to bugs
What changed in Media-3
In this way we are passing the player in the media session and media controller
This player is implemented in the ExoPlayer and the UI