Results 1 to 3 of 3
  1. #1
    vivekme77 is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default JMF Playing an audio error

    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

    Java Code:
    //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

    Java Code:
    //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

    Java Code:
    //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);
        }
    }
    }
    }
    Code:
    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)
    Last edited by vivekme77; 02-11-2013 at 05:26 AM.

  2. #2
    Zyril is offline Senior Member
    Join Date
    Oct 2011
    Location
    Sweden
    Posts
    124
    Rep Power
    0

    Default Re: JMF Playing an audio error

    Well, it's more or less impossible for me (perhaps anyone) to help you out since you don't provide us with the relevant code. The error is obviously an ArrayIndexOutOfBounds which is self explanatory I assume, and it's on line 15. Since you said the problem is in player.start(); on your line 34, I guess the line numbers aren't the same as in your IDE.

    If you get this error and want help, don't you think it's a good idea to provide the code for the class Player where the actual error is?

  3. #3
    vivekme77 is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default Re: JMF Playing an audio error

    Hi Zyril,

    Now I have added the three files that are all invloved and there files are called in the below order

    1) ExampleJMF.java
    2) exampleFrame.java
    3) examplePanle

    Thanks for your reply

Similar Threads

  1. Playing audio clips
    By robs in forum Threads and Synchronization
    Replies: 24
    Last Post: 06-26-2012, 08:14 PM
  2. Playing a WAV or MP3
    By meesterpickles in forum New To Java
    Replies: 7
    Last Post: 12-19-2011, 03:59 AM
  3. Highlight text on playing audio
    By archanaanbu in forum Java Applets
    Replies: 1
    Last Post: 02-22-2011, 02:34 PM
  4. playing audio in J-App??
    By ashton in forum New To Java
    Replies: 3
    Last Post: 01-30-2009, 09:50 AM
  5. Java Error when playing POGO
    By coffeeswirlz in forum Advanced Java
    Replies: 1
    Last Post: 11-25-2008, 03:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •