9 Replies - 1981 Views - Last Post: 09 February 2013 - 09:15 PM Rate Topic: -----

#1 BlazingHeart  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 17-January 13

Unable to handle format: MPEG

Posted 09 February 2013 - 07:08 PM

HI there, i have tried to play this video but it keep giving me this error. Please help me out on this.

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:///C:/Users/Jun/Desktop/HTP_E_card.mpg"));
			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);
		}
	}
}


It keep giving me this error.

// Unable to handle format: MPEG, 320x179, FrameRate=29.9, Length=85920
// Unable to handle format: mpegaudio, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 16000.0 frame rate, FrameSize=32768 bits



the jar files i have are

customizer.jar
jmf.jar
mediaplayer.jar
mutliplayer.jar
sound.jar


Is This A Good Question/Topic? 0
  • +

Replies To: Unable to handle format: MPEG

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8332
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Unable to handle format: MPEG

Posted 09 February 2013 - 07:12 PM

Post stack trace and the appropriate code
Was This Post Helpful? 0
  • +
  • -

#3 BlazingHeart  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 17-January 13

Re: Unable to handle format: MPEG

Posted 09 February 2013 - 07:16 PM

what do you mean by stack trace?

The whole code is here.

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();
		}
		
		new exampleFrame();
	}
}


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 - *.");
		
		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);
	}
}


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:///C:/Users/Jun/Desktop/HTP_E_card.mpg"));
			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);
		}
	}
}

Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8332
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Unable to handle format: MPEG

Posted 09 February 2013 - 07:34 PM

Your error are displayed with line numbers from the .java file
the class name and method name
and the methods that called them

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
at Assign7.showArray(Assign7.java:16)
at Assign7.main(Assign7.java:9)
Was This Post Helpful? 0
  • +
  • -

#5 BlazingHeart  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 17-January 13

Re: Unable to handle format: MPEG

Posted 09 February 2013 - 08:03 PM

View Postpbl, on 09 February 2013 - 07:34 PM, said:

Your error are displayed with line numbers from the .java file
the class name and method name
and the methods that called them

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
at Assign7.showArray(Assign7.java:16)
at Assign7.main(Assign7.java:9)


I don't quite understand, but how do i solve this problem?
Was This Post Helpful? 0
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8332
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Unable to handle format: MPEG

Posted 09 February 2013 - 08:33 PM

To fix your problem you have to post your problem which is a stack trace showing
at which line in which .jave module the error occured
Was This Post Helpful? 0
  • +
  • -

#7 BlazingHeart  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 17-January 13

Re: Unable to handle format: MPEG

Posted 09 February 2013 - 09:05 PM

View Postpbl, on 09 February 2013 - 08:33 PM, said:

To fix your problem you have to post your problem which is a stack trace showing
at which line in which .jave module the error occured


Oh okay. but it only show this error

Posted Image

The actual error should be this, as i am trying to play mpg format files, not avi

Posted Image
Was This Post Helpful? 0
  • +
  • -

#8 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8332
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Unable to handle format: MPEG

Posted 09 February 2013 - 09:07 PM

?
Was This Post Helpful? 0
  • +
  • -

#9 BlazingHeart  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 17-January 13

Re: Unable to handle format: MPEG

Posted 09 February 2013 - 09:10 PM

View Postpbl, on 09 February 2013 - 09:07 PM, said:

?



I think this code is incorrect, do you have any link to video playing code, i really need to get my video playing as i need to submit my codes tomorrow.
Was This Post Helpful? 0
  • +
  • -

#10 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8332
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Unable to handle format: MPEG

Posted 09 February 2013 - 09:15 PM

for the N times:
post your error with the related stack trace
If you can't even do that forget about your programming carreer
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1