confusing error during realize of mediaplayer
I'm geting a strange error when I try and play a simple midi 1.0 file.
The file is definitely valid, and plays in every other midi enabled
application I have.
The error occurs when I try and realize() the player. After about 3
seconds I get
Error: Unable to prefetch
com.sun.media.content.audio.midi.Handler$MidiController@c3c749
my code is
public class form1 extends javax.swing.JFrame {
File fp = new File("C:/TEST.MID");
Player player;
/** Creates new form form1 */
public form1() {
initComponents();
this.setVisible(true);
if (!fp.exists()) return;
try {
player=Manager.createPlayer(fp.toURL());
} catch (MalformedURLException ex) {
ex.printStackTrace();
} catch (NoPlayerException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
player.addControllerListener( new ControllerListener() {
public void controllerUpdate( ControllerEvent ce) {
if ( ce instanceof RealizeCompleteEvent)
{
Component visual = player.getVisualComponent();
Component control =
player.getControlPanelComponent();
if (visual != null)
getContentPane().add(visual);
getContentPane().add(control);
pack();
player.start();
}
}
});
player.realise(); // here's where it says it can't preload
sun...midi etc
}
any help would be appreciated