Skip to content

Most visited

Recently visited


Media Apps

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.
This site uses cookies to store your preferences for site-specific language and display options.


This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.