Using the Media APIs

Android supports playing audio and video content under the android.media package. In this chapter, we are going to explore the media APIs from this package.

At the heart of the android.media package is the android.media.MediaPlayer class. The MediaPlayer class is responsible for playing both audio and video content. The content for this class can come from the following sources:

  • Web: You can play content from the Web via a URL.
  • .apk file: You can play content that is packaged as part of your .apk file. You can package the media content as a resource or as an asset (within the assets folder).
  • SD card: You can play content that resides on the device's SD card.

The MediaPlayer is capable of decoding quite a few different content ...

Get Pro Android 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.