[Android] Remove gap between loops on media player
I use MediaPlayer to playing loop background sounds in our apps. The file is .ogg audio format.
MediaPlayer mp1 = MediaPlayer.create(context, R.raw.track1); mp1.setLooping(true); // setting loop mp1.start();
I notice there is a gap when the audio file loops. How to remove the gap when the audio file replays again? Thank you.
1 CÂU TRẢ LỜI
This is a bug in Android OS itself from 2011. issue: https://issuetracker.google.com/issues/36931073
Besides, you can see this: https://stackoverflow.com/questions/26274182/not-able-to-achieve-gapless-audio-looping-so-far-on-android
I have tried but the bug still occur. Thank you
This bug is device specific. Maybe your solution is successful in some devices & also failed in other devices. Can you please see this url: https://stackoverflow.com/questions/21247670/android-mediaplayer-loop-has-gaps-even-with-ogg-format which has one answer.
Thank @licon but i got same result too