jmf可以播放视屏 但是我这里文件拿过来就是mp4格式的 不可能让我中间去转码吧。。。。
java除了jmf还有别的方式可以播放视屏文件的没??
------最佳解决方案--------------------------------------------------------
不一定非要使用jmf,只是建议:
http://blog.csdn.net/geminit2011/article/details/7682879
这是我写的,其中的NativeSwing中有一个vlc player可以实现播放mp4。
代码:
/*
* Christopher Deckers (chrriis@nextencia.net)
* http://www.nextencia.net
*
* See the file "readme.txt" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
package chrriis.dj.nativeswing.swtimpl.demo.examples.vlcplayer;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import chrriis.common.UIUtils;
import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.components.JVLCPlayer;
/**
* @author Christopher Deckers
*/
public class SimpleVLCPlayerExample extends JPanel {
public SimpleVLCPlayerExample() {
super(new BorderLayout());
// Create the player.
JPanel playerPanel = new JPanel(new BorderLayout());
playerPanel.setBorder(BorderFactory.createTitledBorder("VLC Player component"));
final JVLCPlayer player = new JVLCPlayer();
playerPanel.add(player, BorderLayout.CENTER);
add(playerPanel, BorderLayout.CENTER);
// Create the components that allow to load a file in the player.
GridBagLayout gridBag = new GridBagLayout();
GridBagConstraints cons = new GridBagConstraints();
JPanel playerFilePanel = new JPanel(gridBag);
JLabel playerFileLabel = new JLabel("File: ");
cons.gridx = 0;
cons.gridy = 0;
cons.insets = new Insets(2, 2, 2, 0);
cons.fill = GridBagConstraints.HORIZONTAL;
gridBag.setConstraints(playerFileLabel, cons);
playerFilePanel.add(playerFileLabel);
final JTextField playerFileTextField = new JTextField();
cons.gridx++;
cons.weightx = 1;
gridBag.setConstraints(playerFileTextField, cons);
final Runnable loadPlayerFileRunnable = new Runnable() {