Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: JMF Playing an audio error

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

    //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)


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: JMF Playing an audio error

    You've hidden the error message. I can't find it.

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JMF Playing an audio error

    Thank you I added the you suggestion in my post

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: JMF Playing an audio error

    I have no idea where that error happens in your code. There is no reference to your code in the print out.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Feb 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JMF Playing an audio error

    Hi Norm,

    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. alternative to JMF
    By olimpicco in forum Java Theory & Questions
    Replies: 0
    Last Post: December 19th, 2011, 09:50 PM
  2. JMF
    By mp3rara in forum AWT / Java Swing
    Replies: 0
    Last Post: April 13th, 2011, 11:36 AM
  3. JMF
    By johngog in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 9th, 2011, 02:24 PM
  4. Java error while Playing Video file.
    By ravigirismiles in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 7th, 2010, 11:09 AM
  5. Replies: 2
    Last Post: January 8th, 2010, 08:22 AM