Media‐3 Playback Components - devrath/MediaAlchemySuite GitHub Wiki

Playback Components

overview

The media player

🎛️ Player and Exoplayer in comparison

Class Description Implementation Note
Player Interface that defines core media controls like play, pause, and seek. In Media3, it's a common API implemented by components like MediaSession and MediaController.
ExoPlayer Default implementation of the Player interface in Media3. Provides full playback capabilities and is highly customizable for advanced use cases.

The media session

Media Session Service

player2

  • It holds the Player and the PlayerSession in a separate service from your player activity.
  • It does this to facilitate background playback.

Media Library Service

  • It is similar to media session service, but instead it will hold the additional API's to serve your content library to media apps.

Media Session

  • Media session enables your app to interact with the player
  • It advertises your media playback commands externally
  • It also receives the commands from external sources

Media Controller

  • It is a class that is used to send commands from outside the app.
  • Example is other app or the system itself.
  • The commands are sent to the underlying player of the associated media session.
  • MediaController class implements the player interface.
  • When we call a method, the command gets sent to the associated media-session.
  • Client apps like Google Assistant use the media-controller to control the playback in the media session.

Media Browser

  • It allows the user to navigate through the media in the app and select which item to play.
  • MediaBrowser implements both Player and the MediaController interfaces.
  • Client app such as Android Auto implements MediaBrowser.

🖥️ Media3 UI Components

Class Description Implementation Note
PlayerView A default Android View to display video along with playback controls. Works with ExoPlayer, MediaController, or any custom Player. Provides a full-featured media UI.
PlayerSurface A Jetpack Compose @Composable used purely for rendering video frames. Connects to any Player. Does not include controls. Supports resizing via ContentScale. Part of Media3 Compose UI utilities.
⚠️ **GitHub.com Fallback** ⚠️