Java堆栈跟踪分析,媒体中的错误标头?
我目前正在使用 JMF 将视频嵌入到我的 GUI 中。我的课程看起来不错,但我不断收到奇怪的堆栈跟踪,这让我摸不着头脑。
Failed to configure: com.sun.media.PlaybackEngine@1fc4bec
Bad header in the media: IOException when parsing hdrl
Error: Unable to realize com.sun.media.PlaybackEngine@1fc4bec
javax.media.CannotRealizeException
at javax.media.Manager.blockingCall(Manager.java:2005)
at javax.media.Manager.createRealizedPlayer(Manager.java:554)
at EmbeddedPlayer.<init>(EmbeddedPlayer.java:24)
at MenuFrame.addMedia(MenuFrame.java:142)
at ConfigReader.parse(ConfigReader.java:362)
at ConfigReader.findFrames(ConfigReader.java:60)
at ConfigReader.main(ConfigReader.java:32)
Exception in thread "main" java.lang.NullPointerException
at EmbeddedPlayer.<init>(EmbeddedPlayer.java:35)
at MenuFrame.addMedia(MenuFrame.java:142)
at ConfigReader.parse(ConfigReader.java:362)
at ConfigReader.findFrames(ConfigReader.java:60)
at ConfigReader.main(ConfigReader.java:32)
seek: java.io.IOException: Negative seek offset
我只用 Java 进行了一年的开发,我不太确定跟踪现在告诉我什么。
任何帮助,即使只是告诉我发生了什么都会有很大帮助。
这是EmbeddedPlayer:
import java.awt.BorderLayout;
import java.awt.Component;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.Player;
import javax.swing.JPanel;
@SuppressWarnings("serial")
public class EmbeddedPlayer extends JPanel {
private MenuFrame parent;
public static final String DEFAULT_MEDIA_PATH = "media/";
public EmbeddedPlayer(MenuFrame parent, String file) {
this.parent = parent;
setLayout( new BorderLayout() );
Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, true);
Player mediaPlayer = null;
Component video = null;
Component controls = null;
try {
MediaLocator location = new MediaLocator(file);
mediaPlayer = Manager.createRealizedPlayer(location);
video = mediaPlayer.getVisualComponent();
controls = mediaPlayer.getControlPanelComponent();
} catch (Exception e) {
e.printStackTrace();
}
if ( video != null ) { add(video, BorderLayout.CENTER); }
if ( controls != null ) { add(controls, BorderLayout.SOUTH); }
this.parent.add(this);
mediaPlayer.start();
}
}
基于此示例: http://www.deitel.com/articles /java_tutorials/20060422/PlayingVideowithJMF/
I'm currently playing around with the JMF to get video embedded in my GUI. I got a good looking class up but I keep getting an odd stacktrace which has me scratching my head.
Failed to configure: com.sun.media.PlaybackEngine@1fc4bec
Bad header in the media: IOException when parsing hdrl
Error: Unable to realize com.sun.media.PlaybackEngine@1fc4bec
javax.media.CannotRealizeException
at javax.media.Manager.blockingCall(Manager.java:2005)
at javax.media.Manager.createRealizedPlayer(Manager.java:554)
at EmbeddedPlayer.<init>(EmbeddedPlayer.java:24)
at MenuFrame.addMedia(MenuFrame.java:142)
at ConfigReader.parse(ConfigReader.java:362)
at ConfigReader.findFrames(ConfigReader.java:60)
at ConfigReader.main(ConfigReader.java:32)
Exception in thread "main" java.lang.NullPointerException
at EmbeddedPlayer.<init>(EmbeddedPlayer.java:35)
at MenuFrame.addMedia(MenuFrame.java:142)
at ConfigReader.parse(ConfigReader.java:362)
at ConfigReader.findFrames(ConfigReader.java:60)
at ConfigReader.main(ConfigReader.java:32)
seek: java.io.IOException: Negative seek offset
I've only been developping in Java for a year and I'm not quite sure what the trace is telling me right now.
Any help even just telling me what's happening would help greatly.
here is EmbeddedPlayer:
import java.awt.BorderLayout;
import java.awt.Component;
import javax.media.Manager;
import javax.media.MediaLocator;
import javax.media.Player;
import javax.swing.JPanel;
@SuppressWarnings("serial")
public class EmbeddedPlayer extends JPanel {
private MenuFrame parent;
public static final String DEFAULT_MEDIA_PATH = "media/";
public EmbeddedPlayer(MenuFrame parent, String file) {
this.parent = parent;
setLayout( new BorderLayout() );
Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, true);
Player mediaPlayer = null;
Component video = null;
Component controls = null;
try {
MediaLocator location = new MediaLocator(file);
mediaPlayer = Manager.createRealizedPlayer(location);
video = mediaPlayer.getVisualComponent();
controls = mediaPlayer.getControlPanelComponent();
} catch (Exception e) {
e.printStackTrace();
}
if ( video != null ) { add(video, BorderLayout.CENTER); }
if ( controls != null ) { add(controls, BorderLayout.SOUTH); }
this.parent.add(this);
mediaPlayer.start();
}
}
Based on this example: http://www.deitel.com/articles/java_tutorials/20060422/PlayingVideowithJMF/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信EmbeddedPlayer是您的代码(不是jmf),因此您需要检查EmbeddedPlayer.java第35行引用了哪个对象。或者发布EmbeddedPlayer的代码。
更新:问题似乎是无法创建播放引擎。
也许这个网址会帮助 http://blog.msbbc。 co.uk/2007/06/mp3-playback-in-java.html
I believe EmbeddedPlayer is your code(not jmf), and hence you need to check which object is being referenced at EmbeddedPlayer.java, line 35. Or post the code of EmbeddedPlayer.
UPDATE: The problem seems to be unable to create playback engine.
Maybe this url will help http://blog.msbbc.co.uk/2007/06/mp3-playback-in-java.html