What is Media Player in Android | Method & Description

What is Media Player in Android | Method & Description Android provides many ways to control the playback of audio/video files and streams. One of this way is through a class called MediaPlayer

What is Media Player in Android | Method & Description

What is MediaPlayer?


What is Media Player in Android


Android provides many ways to control the playback of audio/video files and streams. One of this way is through a class called MediaPlayer. Android is providing MediaPlayer class to access built-in media player services like playing audio, video e.t.c. In order to use MediaPlayer, we have to call a static Method to create() of this class. This method returns an instance of MediaPlayer class.

MediaPlayer media player = MediaPlayer.create(this, R.raw.song); The second parameter is the name of the song that you want to play. You have to make a new folder under your project with the name raw and place the music file into it. Once you have created the Mediaplayer object you can call some methods to start or stop the music.

1. MediaPlayer.start(); 2 . mediaPlayer.pause(); On call to start() method, the music will start playing from the beginning. If this method is called again after the pause() method, the music would start playing from where it is left and not from the beginning. In order to start music from the beginning, you have to call the reset() method.

Method & description Media Player in Android

What is Media Player in Android



  1. isPlaying() This method just returns true/false indicating the song is playing or not.
  2. seekTo(position) This method takes an integer, and move the song to that particular second.
  3. getCurrentDuration() This method returns the current position of the song in milliseconds.
  4. getDuration() This method returns the total time duration of song in milliseconds.
  5. reset() This method resets the media player.
  6. release() This method releases any resource attached with MediaPlayer object.
  7. setVolume(float leftVolume, float right volume) This method sets the up-down volume for this player.
  8. setDataSource(FileDescriptor fd) This method sets the data source of the audio/video file.
  9. select track(int index) This method takes an integer, and select the track from the list on that particular index.
  10. getTrackInfo() This method returns an array of track information.
Read More 



I Hope You Like The Article- What is Media Player in Android | Method & Description Don't Forget To Share With Others. Hit Subscribe Button For Daily Notification to your Phone.

No comments:

Name

Affiliate Marketing,1,Android Apps,9,Android Top Games 2019,1,Antivirus,1,Blogging,2,Cache Memory,2,Computer,16,Computer Assembling,1,Computer Generations,1,Computer Virus,1,CPU,1,Domain,1,Dropshipping Business,1,E Commerce,4,Ebook,1,Evolution of Microsoft windows,6,Facebook Marketing Tutorial,1,Fix Computer Overheating,1,Flipkart Affiliate Program,1,Games,7,Hardware,5,Hindi Computer,6,Hindi Hardware,6,Hindi SEO Tutorial,8,Hindi Software,1,Hindi YouTube,2,Hindi Zone,13,how to bootable pendrive,2,How To Do,2,Internet,7,Keyboard,1,Laptop,1,Latest,99,Make Money Selling used items,1,Memory,3,Monitor,1,Mouse,1,Online Money,27,Operating system,11,Operating system Hindi,1,PC Tricks,2,Sell Photos,1,Smartphone,1,Software,3,Technology,1,Top 10,1,Top Stories,12,Twitter,1,Usertesting,1,Web Browser,3,Website,2,WhatsApp,1,Widget for Blogger,1,
ltr
item
NEtechy: What is Media Player in Android | Method & Description
What is Media Player in Android | Method & Description
What is Media Player in Android | Method & Description Android provides many ways to control the playback of audio/video files and streams. One of this way is through a class called MediaPlayer
https://1.bp.blogspot.com/-QKxjt6z1ces/XLm8tD6XVOI/AAAAAAAAB-A/WRUR7LdEDk8gi1hzeaXxGjTFI_2tHsG0ACLcBGAs/s640/What-is-Media-Player-in-Android.png
https://1.bp.blogspot.com/-QKxjt6z1ces/XLm8tD6XVOI/AAAAAAAAB-A/WRUR7LdEDk8gi1hzeaXxGjTFI_2tHsG0ACLcBGAs/s72-c/What-is-Media-Player-in-Android.png
NEtechy
https://www.netechy.com/2019/04/What-is-Media-player-in-Android.html
https://www.netechy.com/
https://www.netechy.com/
https://www.netechy.com/2019/04/What-is-Media-player-in-Android.html
true
751342609679224409
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy