Nokia 6234 (Series 40, 320x240) full screen video playback, seeking
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:
[CODE]
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");
player.realize();
VideoControl videoControl = (VideoControl) player.getControl("VideoControl");
VideoCanvas canvas = new VideoCanvas();
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, canvas);
videoControl.setDisplayFullScreen(true);
videoControl.setVisible(true);
videoControl.setDisplayLocation(0, 0);
videoControl.setDisplaySize(canvas.getWidth(), canvas.getHeight());
canvas.setFullScreenMode(true);
Display.getDisplay(this).setCurrent(canvas);
player.start();
Thread.sleep(50000);
}
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();
}
}
[/CODE]
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,
Alex
(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))
Re: Nokia 6234 (Series 40, 320x240) full screen video playback, seeking
A progress update...
I have managed to play video fullscreen, smoothly, with audio.
Caveat: I have to rotate the file on the PC, so it's 240x320.
But now I believe Player.setMediaTime() is not working for my mpeg4 video.
Is there any way to override this? I'll probably make several small mp4 files to simulate seeking, but I'd like to make "sane videos" (i.e. not rotated, full-length).
Ideas, thoughts?
Alex
Re: Nokia 6234 (Series 40, 320x240) full screen video playback, seeking
[QUOTE=koala]A progress update...
I have managed to play video fullscreen, smoothly, with audio.
Caveat: I have to rotate the file on the PC, so it's 240x320.
But now I believe Player.setMediaTime() is not working for my mpeg4 video.
Is there any way to override this? I'll probably make several small mp4 files to simulate seeking, but I'd like to make "sane videos" (i.e. not rotated, full-length).
Ideas, thoughts?
Alex[/QUOTE]
How do you manage to actually play the video? In mine it simply opened an yellow window with part of it black, and the sound playing in the background.
Please, keep me updated. I'll see if I can help you in this journey.
Thanks
Re: Nokia 6234 (Series 40, 320x240) full screen video playback, seeking
I managed to play some video and release a videoplayer that kinda seeks (you need to encode your videos in a special way to achieve it)...
[url]http://freshmeat.net/projects/nokia-vid-player/[/url]
Re: Nokia 6234 (Series 40, 320x240) full screen video playback, seeking
wow...have been searching for something like this for quite some time...thanks dude...by the what are the settings required for encoding? I'm using a nokia 6275 and will convert the video using super