![]() The code for the MainActivity. ![]() We’ve added a FloatingActionButon that’ll play/stop when clicked. The code for the activity_main.xml is given below: Runnable Thread - To update the Seekbar.Īdd the following dependency in your adle: implementation ':design:28.0.0-alpha3'.SeekBar With Text - To show the current progress time besides the thumb.In order to create an Application that plays Audio and lets you change the position of the current song track we need to implement three things: tDataSource(descriptor.getFileDescriptor(), descriptor.getStartOffset(), descriptor.getLength()) Fetching the sound assets file from the Assets folder AssetFileDescriptor descriptor = getAssets().openFd("filename") We’ll be playing an mp3 file stored in the assets folder of our Android Studio Project. setVolume(float leftVolume, float rightVolume) - This is used to set the volume level.setDataSource(FileDescriptor fd) - This is used to set the file to be played.This function returns the duration in milli seconds ![]() Using this we’ll know the upper limit of our SeekBar.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |