Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > play video with JMF and LINUX

Reply
Thread Tools

play video with JMF and LINUX

 
 
Andrea Beccari
Guest
Posts: n/a
 
      03-05-2004
I'm writing a program for playing an avi file (cinepak codec) using the Java
Media Framework.
No problem if I run it under Windows, but when I try to play it under Linux
(fedora) I can only hear the sound of the video and I see nothing.

Please help...

This is the simple code that I have written:

package Client;

import javax.media.*;
import javax.media.format.*;
import javax.media.protocol.*;

import javax.sound.sampled.*;
import javax.sound.sampled.spi.*;


import java.util.logging.*;

import java.awt.image.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.URL;
import java.util.*;

public class RouletteGUI extends javax.swing.JFrame implements
ControllerListener{
String videoFile="/home/game/media/roulette/video_0.avi";
MediaLocator src;
Player video;
//JPanel videoP=new JPanel(true);

/** Creates new form RouletteGUI */
public RouletteGUI() {
initComponents();


//JOptionPane.showMessageDialog(null,"file:"+videoFi le+"_"+i+"."+videoExt);
src = new MediaLocator("file:"+videoFile); //setto l'URL
System.out.println("MediaLocator file:"+videoFile);


System.out.println("createPlayer file:"+videoFile);
try {
video = Manager.createPlayer(src);
}catch (Exception e) {
JOptionPane.showMessageDialog(null,"err :"+e);
}
video.addControllerListener(this);
// video[i].realize();
System.out.println("realized");
}

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
videoP = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();

addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});

videoP.setMinimumSize(new java.awt.Dimension(300, 300));
videoP.setPreferredSize(new java.awt.Dimension(300, 300));
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

videoP.add(jButton1);

getContentPane().add(videoP, java.awt.BorderLayout.CENTER);

pack();
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Add your handling code here:
video.start();
}

/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new RouletteGUI().show();
}

public void controllerUpdate(javax.media.ControllerEvent evt) {

//videoF.getContentPane().add(video[numeroEstratto].getVisualComponent(),
BorderLayout.CENTER);
if(evt instanceof RealizeCompleteEvent)
{
videoP.setLayout(new BorderLayout());
videoP.add(video.getVisualComponent());
}
else if (evt instanceof StartEvent) {
videoP.show();
}
}

// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JPanel videoP;
// End of variables declaration

}


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
JMF - can it play dv avi files? Josef Garvi Java 4 04-15-2009 12:16 PM
API Jmf:Transcoding to different formats (Solution SUN jmf: "Transcode.java ) Misterysword@hotmail.com Java 0 08-13-2007 11:40 AM
PLAY MORE VIDEO GAMES WITH GOTTA PLAY Paul Heslop Digital Photography 0 05-21-2007 11:40 AM
A bug of JMF(when JMF is playing video, InterruptedException occurs after the "refresh" button of IE is clicked)? taowang.gml@gmail.com Java 1 07-19-2006 11:21 PM
JMF wanted to play a mpg video and capture an Image into a Buffered Image tochaotic4u Java 2 07-03-2003 09:50 AM



Advertisments