![]() ![]() (3) Use TimerTask for update seekbar progress : Where the duration is the media player duration time. Set seekbar maximum progress to the MediaPlayer Duration. (2) Set the seekbar Max progress to the MediaPlayer Duration: SeekBar seekbar = findViewById(R.id.seekbar) This used for to check the media player is complete and the user will perform some task on the complete media player. This method will release any resource attached to MediaPlayer. This method returns the total time duration of the song in milliseconds This method will return the current position of the song in milliseconds. This method takes an integer value and used to move the song to that particular position. This method returns just true/false value. This method is used to check the song is playing or not. This method is used to reset the media player and start music from the beginning. If this method is called after pause() method, the music would start from where it is pause not from the beginning. This method is used for playing music from the beginning. ![]() Once you have created the object of MediaPlayer you can call some predefined methods for start and stop the music. You have to create a new folder under the project with the name raw and placed the music into it. In this, the second parameter is the name of the song which you want to play. MediaPlayer mediaplayer = MediaPLayer.create(this,R.raw.song1) In Order To use MediaPlayer We have to call a static method to create() of this class. Android is providing a MediaPlayer class to access built-in media player services like playing audio, video e.t.c. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |