Chapter 9

Using Multimedia — Audio, Video, and the Camera

What's in This Chapter?

  • Playing audio and video
  • SurfaceView and video playback
  • Recording audio and video
  • Recording video and taking pictures
  • Reading and modifying image exif data
  • Adding media to the media store
  • Using voice recognition

Multimedia generally encompasses all the fun, non-text content: pictures, sound, video, and the like. This chapter shows you how to deal with this content in Mono for Android. Android takes its open philosophy into the realm of multimedia and has no bias for media providers. This ensures a broad range of support for image, audio, and video formats, which can be accessed locally or streamed to the device.

This chapter focuses on playing and recording audio and video using the available APIs. This chapter also covers voice input for your applications.

To effectively run the sample code in this chapter, you will need to use an actual Android device, as the emulator does not support the camera and those examples that use the camera will fail.

Android Media Classes

The following table provides a list of the Android media classes that are wrapped by Mono for Android to perform the magic in this chapter. Also, you will use the MediaPlayer and MediaRecorder along with the ExifInterface in examples in this chapter.

Table 9.1: Android Media Classes

Class Description
AsyncPlayer Plays an audio URI, but loading and preparing the audio is done on a background thread to prevent the foreground thread ...

Get Professional Android Programming with Mono for Android and .NET/C# 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.