Cannot find a Player for :file 如何解决

downloadsunlight2009 2010-09-23 03:01:14
今天做了一个java播放器 但老是报错Cannot find a Player for :file 我应当如何让解决如何解决
...全文
591 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
还是没有答案啊。。。。。
  • 打赏
  • 举报
回复
不好意思 代码如下:
import javax.swing.*;
import javax.media.*;

import java.awt.*;
import java.io.*;
import java.awt.event.*;

public class MyVideoPlayer {

/**
* @param args
*/
JTextField jtf;
private JButton start, open, close, stop, resum;
private Container con;
private JPanel pane;
private Component visualComp, contrlComp;
private JFrame mainFrame;
private Player player;

public MyVideoPlayer() {
mainFrame = new JFrame("阳光播放器");
con = mainFrame.getContentPane();
pane = new JPanel(new FlowLayout());
jtf = new JTextField(15);
start = new JButton("播放");
open = new JButton("打开");
close = new JButton("停止");
stop = new JButton("暂停");
resum = new JButton("继续");
start.addActionListener(new MyListener());
open.addActionListener(new MyListener());
close.addActionListener(new MyListener());
stop.addActionListener(new MyListener());
resum.addActionListener(new MyListener());
pane.add(jtf);
pane.add(open);
pane.add(start);
pane.add(stop);
pane.add(resum);
pane.add(close);
con.add(pane, BorderLayout.SOUTH);

mainFrame.setSize(600, 500);
mainFrame.setVisible(true);
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public static void main(String[] args) {
// TODO Auto-generated method stub

new MyVideoPlayer();
}

class MyListener implements ActionListener {

@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
Object b = e.getSource();
try {
if (b == start) {
if (player != null)
player.close();
player=Manager.createPlayer(
new MediaLocator("file:"+jtf.getText()));
player.addControllerListener(new MyConLis());
player.start();

} else if (b == open) {
openFile();
} else if (b == close) {
if (player != null) {
player.close();
player = null;
}

} else if (b == stop) {
if (player != null)
player.stop();
} else if (b == resum) {
if (player != null)
player.start();
}
System.out.println(player);
} catch (Exception e1) {
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(mainFrame,"无法播放文件!");
e1.printStackTrace();
}
}

}

public void openFile() {
JFileChooser ch = new JFileChooser();
ch.setDialogTitle("请选择视频文件");
if (ch.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {
File tempFile = ch.getSelectedFile();
jtf.setText(tempFile.toString());
}

}

class MyConLis implements ControllerListener {

@Override
public void controllerUpdate(ControllerEvent e) {
// TODO Auto-generated method stub
if (e instanceof RealizeCompleteEvent) {
if (visualComp != null)
con.remove(visualComp);
if (contrlComp != null)
con.remove(contrlComp);
if ((visualComp = player.getVisualComponent()) != null)
con.add(visualComp, BorderLayout.CENTER);
if ((contrlComp = player.getControlPanelComponent()) != null)
con.add(contrlComp, BorderLayout.NORTH);
mainFrame.validate();
}

}
}
}
jaisokforron 2010-09-23
  • 打赏
  • 举报
回复
一点代码都没有,谁能回复你啊
vmware 11 最新的unlock2.0 Mac OS X Unlocker for VMware V2.0 ================================= 1. Introduction --------------- Unlocker 2 is designed for Workstation 11, Player 7 and Fusion 7. If you are using an earlier product please continue using Unlocker 1 Version 2 has been tested against: * Workstation 11 on Windows and Linux * Player 7 on Windows and Linux * Fusion 7 on Mavericks and Yosemite * (Currently is does not work on ESXi 6.0) The patch code carries out the following modifications dependent on the product being patched: * Fix vmware-vmx and derivatives to allow Mac OS X to boot * Fix vmwarebase .dll or .so to allow Apple to be selected during VM creation * A copy of the latest VMware Tools for OS X is included Note that not all products recognise the darwin.iso via install tools menu item. You will have to manually mount the darwin.iso for example on Workstation and Player. The vmwarebase code does not need to be patched on OS X so you will see a message on those systems telling you that it will not be patched. In all cases make sure VMware is not running, and any background guests have been shutdown. The code is now Python as it makes the Unlocker easier to run and maintain on ESXi. There are some challenges to write the code as ESXi has a subset of Python 2.7 which constrains some modules that can be used. 2. Prerequisites ---------------- The code requires Python 2.7 to work. Most Linux distros and OS X ship with a compatible Python interpreter and should work without requiring any additional software. Windows will need a version of Python installed and the code has been tested against: CPython - https://www.python.org/downloads/ ActiveState Python - http://www.activestate.com/activepython/downloads IronPython - https://ironpython.codeplex.com/releases/view/169382 The python.exe file must be on the executable PATH. If it is not on PATH please edit win-install.cmd to point to the installation path. 3. Limitations -------------- The Unlocker currently does not work on ESXi 6. The Unlocker does not remove the check for server versions for OS X Leopard and Snow Leopard (10.5 and 10.6). +-----------------------------------------------------------------------------+ | IMPORTANT: | | ========== | | | | If you create a new VM using version 11 hardware VMware will stop and | | create a core dump.There are two options to work around this issue: | | | | 1. Change the VM to be HW 10 - this does not affect performance. | | 2. Edit the VMX file and add: | | smc.version = 0 | | | +-----------------------------------------------------------------------------+ Work continues to find solutions to the limitations. 4. Windows ---------- On Windows you will need to either run cmd.exe as Administrator or using Explorer right click on the command file and select "Run as administrator". win-install.cmd - patches VMware win-uninstall.cmd - restores VMware 5. Linux --------- On Linux you will need to be either root or use sudo to run the scripts. You may need to ensure the Linux scripts have execute permissions by running chmod +x against the 2 files. lnx-install.sh - patches VMware lnx-uninstall.sh - restores VMware 6. Mac OS X ----------- On Mac OS X you will need to be either root or use sudo to run the scripts. This is really only needed if you want to use client versions of Mac OS X. You may need to ensure the OS X scripts have execute permissions by running chmod +x against the 2 files. osx-install.sh - patches VMware osx-uninstall.sh - restores VMware Thanks to Zenith432 for originally building the C++ unlocker and Mac Son of Knife for all the testing and support. History ------- 12/12/14 1.0.0 - First release (c) 2011-2014 Dave Parsons

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧