【发布时间】:2012-06-23 09:50:33
【问题描述】:
JMF 提供了一个类MediaPlayer,可以用作全功能播放器。但是,我找不到播放音频文件的方法。所用代码的一些sn-ps。
import javax.media.bean.playerbean.MediaPlayer;
// ....
MediaPlayer mp = new MediaPlayer();
mp.setMediaLocation(location of file); // <- syntax error!
mp.start();
但它不起作用。 Eclipse 显示此错误:
Syntax error on token "setMediaLocation", Identifier expected after this token
..on setMediaLocation() 方法。
谁能告诉我如何使用MediaPlayer 类来播放音频文件?我的编码有什么问题?
【问题讨论】:
-
@AndrewThompson eclipse 显示此错误:“在 setMediaLocation() 方法上标记“setMediaLocation”的语法错误,此标记后需要标识符”。我导入了“javax.media.bean.playerbean.MediaPlayer;”
标签: java eclipse compiler-errors syntax-error jmf