Hi all,

I'm dabbling in J2ME in order to learn a bit about the platform and, at the same time, scratch an itch.

I'd like to write a MIDlet that plays back MPEG4 video at full screen and allows seeking. I'm not sure this is even possible, so I'd settle for playing back videos in sequence without gaps (these two would be an improvement on the 6234's built-in video player).

I have written a small MIDlet that already does some things:

package net.sf.meplayer;

import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
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 MEPlayer extends MIDlet {

	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {

	protected void pauseApp() {

	protected void startApp() throws MIDletStateChangeException {
		try {
		  Player player = Manager.createPlayer("file:///E:/a.mp4");
			VideoControl videoControl = (VideoControl) player.getControl("VideoControl");
			VideoCanvas canvas = new VideoCanvas();
			videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, canvas);
			videoControl.setDisplayLocation(0, 0);
			videoControl.setDisplaySize(canvas.getWidth(), canvas.getHeight());

		catch(Exception e) {
			Display.getDisplay(this).setCurrent(new Alert("error", e.toString(), null, AlertType.ERROR ));


class VideoCanvas extends Canvas {
	protected void paint(Graphics g) {
    g.setColor(0x00FFFF00); // yellow
    g.fillRect(0, 0, getWidth(), getHeight());
	public int getWidth() {
	  return super.getWidth();
	public int getHeight() {
	  return super.getHeight();

This doesn't work completely yet, but if you try to playback an MPEG4 video (named a.mp4 in the root directory of the Micro SD card), you'll get the sound and if you hit the quit button, you'll see that the video is being played back, but it's not updated as it plays. It's also playing fullscreen, but at about 240x240 of the 240x320 display.

I'm looking for ways to:

* Have the video update
* Rotate the video so that it goes 240x320 like the bundled video player

After that I'll investigate seeking (I'm not sure if this will be possible) and add an interface to be able to choose videos.

I'd appreciate any input on any of the above.

Kind regards,


(p.d. if anyone points me towards an existing application or way of achieving this, I will also be very grateful (although my self-learning inertia might go away))