Chapter 11. Multimedia

In this chapter, we will cover the following topics:

  • Playing sound effects with SoundPool
  • Playing audio with MediaPlayer
  • Responding to hardware media controls in your app
  • Taking a photo with the default camera app
  • Taking a photo using the (old) Camera API
  • Taking a photo using the Camera2 (the new) API

Introduction

Now that we've explored graphics and animations in the previous chapters, it's time to look at the sound options available in Android. The two most popular options to play sound include:

  • SoundPool: This is for short sound clips
  • MediaPlayer: This is designed for larger sound files (like music) and video files

The first two recipes will look at using these libraries. We'll also look at how to use hardware related to sound, ...

Get Android Application Development Cookbook - Second Edition 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.