O'Reilly logo

Pro Android 4 by Satya Komatineni, Dave MacLean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required