引用
Unable to handle format: XVID, 960x540, FrameRate=29.9, Length=777600 0 extra bytes
Unable to handle format: mpeglayer3, 44100.0 Hz, 0-bit, Stereo, Unsigned, 16000.0 frame rate, FrameSize=8 bits
Failed to realize: com.sun.media.PlaybackEngine@480457
Error: Unable to realize com.sun.media.PlaybackEngine@480457
在测试JMF时出现了这样的错误,一般是avi的编码格式问题,JMF对一些新的avi格式是不支持的,特上传了一个通过测试的avi;以供测试之用
/**
* 视频播放测试
*/
public class VedioTest extends JFrame {
private Player player;
public static void main(String args[]) {
String path = "file:///E:/hello.avi";
VedioTest vt = new VedioTest(path);
vt.initUI();
}
/**
* 在构造器中初始化数据
*
* @param:要初始化的数据源,即视频文件的路径
*/
public VedioTest(String path) {
// 确定视频文件的位置
javax.media.MediaLocator ml = new javax.media.MediaLocator(path);
try {
// 创建一个播放器对象
player = javax.media.Manager.createPlayer(ml);
// 创建一个播放器的控制器监听器对象
MyConreollerListener l = new MyConreollerListener(player, this);
// 给播放器对象注册控制器监听器
player.addControllerListener(l);
// 开始播放
player.start();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 初始化界面
*/
public void initUI() {
this.setTitle("JMF播放视频示例");
this.setSize(400, 300);
this.setDefaultCloseOperation(3);
this.setVisible(true);
}
}
/**
* 视频控制器监听器类
*/
public class MyConreollerListener implements javax.media.ControllerListener {
private Player player;
private JFrame jf;
public MyConreollerListener(Player player, JFrame jf) {
this.player = player;
this.jf = jf;
}
/**
* 实现监听器接口中的方法.此方法可通知应用程序对播放器的事件做出反应
*/
public synchronized void controllerUpdate(ControllerEvent e) {
if (e instanceof javax.media.RealizeCompleteEvent) {
Component comp;
// 得到播放器的可视容器,即播放器显示视频的容器
if ((comp = player.getVisualComponent()) != null) {
// 将可视容器加到窗体上
jf.add("Center", comp);
}
// 得到播放器的控制面板容器
if ((comp = player.getControlPanelComponent()) != null) {
// 添加到窗体上
jf.add("South", comp);
}
jf.validate();// 刷新窗体
}
}
}
分享到:
相关推荐
简要介绍当代互联网特点,以及其发展变化过程
Please realize that this does not work on all devices (most HTC) before leaving negative feedback. Thank you. I am currently collecting data on which devices it will and will not work oh, and ...
C++ 大作业设计 解决路径 机器人If the document / view is adopted, it is necessary to realize: 1. The user can set the starting point / end point coordinates and determine the coordinate value by mouse ...
d3-to-data-visualization use d3.js to simulate network to realize GUI .使用d3.js 模拟网络拓补图
Shell scripting is a quick method to prototype a complex application or a problem by automating tasks when working on Linux-based systems. Using both simple one-line commands and command sequences ...
文件说明: 1.Tree.h:B树和B+树的通用接口,虚基类。BTree和BPlusTree都继承它,只有BPlusTree才有linear函数 2.BTree.h,BTree.cpp:B树的声明、实现代码 3.BPlusTree.h,BPlusTree.cpp:B+树的声明、实现代码,注:...
Artists and Designers: Realize your creative vision without coding! Unlock the power of Unity. Programmers: Add a powerful visual state machine editor to your toolbox. Interface with scripts or ...
Especially in big data and the scenarios which can't realize data distribution and parallel processing. I have been working on big data analysis for many years in telecommunition and information ...
这是一个可以独立调用的实现bp算法的Java程序,直接导入eclipse,根据自己的需要修改为自己所用。
(realize PSO algorithm) 文件列表: best.asv,2379,2011-12-08 best.m,2375,2011-08-04 gant6c6.m,1482,2011-08-04 jp_makespan.m,2115,2011-08-04 jp_makespan1.m,2069,2011-12-04 main.asv,1796,2011-12-08 ...
- FIX: The TFlexPanel.FindControlAtPoint method maked virtual to realize RealTime-capability when on mouse cursor moving the flex-object search not occurs. - FIX: After deleting the selected points ...
Programmers: Add a powerful visual state machine editor to your toolbox. Interface with scripts or extend Playmaker with Custom Actions. :: NEW Integrated UI Actions and Events. :: NEW Auto-Convert...
用matlab实现的SIFT算法,压缩包是源代码
Artists and Designers: Realize your creative vision without coding! Unlock the power of Unity. Programmers: Add a powerful visual state machine editor to your toolbox. Interface with scripts or ...
As more and more developers realize the huge opportunities available designing with Symbian OS, one of the first major obstacles they face is the sheer length of time it takes to start producing ...
Artists and Designers: Realize your creative vision without coding! Unlock the power of Unity. Programmers: Add a powerful visual state machine editor to your toolbox. Interface with scripts or ...
To realize success, IC designers need a complete toolbox-a toolbox filled not only with a solid background in electronics, design concepts and analysis skills, but also with the most valuable tool of...
用C++实现的仿QQ界面的软件,内涵QQ Server和QQ Client的源码以及运行程序
Artists and Designers: Realize your creative vision without coding! Unlock the power of Unity. Programmers: Add a powerful visual state machine editor to your toolbox. Interface with scripts or ...