This section explains how to separate a media player app into a media controller (for the UI) and a media session (for the actual player). It describes two media app architectures: a client/server design that works well for audio apps and a single-activity design for video players. It also shows how to make media apps respond to hardware controls and cooperate with oher apps that use the audio output stream.
- Media Apps Overview
- An introduction to media sessions and media controllers and how they are used in audio and video apps.
- Working with a Media Session
- A media session hides the details of the code that implements a player/recorder and provides a standard interface for communicating with your UI via media controllers.
- Building an Audio App
- How to build an audio app using a media browser client activity containing a media controller and a media browser service containing a media session.
- Building a Video App
- How to build a video app in a single activity with a media session and a media controller.
- Responding to Media Buttons
- How an app handles events from transport buttons on peripheral hardware.
- Handling Changes in Audio Ouput
- How to notice when the volume controls change, the headphones are unplugged, and some other apps wants to play audio.