日期:2014-05-20 浏览次数:20993 次
try {
InputStream is = getClass().getResourceAsStream("/3.mpg");
Player p = Manager.createPlayer(is, "video/mpeg");
p.realize();
// Grab the video control and set it to the current display.
VideoControl vc = (VideoControl)p.getControl("VideoControl");
if (vc != null) {
Form form = new Form("Video form");
form.append((Item)vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null));
display.setCurrent(form);
}
p.start();
} catch (IOException ioe) {
} catch (MediaException me) { }
Generic/DefaultColorPhone: startApp threw an Exception Generic/DefaultColorPhone: java.lang.ClassCastException Generic/DefaultColorPhone: java.lang.ClassCastException Generic/DefaultColorPhone: at com.protel.MM.UI.MMMidlet.startApp(+224) Generic/DefaultColorPhone: [javac] C:\Documents and Settings\winxp\Desktop\mmapi\source\src\com\protel\MM\UI\MMMidlet.java:57: form.append((Item)vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null)); Generic/DefaultColorPhone: at javax.microedition.midlet.MIDletProxy.startApp(+7) Generic/DefaultColorPhone: at com.sun.midp.midlet.Scheduler.schedule(+270) Generic/DefaultColorPhone: at com.sun.midp.main.Main.runLocalClass(+28) Generic/DefaultColorPhone: at com.sun.midp.main.Main.main(+116)
try {
System.out.println("~~~~~~~~~~"+getClass().getResourceAsStream("/3.mpg"));
InputStream is = getClass().getResourceAsStream("/3.mpg");
Player p = Manager.createPlayer(is, "video/mpeg");
p.realize();
// Grab the video control and set it to the current display.
VideoControl vc = (VideoControl)p.getControl("VideoControl");
if (vc != null) {
javax.microedition.lcdui.Form form = new javax.microedition.lcdui.Form("Video form");
javax.microedition.lcdui.Item videoItem = (javax.microedition.lcdui.Item)vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
form.append(videoItem);
display.setCurrent(form);
}
p.start();
} catch (IOException ioe) {
} catch (MediaException me) { }