Multi Media
Multi Media
Chiappinelli
Multimedia Support Classes
Playing Audio
Watching Video
Recording Audio
Using the Camera
Android provides support for encoding
and decoding a variety of common
media formats
Allows you to play & record audio,
still images & video
AudioManager & SoundPool
RingtoneManager & Ringtone
MediaPlayer
MediaRecorder
Camera
Manages volume, system sound
effects, and ringer mode control
Acquire AudioManager instance via
Context.!
getSystemService(Context.AUDIO_SERVICE)
Load & play sound effects
Manage volume
Manage peripherals
Represents a collection of audio
samples (streams)
Can mix and play multiple
simultaneously
Presents two buttons that adjust the
volume up or down
Presents a play button that, when
pressed, plays a bubble popping sound
at the current volume level
RingtoneManager provides access to
audio clips used for incoming phone
calls, notifications, alarms, etc.
Allows applications to get and set
ringtones and to play and stop
playing them
Application presents three buttons
labeled ringtone, notification and
alarm
Pressing one of these buttons causes
the associated default ringtone to
play
Controls playback of audio and video
streams and files
Allows applications to control playback
Operates according to a complex state
machine
See:
http://developer.android.com/!
reference/android/media/!
MediaPlayer.html
setDataSource()
prepare()
start()
pause()
seekTo()
stop()
release()
SurfaceView for displaying video files
Can load video from multiple sources
Provides various display options &
convenience functions
Application plays a movie in a VideoView
Used to record audio and video
Operates in accordance to a state
machine
See:
http://developer.android.com/
reference/android/media/
MediaRecorder.html
setAudioSource()
setVideoSource()
setOutputFormat()
prepare()
start()
stop()
release()
Can record audio from the user
Can play back recorded audio
Client for the Camera service, which
manages the actual camera
hardware
Manages image capture settings
Start/stops preview
Takes pictures
<uses-permission
android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera" />
<uses-feature android:name=!
"android.hardware.camera.autofocus" />
Get Camera instance
Set Camera parameters as
necessary
Setup preview display
Start the preview
Take a picture & process image data
Release the Camera when not in use
Takes still photos using the device’s
display as the camera’s viewfinder
Sensors