Hi,
I am getting below error while player.start() code
Actually there are three file involved in it and they are
1) ExampleJMF.java
2) exampleFrame.java
3) examplePanle
ExampleJMF.java
//package org.jmf.example; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.metal.MetalLookAndFeel; public class ExampleJMF { public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); try { UIManager.setLookAndFeel(new MetalLookAndFeel()); } catch(UnsupportedLookAndFeelException e) { e.printStackTrace(); } exampleFrame exampleFrame = new exampleFrame(); } }
exampleFrame.java
//package org.jmf.example; import java.awt.Toolkit; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; public class exampleFrame extends JFrame { private static final long serialVersionUID = 1L; public exampleFrame() { super("JMF - Example..."); setSize(400, 300); setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - getWidth())/2, (Toolkit.getDefaultToolkit().getScreenSize().height - getHeight())/2); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { System.exit(0); } }); setContentPane(new examplePanel()); setVisible(true); } }
examplePanel.java
//package org.jmf.example; import java.awt.Component; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import javax.media.ControllerEvent; import javax.media.ControllerListener; import javax.media.Manager; import javax.media.NoPlayerException; import javax.media.Player; import javax.media.RealizeCompleteEvent; import javax.swing.JPanel; public class examplePanel extends JPanel implements ActionListener, ControllerListener { private static final long serialVersionUID = 1L; private Component visualComponent; private Player player; public examplePanel() { try { player = Manager.createPlayer(new URL("file:///E:/movies/Engeyum-Eppodhum/Govinda.mp3")); //player = Manager.createPlayer(new URL("/Govinda.mp3")); player.addControllerListener(this); player.start(); } catch(NoPlayerException e) { e.printStackTrace(); } catch(MalformedURLException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } } public void paintComponent(Graphics g) { super.paintComponent(g); } public void actionPerformed(ActionEvent e) { } public void controllerUpdate(ControllerEvent c) { if(player == null) { return; } if(c instanceof RealizeCompleteEvent) { if((visualComponent = player.getVisualComponent()) != null) { add(visualComponent); } } } }
java.lang.ArrayIndexOutOfBoundsException: 15 at codecLib.mpa.k.a(Unknown Source) at codecLib.mpa.k.do(Unknown Source) at codecLib.mpa.Decoder.decode(Unknown Source) at com.sun.media.codec.audio.mpa.JavaDecoder.process(JavaDecoder.java:327) at com.sun.media.BasicFilterModule.process(BasicFilterModule.java:322) at com.sun.media.BasicModule.connectorPushed(BasicModule.java:69) at com.sun.media.BasicOutputConnector.writeReport(BasicOutputConnector.java:120) at com.sun.media.SourceThread.process(BasicSourceModule.java:729) at com.sun.media.util.LoopThread.run(LoopThread.java:135) BUILD SUCCESSFUL (total time: 10 seconds)