1 Android Media Player A PROJECT REPORT Under the guidance of Mr. Faiz Sir Submitted by: In partial fulfillment of the requirement For the award of the degree Of B.tech Name Reg. No. SUDHANSHU KUMAR 121250110232 NILAM KUMARI PRIYANKA PRIYADARSHANI
1
Android Media Player
A PROJECT REPORT
Under the guidance of
Mr. Faiz Sir
Submitted by:
In partial fulfillment of the requirement
For the award of the degree
Of
B.tech
Name Reg. No.
SUDHANSHU KUMAR 121250110232
NILAM KUMARI
PRIYANKA PRIYADARSHANI
2
Acknowledgement
WWee aarree eexxttrreemmeellyy ggrraatteeffuull ttoo MMrr.. FFaaiizz SSiirr,, FFaaccuullttyy ooff CCeenntteerr ffoorr hhiiss
vvaalluuaabbllee gguuiiddaannccee aallll tthhrroouugghh oouurr pprroojjeecctt wwoorrkk.. HHiiss hheeaarrttiieesstt && kkiinndd CCoo--
ooppeerraattiioonn dduurriinngg mmyy pprroojjeecctt wwoorrkk mmaakkeess tthhee ddrreeaamm rreeaall && wwee ssuucccceeeedd ttoo
ccoommpplleettee oouurr pprroojjeecctt RReeppoorrtt..
AAtt tthhee oouuttsseett wwee wwoouulldd lliikkee ttoo eexxpprreessss mmyy ddeeeeppggrraattiittuuddee ttoo aallll ccoo--oorrddiinnaattoorr
ooff tthhee iinnssttiittuuttee ffoorr tthheeiirr hheellpp aanndd ssuuppppoorrtt..
LLaasstt bbuutt nnoott lleeaasstt,, wwee aarree vveerryy mmuucchh ggrraatteeffuull ttoooouurr ppaarreennttss aanndd ppeerrssoonnaall
ttuuttoorr.. PPrroovviiddiinngg tthhee pprrooppeerr gguuiiddaannccee&& aaddvviiccee ttoo ccoommpplleettee oouurr pprroojjeecctt
wwoorrkk..
Name Unv. Roll
SUDHANSHU KUMAR 121250110232
NILAM KUMARI
PRIYANKA PRIYADARSHANI
3
1) Main Report: 1.1 Introduction
1.2 Objective, Scope
1.3 Interface of Android
1.4 Android Versions
1.5 Symbols of Android OS
2) Media Player
1.1 Introduction 1.2 Objectives 1.3 Functional requirements
1.4 Playlist menu
3) Interface of Media Player
4) Notification & Open Notification
5) Input and Output screen design
6) Hardware Requirements
7) Source Code
8) Bibliography
CONTENTS
4
INTRODUCTION… This project is associated with any Android Media Player. The Project is as per the required curriculums of the B.Tech. Android Introduction… • Android is an operating system based on the Linux kernel, and designed primarily for touch screen mobile devices such as Smartphone’s and tablet computers. • Android allows users to customize their home screens with shortcuts to applications and widgets, which allow users to display live content, such as emails and weather information, directly on the home screen. Purpose… Explains the functional features, design… Scope… This application can run anonymously in any Android based Smart-phones, not less than version 2.3.5 Objectives… • Application will be written using Android SDK in Java and should run on all Android OS handsets. • The application will play audio files with format of MP3, AAC, 3GP, M4A, MIDI, RTX, OGG, and WAV. • The application will play video files with format of 3GP, MP4, WEBM. • Background playing options. • Notification on the home screen. • Android is open source and Google releases the code under the Apache License. • Android has a large community of developers writing applications ("apps") that extend the functionality of devices, written primarily in the Java programming language
Main Report
5
• Android is the world's most widely used smart phone platform,[overtaking Symbian in the fourth quarter of 2010. Android is popular with technology companies who require a ready-made, low-cost, customizable and lightweight operating system for high tech devices. • Despite being primarily designed for phones and tablets, it also has been used in televisions, games consoles, digital cameras and other electronics.
Interface of Android…
• The user interface of Android is based on direct manipulation, using touch inputs that loosely correspond to real-world actions, like swiping, tapping, pinching and reverse pinching to manipulate on-screen objects.
6
• Android home screens are typically made up of app icons and widgets; app icons launch the associated app, whereas widgets display live, auto updating content such as the weather forecast, the user's email inbox, or a news ticker directly on the home screen.
7
Android versions
• Android 1.0 (API level 1)
• Android 1.1 (API level 2)
• Android 1.5 Cupcake (API level 3)
• Android 1.6 Donut (API level 4)
• Android 2.0 Éclair (API level 5)
• Android 2.1 Éclair (API level 7)
• Android 2.2–2.2.3 Froyo (API level 8)
• Android 2.3–2.3.2 Gingerbread (API level 9)
• Android 2.3.3–2.3.7 Gingerbread (API level 10)
• Android 3.0 Honeycomb (API level 11)
• Android 3.1 Honeycomb (API level 12)
• Android 3.2 Honeycomb (API level 13)
• Android 4.0–4.0.2 Ice Cream Sandwich (API level 14)
• Android 4.0.3–4.0.4 Ice Cream Sandwich (API level 15)
• Android 4.1 Jelly Bean (API level 16)
• Android 4.2 Jelly Bean (API level 17)
• Android 4.3 Jelly Bean (API level 18)
Android 4.4 KitKat (API level 19)
Symbols of android OS
8
Media Player
Introduction…
Media Player is android application that can play various audio and video files. To make use of android OS with more public interest and make it more users friendly so all can use it. This project is to design and implement platform independent media player which can play most of the audio files like .mp3, .wav etc. and some video files in addition to view images.
Objectives… • Application will be written using Android SDK in Java and should run on all Android OS handsets. • The application will play audio files with format of MP3, AAC, 3GP, M4A, MIDI, RTX, OGG, and WAV. • The application will play video files with format of 3GP, MP4, WEBM. • Background playing options. • Notification on the home screen. Functional requirements… • Android operating system on the Smartphone. • The target device should be sound enabled. • Ability to play Audio file • Ability to play Video File • Welcome Screen • Main Screen • Player Screen Playlist menu… • Play • Stop • Pause • Songs list • Next • Previous
External interface requirements • User Interface Tested on
Android emulator version 4.3
Any device which have android platform
9
• Hardware Requirement
Core i3 processor
4 GB RAM
500 GB
• Hard Disk Software Requirement
Android SDK Manager
Eclipse
ADT(Android Development Tool)
Source Code Media Player… package com.hp.cjanapp; import java.io.File; import android.app.Activity; import android.graphics.drawable.AnimationDrawable; import android.media.MediaPlayer; import android.os.Bundle; import android.os.Environment; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RelativeLayout; import android.widget.SeekBar; import android.widget.TextView; import android.widget.SeekBar.OnSeekBarChangeListener; public class MusicPlayer extends Activity implements OnClickListener,OnSeekBarChangeListener { Button play, pause; static MediaPlayer player; TextView cd, td; SeekBar mpseek; Thread autoseek;
10
RelativeLayout ms; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_music_player); play = (Button)findViewById(R.id.play); pause = (Button)findViewById(R.id.pause); cd = (TextView)findViewById(R.id.mpcd); td = (TextView)findViewById(R.id.mptd); mpseek = (SeekBar)findViewById(R.id.mpsb1); mpseek.setOnSeekBarChangeListener(this); ms = (RelativeLayout)findViewById(R.id.musicscreen); play.setOnClickListener(this); pause.setOnClickListener(this); if(player==null){ //player = MediaPlayer.create(this,R.raw.mymusic); try{ File sdcard = Environment.getExternalStorageDirectory(); String sp = sdcard.getPath()+"/chandsifarish.mp3"; player = new MediaPlayer(); player.setDataSource(sp); player.prepare(); }catch(Exception e){} } mpseek.setMax(player.getDuration()); td.setText(convert(player.getDuration())); autoseek = new Thread() { public void run() { while(true) { mpseek.setProgress(player.getCurrentPosition()); } } };//END OF THREAD autoseek.start(); }
11
@Override public void onClick(View v) { // TODO Auto-generated method stub ms.setBackgroundResource(R.animator.visual); final AnimationDrawable anim = (AnimationDrawable) ms.getBackground(); if(v.getId()==R.id.play){ player.start(); ms.post(new Runnable() { @Override public void run() { anim.start(); } }); } else{ player.pause(); ms.post(new Runnable() { @Override public void run() { anim.stop(); } }); } } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub if(fromUser==true){ player.seekTo(progress); } cd.setText(convert(progress)); } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub
12
} @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } //CONVERT DURATION TO DISPLAY String convert(long duration){ String ttd=""; duration = duration/1000; ttd = (duration/60)+" : "+(duration%60); return ttd; } }
Interface of Media Player
13
BIBLIOGRAPHY
Notification & Open Notification
HP EDUCATION SERVICES (INDIA) http://www.hpesindia.com
http://developer.android.com
http://www.tutorialspoint.com/android/
thank you