Download presentation
Presentation is loading. Please wait.
1
John Meilak Reuben Sant Jason Farrugia Media API Web Science APT 2007/2008
2
Media API Introduction Users demand rich multimedia capabilities Mobile hardware developed significantly Mobile devices are not simply used for voice calls and text messaging
3
Media API Media Capabilities Play, stream and record media resources Audio Video Face Detection Used to adjust camera settings on face
4
Media API android.media Package Classes MediaPlayer MediaRecorder FaceDetector AudioSystem Interfaces MediaPlayer.OnBufferingUpdateListener MediaPlayer.OnCompletionListener MediaPlayer.OnErrorListener MediaPlayer.OnPreparedListener
5
Media API MediaPlayer Example Local Resource MediaPlayer mp = MediaPlayer.create (context, R.raw.sound_1); Stream mp.setDataSource(path); Video mp.setDisplay(mPreview.getHolder().getSurface()); An android.View.Surface is needed to display the video in it. mPreview is of type android.view.SurfaceView which is defined in the xml layout file. Playback mp.prepare(); mp.start();
6
Media API MediaRecorder Example MediaRecorder rec = new MediaRecorder(); rec.setVideoSource( MediaRecorder.VideoSource.CAMERA ); rec.setAudioSource( MediaRecorder.AudioSource.MIC ); rec.setOutputFormat( MediaRecorder.OutputFormat.THREE_GPP ); rec.setVideoSize( 400, 300 ); rec.setVideoFrameRate( 24 ); rec.setVideoEncoder( MediaRecorder.VideoEncoder.H263 ); rec.setAudioEncoder( MediaRecorder.AudioEncoder.AMR_NB ); rec.setOutputFile( path ); rec.prepare(); rec.start();
7
Media API Supported Media Codecs Audio –MP3 compression scheme used to transfer audio files via internet and store in portable media players –AAC advanced audio coding, similar to mp3, used by iTunes –Ogg Vorbis a free and open source audio codec –MIDI used to describe a piece of music in enough detail to be able to reproduce it accurately –iMelody ringtone format –XMF extensible music format, used to keep file sizes as small as possible. used for polyphonic ringtones –RTTL/RTX ringtones format
8
Media API Supported Media Codecs Video –MPEG-4 compression algorithm for graphics, audio and video –H.264 simple standard providing good video quality at lower bit rates –3GP simplified version of mpeg used to accommodate limited bandwidth of mobile phones
9
Media API References http://code.google.com/android http://www.helloandroid.com http://davanum.wordpress.com/2007/12/29/android -videomusic-player-sample-from-local-disk-as- well-as-remote-urls/
10
Media API
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.