Introduction

Play Video File :

Playing video is similar to playing audio. However, the video player needs to be told where to display the video. Therefore you get a VideoControl from the video player and display it either as a Form item or in a Canvas.

Source Code

Source Code : Comments :
VideoMidlet.java
import java.io.InputStream;

import javax.microedition.lcdui.Display;
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 VideoMidlet extends MIDlet {
Form myForm;
public VideoMidlet() {
myForm=new Form("Playing Video");
}
// TODO Auto-generated constructor stub

protected void destroyApp(boolean arg0) throws
MIDletStateChangeException {
// TODO Auto-generated method stub

}

protected void pauseApp() {
// TODO Auto-generated method stub

}
protected void startApp() throws MIDletStateChangeException {
try{
InputStream is = getClass().getResourceAsStream("/VideoClip.3gp");
Player player = Manager.createPlayer(is, "video/3gpp");
player.realize();
VideoControl vc = (VideoControl)player.getControl("VideoControl");
if (vc != null)
{
Item it = (Item)vc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
myForm.append(it);
player.start();
Display.getDisplay(this).setCurrent(myForm);
}
}

catch(Exception e)
{
e.printStackTrace();
}
}
}
// TODO Auto-generated method stub



Import Display and Form class from package LCDUI

Snapshots


Download

Right Click Here And Select Save Target For Download :

Video Playing- Powerpoint Presentation