android media framework - code app, level up - [dec. 2012]
Post on 20-Jun-2015
665 Views
Preview:
DESCRIPTION
TRANSCRIPT
Viktor StojanovskiAndroid Developer @ Seavus
12.12.2012
Android Media Framework
Agenda
Media API
Introducing the Media Player
Playing Audio Files
Playing Video Files
Capturing Photos
Record Videos
Demo code
Q&A Session
Media API
All classes can be found in android.media package
MediaPlayer class is responsible for playing both Audio and Video content.
MediaPlayter filetypes:Audio Video Picture
AAC LC/LTPHE-AACv1 (AAC+)AMR-NBAMR-WBMP3MIDIOgg VorbisPCM/WAVE
H.263H.264 AVCMPEG-4 SP
JPEGPNGGIFBMP
Introducing the Media Player
1. Initialize the Media Player with media to play.
2. Prepare the Media Player for playback.
3. Start the playback.
4. Pause or stop the playback prior to its completing.
5. The playback is complete.
Details: http://developer.android.com/reference/android/media/MediaPlayer.html#StateDiagram.
Choose Stream to Use Identify Which Audio Stream to Use
Android has separate audio streams for: Music, Alarms, Notifications, Call Ringer, System Sounds, In-Call volume)
If you are not replacing Alarm Clock application, you will always use STREAM_MUSIC
Use Hardware Volume Keys to Control Your App’s Audio Volume
By default, pressing the volume controls modify the volume of the active audio stream. If your app isn't currently playing anything, hitting the volume keys adjusts the ringer volume.
Playing Audio Files
Playing Video Files
When a Video is initialized you can control the playback:
- start
- stopPlayback
- pause
- seekTo
- setKeepScreenOn
Playing Video Files
Capturing Photos Camera Permission
Invoke Intent for taking photo
Do the actual capturing
Catch the captured photo in your application
Record Videos Camera Permission
Invoke Intent for recording video
Do the actual recording
Catch the recorded video in your application
Detecting Faces Available from API Level 14 (Android 4.0)
Face detection is not necessarily available on every device, even those running Android 4.0 or above.
confidence ();
Returns a confidence factor between 0 and 1. This indicates how certain what has been found is actually a face. A confidence factor above 0.3 is usually good enough.
More: http://developer.android.com/reference/android/media/FaceDetector.Face.html
Read more …
Chapter 15 Chapter 24
top related