日期:2014-05-20  浏览次数:20899 次

为什么我写的代码不能播放视频,请教知道的大侠
怎么测试都不能不放
import   java.io.InputStream;
import   javax.microedition.lcdui.Form;
import   javax.microedition.lcdui.Item;
import   javax.microedition.media.Manager;
import   javax.microedition.media.Player;
import   javax.microedition.media.control.VideoControl;
import   javax.microedition.midlet.MIDlet;
import   javax.microedition.midlet.MIDletStateChangeException;
public   class   MoveDemo   extends   MIDlet   {
Form   videoForm;
Player   player;
public   MoveDemo()   {
try   {
InputStream   is   =   getClass().getResourceAsStream( "1.wmv ");
player   =   Manager.createPlayer(is,   "播放 ");
player.realize();
VideoControl   video   =   (VideoControl)   player
.getControl( "VideoControl ");

Item   videoItem   =   (Item)   video.initDisplayMode(
VideoControl.USE_GUI_PRIMITIVE,   null);

videoForm.append(videoItem);
player.start();
}   catch   (Exception   e)   {
}
}
protected   void   destroyApp(boolean   arg0)   throws   MIDletStateChangeException   {
}
protected   void   pauseApp()   {
}
protected   void   startApp()   throws   MIDletStateChangeException   {
}
}

------解决方案--------------------
getClass().getResourceAsStream( "/1.wmv ");
------解决方案--------------------
恩.同意楼上的意见
------解决方案--------------------
InputStream is = getClass().getResourceAsStream( "1.wmv "); ???

手机也支持WMV格式的视频吗?
------解决方案--------------------
1.wmv??换成1.mpeg 或者1.au格式看看
------解决方案--------------------
关注中
------解决方案--------------------
提示错误: java.lang.IllegalArgumentException