title: JMF: Cannot set media time on an unrealized controller
body: <p>I'm trying to use JMF to play a sound every time I hit a button. </p>
  
  <p>This is what I have to contruct the media player:</p>
  
  <pre><code>MediaPlayer mp = new javax.media.bean.playerbean.MediaPlayer();
  mp.setMediaLocation("file:///D:/fall.wav");
  mp.setPlaybackLoop(false);
  </code></pre>
  
  <p>And, to play the sound once, I do </p>
  
  <pre><code>mp.start();
  mp.setMediaTime(new Time(0));
  mp.stop();
  </code></pre>
  
  <p>The first time I play the sound, i get a </p>
  
  <pre><code>javax.media.NotRealizedError: Cannot set media time on a unrealized controller 
  </code></pre>
  
  <p>and an </p>
  
  <pre><code>Exception in thread AWT-EventQueue-0" javax.media.NotRealizedError: 
    Cannot set media time on a unrealized controller 
  </code></pre>
  
  <p>on the setMediaTime line. This doesn't happen any subsequent time I hit the button that makes the sound, it only happens the first time. If i change the constructor and add </p>
  
  <pre><code>mp.realize();
  </code></pre>
  
  <p>at the end, then it doesn't throw those errors, but it also doesn't play the sound the first time.</p>
  
  <p>How do I go about fixing this?</p>