0

I am developing an android application using MediaPlayer. I run small midi files (20 - 30 seconds long, it's about 10 - 30 Kb). When the player is playing, at some point I call the seekTo(0) method to start playback from the beginning. And everything works! So what is the problem you ask?

I noticed that if you run the application on older devices (Xiaomi Redmi Pro 3 with API 21, Oppo R 819 with API 17), then the transition occurs smoothly as I need; but on modern devices (Xiaomi Redmi Pro 9 with API 30), the transition occurs with a gap - a pause of about 200 - 300 ms is heard. It sounds awful. Why does MediaPlayer.seekTo(0) work differently on different devices?

Please tell me how I can make the mediaPlayer.seekTo() method run seamlessly on all devices.

TylerH
  • 20,799
  • 66
  • 75
  • 101
bruno13
  • 1
  • 1
  • Because they have different low level sound hardware that may take more or less time to initialize. Some may do MIDI natively, some may do it in software. Have you tried diferent formats of music to see if it makes a difference? Have you tried using just AudioTrack instead, MediaPlayer has a lot of cruft for UIs and videos that you may not need. – Gabe Sechan Sep 02 '21 at 14:15
  • It's the same with other formats. Audiotrack does not support midi playback as I understand it. Thank you. – bruno13 Sep 02 '21 at 17:52

0 Answers0