Minimizing media playback delay

Especially in games it is important to minimize the media playback delay to get the best possible gameplay experience. To make your MIDlet use the MMAPI as smoothly as possible, consider the following in your MIDlet's design:

  • Avoid using System.gc() to garbage-collect your objects while using players (for example, realizing or playing sound). If garbage collection is performed during playback, it may affect the audio start time.

  • Avoid blocking UI thread, for example, by using blocking methods. An example of this is the createPlayer method of the MMAPI Manager. Section Remote Resources, discusses how streams and threading can be used to prevent blocking.

  • Use synchronized blocks in your code only when really needed, for example, to prevent two threads accessing the same method concurrently. Synchronized block code execution may be somewhat slower than regular code blocks.