12
Viktor Stojanovski Android Developer @ Seavus 12.12.2012 Android Media Framework

Android Media Framework - Code App, Level Up - [Dec. 2012]

Embed Size (px)

DESCRIPTION

Presentation about "Android Media Framework" Event: Code App, Level Up Organizer: EESTEC, FCSE Date: 12.12.2012, Skopje, Macedonia

Citation preview

Page 1: Android Media Framework - Code App, Level Up - [Dec. 2012]

Viktor StojanovskiAndroid Developer @ Seavus

12.12.2012

Android Media Framework

Page 2: Android Media Framework - Code App, Level Up - [Dec. 2012]

Agenda

Media API

Introducing the Media Player

Playing Audio Files

Playing Video Files

Capturing Photos

Record Videos

Demo code

Q&A Session

Page 3: Android Media Framework - Code App, Level Up - [Dec. 2012]

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

Page 4: Android Media Framework - Code App, Level Up - [Dec. 2012]

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.

Page 5: Android Media Framework - Code App, Level Up - [Dec. 2012]

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.

Page 6: Android Media Framework - Code App, Level Up - [Dec. 2012]

Playing Audio Files

Page 7: Android Media Framework - Code App, Level Up - [Dec. 2012]

Playing Video Files

When a Video is initialized you can control the playback:

- start

- stopPlayback

- pause

- seekTo

- setKeepScreenOn

Page 8: Android Media Framework - Code App, Level Up - [Dec. 2012]

Playing Video Files

Page 9: Android Media Framework - Code App, Level Up - [Dec. 2012]

Capturing Photos Camera Permission

Invoke Intent for taking photo

Do the actual capturing

Catch the captured photo in your application

Page 10: Android Media Framework - Code App, Level Up - [Dec. 2012]

Record Videos Camera Permission

Invoke Intent for recording video

Do the actual recording

Catch the recorded video in your application

Page 11: Android Media Framework - Code App, Level Up - [Dec. 2012]

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

Page 12: Android Media Framework - Code App, Level Up - [Dec. 2012]

Read more …

Chapter 15 Chapter 24