Please help: Why JMF does't play .avi video clip?

The player doesn't play .avi media file, or plays sound only, but it works fine when palying .mpg files, anything I need to pay attention to when using the following code to generate a player to play video clips?
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
import javax.media.*;
public class PlayClip extends JFrame {
//singliton design pattern
private static PlayClip instance;
protected Player player;
private File file= new File ("goal.avi");
private PlayClip () {
instance=null;
initComponents();
public static PlayClip getInstance(){
if (instance==null)
instance=new PlayClip ();
return instance;
private void initComponents() {
JButton OK = new JButton ("OK");
OK.addActionListener (
new ActionListener () {
public void actionPerformed (ActionEvent e) {
player.close ();
instance = null;
dispose();
getContentPane ().add (OK, BorderLayout.NORTH);
setSize (300, 300);
show ();
createPlayer ();
/** Creates new form PlayClip */
private void createPlayer () {
if (file == null) {
return;
removePreviousPlayer ();
try {
//create a new player and add listener
player = Manager.createPlayer (file.toURL () );
player.addControllerListener (new EventHandler () );
player.start (); //start player
catch (Exception e) {
JOptionPane.showMessageDialog (this, "Invalid file or location", "Error loading file", JOptionPane.ERROR_MESSAGE );
System.exit (1);
private void removePreviousPlayer () {
if (player == null )
return;
player.close ();
Component visual = player.getVisualComponent ();
Component control = player.getControlPanelComponent ();
Container c = getContentPane ();
if (visual != null)
c.remove (visual);
if (control !=null)
c.remove (control);
private class EventHandler implements ControllerListener {
public void controllerUpdate (ControllerEvent e) {
if (e instanceof RealizeCompleteEvent ) {
Container c = getContentPane ();
Component visualComponent = player.getVisualComponent ();
if (visualComponent != null)
c.add (visualComponent, BorderLayout.CENTER);
Component controlsComponent = player.getControlPanelComponent ();
if (controlsComponent != null)
c.add (controlsComponent, BorderLayout.SOUTH);
c.doLayout ();
}

JDunlop,
thanks for your quick reply to my java.sun.com forum posting! i just got back from vacation, so i didn't get a chance to try your method til now. i pulled your email address off the website to update you on my problem playing an avi file in JMStudio (JMF).
as per your instructions, i downloaded the divx player at www.divx.com and tried to play the avi file. this is the error the divx player gives:
Divx Player 2.1
The file contains unknown video data
The file contains the following type of data:
Video data: FOURCC code "MP42"
You may need to install a new video codec on your computer to watch this video
Some quick questions:
1. Where could I find the "MP42" codec to play my avi file in JMStudio (JMF)? Does java.sun.com have video codecs?
2. You mentioned in your posting "If you don't have the one that was used in the encoding, your out of luck." Does this mean that I need to know how the avi file was originally coded and have the original codec to decode (play) it?
Thanks,
lac410
P.S. If you need more Duke Dollars for your help, I'd be happy to award them to you.
Re: Please help: Why JMF does't play .avi video clip?
Author: JDunlop Jun 5, 2003 5:00 AM
sounds to me like you are missing a video codecs. If you don't have the one that was used in the encoding, your out of luck. Download the player from divx.com, it will tell you which codecs the video needs (if it won't play). You can then search the net for that particular codecs.

Similar Messages

  • Can a one please help me turn off auto play for Facebook the option is no longer in my  General settings  why is this ?

    Can a one please help me turn off auto play for Facebook the option is no longer in my  General settings  why is this ?

    And yet the link you posted only tells you how to do it on the Facebook App for Android. Nothing about the Facebook page is mentioned at all, or how to do it on an iPhone.
    With that said, and assuming you have the most up to date version of the Facebook App, you can now turn the auto play feature Off within the Facebook App itself.  Tap on the "More" icon on the bottom right, then scroll down to Settings->Videos and Photos->Auto Play. If Smart auto-Play is on turn it off. Then you can set the check mark on "Never Play Videos Automatically" which is the same as Off.

  • Hey, i have an iphone 4, and it is upto date, the problem is that my phone does not play any videos online except on facebook, all other videos do not play instead a crossed play sign appears on the video. Please help.

    Hey, i have an iphone 4, and it is upto date, the problem is that my phone does not play any videos online except on facebook, all other videos do not play instead a crossed play sign appears on the video. Please help.

    I watch YouTube videos on a regular basis - mostly with the YouTube app but also with Safari.
    Some YouTube videos are supported to be viewed on a computer only or with a Flash capable device, which is becoming few and far between since Adobe no longer supports Flash on any mobile platform.
    Sometimes I get this video cannot be played on this platform, but rarely.

  • HT204382 why i couldn't play avi file on my macbook?

    hi
    why i couldn't play avi file on my macbook?

    Because you don't have a codec for that specific AVI installed. Opening it in the free MPEG Streamclip may tell you what you need.
    (78732)

  • When I import a video I recorded to my laptop from my Iphone 5c  it won't play on window media centre or vec or any medium. Please help??? It plays perfect on the phone.

    When I import a video I recorded to my laptop from my Iphone 5c  it won't play on window media centre or vec or any medium. Please help??? It plays perfect on the phone.

    The format from the phone is :
    h.264 encoded video, AAC audio. Both standards of MPEG 4.
    You need Windows Media Player version 12 or above to play MP4 (or add the codecs to your current version).

  • WHY CAN I NOT PLAY AVIs on MY QUICKTIME?

    someone help! i need to play AVIs on my quicktime but it's not cooperating!

    There is no single codec for movies that have .avi extensions. AVI is a container format, not a specific type of file. An AVI movie may use one of the Indeo codecs (there are at least four that I'm aware of, none of which have been ported to Mac OS X) or one of the various flavors of DivX, among other possibilities. You'll have to find out what codec was used for the movies you want to view to determine what you need. Note that not all codecs for the various .avi movies are available for QuickTime.
    If you want to try "hit and miss", you can try the codecs at http://www.divx.com/ and http://www.3ivx.com/ and see if one of them will work for you. Confirm compatibility with QuickTime 7 before you install them; earlier versions of either codec can cause problems with QT 7. You can also give this player a try:
    http://www.videolan.org/vlc/

  • HT3775 My DVD player is supposed to play avi videos, but it often doesn't telling me that the file format is not recognized.  I suspect it's because it's the wrong codec.  How can I tell what the codec is before I burn a DVD?  And how do I get a workable

    My DVD player is supposed to play avi videos, but it often doesn't telling me that the file format is not recognized.  I suspect it's because it's the wrong codec.  How can I tell what the codec is before I burn a DVD?  And how do I get a workable codec?  Thanks for uour help!
    Ken Selvidge ([email protected])

    I am not a computer savy person.  I just need to plug in and have the machine do what it should do.
    Not a problem, but that indicates you have a lot to learn.
    File extensions like mpeg, mp4., avi, wmv, etc. are just wrappers. It is like a box the audio or video content is placed inside. The audio and video content must be encoded with a codec before it is placed in the box. There are thousands of codecs. Not all are installed on your Mac. You must have the same codec installed that encoded the video in order to play it. So, while Quicktime does support mpeg wrapper, it may not have the codecs to decode the internal video.
    Some programs have lots of the codecs available to them, like VLC, Niceplayer, MPlayerX, etc.
    You can also get "plug-ins" for Quicktime that add codecs to Quicktime, like Perian. Although it is no longer being developed, Perian still works well.
    Why is it so difficult? Probably because they are always working on ways to compress the video to get better playback.

  • The ios 7 does not play Shared video

    the ios 7 does not play Shared video why?

    I have the same problem.  Shared video not accessible after iOS 7 upgrade.  Apple please address this.

  • Why can't I play any videos on Firefox Mobile?

    Why can't I play any videos on Firefox Mobile? I know that currently Firefox Mobile does not support Flash, but mp4 videos will not play either.

    I fixed it by rebooting, now everything works. Thanks Demo, for your help.

  • Play avi videos on nokia x3 02

    Can i able to play avi videos on my nokia x3 02 as the new asha phone models, when i tried to play i able to hear only sound not picture, my phone version is 6.80 shall i update to 7.86 or what i do please help!

    Use Format factory to convert the video files to your phone supported format and resolution.
    For X3-02, the best video format is MP4 and resolution is 320*240.
    Get Format Factory from here
    Hope this helps.
    -------------------If this post helped you, click on accept as solution.------------------
    -----------------------------Appreciate by clicking on white star.----------------------------

  • How to play .avi video files

    I've been searching for a program to download that will play .avi video files. The things I find, I either can't install, or they don't play .avi. I can't install them because I can't figure out how to run .exe applications either, which most of the installation files are (it just says choose application).
    Can someone please tell me of a good update to quicktime or a different video program, and/or tell me how to open .exe files?

    Well you can check out some of the free players like
    VLC:
    http://www.versiontracker.com/dyn/moreinfo/macosx/14738
    or
    Mplayer:
    http://www.versiontracker.com/dyn/moreinfo/macosx/27163
    Both of which will play just about any file format.
    Alternatively you can set up quicktime to play these same files (mpeg4, avi, etc.). You can find out how to do so along with links to the various codecs here:
    http://www.lordofthecows.com/avi_qt.php

  • HT1338 Why can't I play youtube videos on macbook pro 10.7.4

    Why can't I play youtube videos on macbook pro 10..7.4

    death to my hometown wrote:
    Why can't I play youtube videos on macbook pro 10..7.4
    Do you have the latest Adobe Flash Player installed? If not then go to the Adobe site and download and install it.
    Cheers
    Pete

  • How can I play avi video on my ipad 2

    I have tried to play avi video on my ipad 2. It will load and show on the screen but will not play. Any ideas? Thanks.

    AVI is a Windows file. You will need a .mov copy. You could also check for apps that play AVI files

  • Why can't I play a video from FB on my IPad?

    When I try to play a video clip from Facebook, it goes to pause after only a few seconds.  Why?

    Are you using the Facebook App or Facebook via Safari?

  • HT3775 My Macbook Air (still with Lion) will not play .avi video files

    My Macbook Air (still with Lion) will not play .avi video files (brought over from an older PC where they play with another viewer). This site implies Quicktime Player should be able to do so. Is there a codec or something else I'm supposed to download?

    I had found this through other threads, but it is what worked, even allowed my AVI files to be played in PowerPoint. Changing to 32-bit encryption did not work, BTW.

Maybe you are looking for

  • Can't delete a file or folde after using admin. password.

    Can't delete a file or folder after using admin. password.

  • Photos not showing in media viewer

    Hi.. I am using iweb 09 to build my website. However I cant view my photos that I have in Aperture, in the media viewer in iweb. I only have the one Aperture project on my laptop, and all of the non-edited... and edited photos within that project don

  • Calendar or PIM Sofltware Suggestions Migrating from Lotus Organizer Palm Centro Unblocked

    Any suggestions for Calendar and PIM software for migrating from Lotus Organizer? Lotus Organizer 6.1 does not support Palm Centro. Palm Desktop is a shell of a program instead. I need a real PIM that I can use. And no Outlook isn't much better. I've

  • Updated to iTunes 11.0.4 - now where's my stuff!?

    After updating to 11.0.4 my library appears to be empty.  I have all my music and movies on a ReadyNAS, nothing locally on my harddisk, but as of today when I open iTunes and point to where my iTunes Media folder is, it appears to be empty.  All the

  • Variant config : Run time Version

    Hi All, During run time version generation in Variant configuration, in R/3 using Tcode CU34 , errors like two characteristics are pointing to same table and field name and structure is not defined. Process is like this : We created configuration pro