Hi pacjent,
I have managed to get a full screen video (with side bars at the top and bottom) with the following code on PureView 808 running Belle:
Main MIDlet:
Code:
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class CameraMIDlet extends MIDlet {
Display display;
CameraCanvas canvas;
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 {
display = Display.getDisplay(this);
canvas = new CameraCanvas();
canvas.setFullScreenMode(true);
display.setCurrent(canvas);
}
}
Supportive Canvas Class:
Code:
import java.io.IOException;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Graphics;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
import javax.microedition.media.control.VideoControl;
public class CameraCanvas
extends Canvas{
Player player;
VideoControl videoControl;
CameraCanvas() {
try {
// Newer phones need to be initialized to image mode
try {
player = Manager.createPlayer("capture://image");
// Older phones don't support this, so we start them
// in video mode.
} catch (Exception ce) {
System.out.println("changing to capture video");
player = Manager.createPlayer("capture://video");
}
player.realize();
player.prefetch();
// Get VideoControl for the viewfinder
videoControl = (VideoControl) player.getControl("VideoControl");
if (videoControl == null) {
discardPlayer();
player = null;
System.out.println("VideoContro = null!");
} else {
// Set up the viewfinder on the screen.
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);
videoControl.setDisplayFullScreen(true);
player.start();
videoControl.setVisible(true);
}
} catch (IOException ioe) {
discardPlayer();
System.out.println("IOException: " + ioe.getMessage());
} catch (MediaException me) {
System.out.println("MediaException: " + me.getMessage());
} catch (SecurityException se) {
System.out.println("SecurityException: " + se.getMessage());
}
}
// Stops the video player
synchronized void stop() {
if (player != null) {
try {
videoControl.setVisible(false);
player.stop();
} catch (MediaException me) {
System.out.println("MediaException: " + me.getMessage());
}
}
}
// this method will discard the video player
private void discardPlayer() {
if (player != null) {
player.deallocate();
player.close();
player = null;
}
videoControl = null;
}
protected void paint(Graphics g) {
// TODO Auto-generated method stub
}
}
I also had to use this jad attribue: Nokia-MIDlet-On-Screen-Keypad: no
I don't see why this won't work on N8. Can you try the above code and let us know if it works on your device?