Hi friends,
I want to make a movie player.I heard about JMF but not had any idea.If anyone knows, kindly help me.

thanks,
ram

Recommended Answers

All 2 Replies

If you heard about JMF, did you look at Sun's website for it? Did you read any of the tutorials and examples that are there? Some initiative would go a long ways.

commented: Spoon feed =) +4

Thanks Ezzaral,
I have gone thru, tried with some basic samples which throws Filenot found exception.

following are the code,
Find the bold line for file path,I dont know how to mention the file path from URL class.
I have tried with some ways like

"file://d:/explica.vlc"
"d:\\explica.vlc"

Can u tell me ,how to mention path from URL class?

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
    		{
		[B]player = Manager.createPlayer(new URL("file://explica.vlc"));[/B]		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);
    		}
    	}
    }
commented: 29 posts and to coding tags, shame -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.