title: JavaFX MediaPlayer playing background music loop with small intro music
body: <p>I am trying to create a game using JavaFX. I had been trying to insert some background musics to the game. The musics are of compatible .mp3 files. I am currently using <code>MediaPlayer</code> to playback each <code>Media</code>. Each media file consist of the actual loop and a small (optional) intro music to the loop. How can I achieve smooth audio playback using JavaFX.</p>
  
  <p>Methods I have tried: </p>
  
  <ul>
  <li><p>Using the <code>Media</code> as one file; I try to alter the <code>mediaPlayer.startTime</code>, <code>mediaPlayer.stopTime</code>. It seems that the duration of the music is shortened when I enter the loop. However, the music restarts at the intro and ends at the wrong place. It was as if <code>startTime</code> didn't offset the music at all.</p></li>
  <li><p>Using the <code>Media</code> as two separate files (intro and loop); I try to immediately playback the loop music as soon as the intro music is finished (using <code>mediaPlayer.setOnEndOfMedia()</code>). However, the transition was too slow and noticable. </p></li>
  </ul>