⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 videoplayer.java

📁 手机视频播放软件
💻 JAVA
字号:



import javax.microedition.midlet.*; 
import javax.microedition.lcdui.*; 

/** A simple video player MIDlet using JSR 135 - Mobile Media API */ 
public class VideoPlayer extends MIDlet implements CommandListener 
{ 
private Command exitCommand; 
private Command playCommand; 
private Command contentTypeCommand; 

private Display display; 
private TextField textField; 
public Form form; 
private Gauge gauge; 

private static final int GAUGE_LEVELS = 4; 
private static final int GAUGE_MAX = 12; 
private static final String DEFAULT_URL = "file:///foot1/test.3gp"; 


public VideoPlayer() { 
display = Display.getDisplay(this); 
form = new Form("Video Player"); 
textField = new TextField("Video URL", DEFAULT_URL, 100, TextField.ANY); 
gauge = new Gauge("Acquiring video", false, GAUGE_MAX, 0); 
exitCommand = new Command("Exit", Command.EXIT, 2); 
playCommand = new Command("Play", Command.SCREEN, 1); 
contentTypeCommand = new Command("Supported media types", Command.SCREEN, 2); 
form.addCommand(playCommand); 
form.addCommand(exitCommand); 
form.addCommand(contentTypeCommand); 
form.setCommandListener(this); 
form.append(textField); 
} 


public void startApp(){ 
display.setCurrent(form); 
} 


public void pauseApp(){ 
} 


public void destroyApp(boolean unconditional){ 
} 


public void commandAction(Command c, Displayable s){ 

if(c == exitCommand){ 
destroyApp(false); 
notifyDestroyed(); 
} 

else if(c == playCommand){ 
gauge.setValue(0); 
form.append(gauge); 

VideoCanvas videoCanvas = new VideoCanvas(this); 
videoCanvas.initializeVideo(textField.getString()); 
} 

else if (c == contentTypeCommand){ 
String url = textField.getString(); 
int position = url.indexOf(':'); 
String protocol = url.substring(0, position); 

SupportedTypes typesUI = new SupportedTypes(this, protocol); 
display.setCurrent(typesUI); 
} 

} 


public void updateGauge(){ 
int current = gauge.getValue(); 
current = (current + GAUGE_MAX/GAUGE_LEVELS); 
gauge.setValue(current); 
} 

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -