Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-13-2008, 12:41 AM
Member
 
Join Date: May 2008
Posts: 7
Hayzam is on a distinguished road
JMF : Unable to handle format: MJPG, 320x240, FrameRate=15.0, Length=33792 0
hi there
i have a problem with self made media player ..

when running a simple AVI file with that code , it tells me the error posted above

actually it runs the sound of the video but not the video

any ideas ?

here is the code
Code:
import java.awt.*; import java.awt.event.*; import javax.media.*; import javax.media.format.*; import javax.media.protocol.*; public class VideoPlayer1 extends Frame implements ControllerListener, ActionListener { Player videoPlayer; String filename; /** Creates new VideoPlayer1 */ public VideoPlayer1(String s1) { super(s1); //handle window event handler addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent we) { dispose(); System.exit(0); } }); //create the menu MenuBar mb = new MenuBar(); setMenuBar(mb); Menu fileMenu = new Menu("File"); mb.add(fileMenu); MenuItem itemPlay = new MenuItem("Play"); itemPlay.addActionListener(this); fileMenu.add(itemPlay); MenuItem itemStop = new MenuItem("Stop"); itemStop.addActionListener(this); fileMenu.add(itemStop); MenuItem itemExit = new MenuItem("Exit"); itemExit.addActionListener(this); fileMenu.add(itemExit); } //add the event handler public void actionPerformed(ActionEvent ae) { String action = ae.getActionCommand().toString(); if (action.equals("Play")) { play(); } if (action.equals("Stop")) { stop(); } if (action.equals("Exit")) { dispose(); System.exit(0); } } private void stop() { if (videoPlayer != null) { videoPlayer.stop(); } } //play the video public void play() { try { //ask the user for a file name FileDialog fd =new FileDialog(this, "Choose Video", FileDialog.LOAD); fd.show(); //assemble the filename filename = fd.getDirectory() + fd.getFile(); //create the player videoPlayer = Manager.createPlayer( new MediaLocator("file:///" + filename)); //add a listener for player state changes videoPlayer.addControllerListener(this); videoPlayer.start(); }catch (Exception e) { System.out.println("Error " + e); } } //play public synchronized void controllerUpdate( ControllerEvent event) { System.out.println("Event: " + event); if (event instanceof RealizeCompleteEvent) { Component comp; if ((comp = videoPlayer.getVisualComponent()) != null) { add("Center", comp); }else System.out.println("Unable to get visual component"); if ((comp = videoPlayer.getControlPanelComponent()) != null) { add("South", comp); } validate(); } } }
Code:
public static void main(String[] args) { VideoPlayer1 vp1 = new VideoPlayer1("VideoPlayer1"); //show the frame containing the video vp1.show(); //size the window vp1.setSize(300,301); vp1.setLocation(250,300); }
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Better way to handle exceptions javaplus Advanced Java 2 01-16-2008 08:47 PM
How to handle socket Exception mayank0512 Networking 13 01-10-2008 02:53 PM
Determining Midi Length Usagi New To Java 0 12-09-2007 01:45 AM
how to handle exceptions paty Advanced Java 2 08-05-2007 06:17 AM
Help with method length toby New To Java 1 07-25-2007 10:29 PM


All times are GMT +3. The time now is 11:51 AM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org