| Reply | « Previous Thread | Next Thread » |
|
Dear forum members,
I've developed an application with eSWT for s60 5th edition and would like to add photo-taking capabilities. In order to do this it looks like I need to use the VideoControl object from JSR-135. This object seems to return an Item gui object for AWT or a Canvas object for LCDUI, from which the picture taking is performed. Is it possible to do picture taking from within an eSWT application? Perhaps it's possible somehow to capture the background of the LCDUI Canvas object and paint the image onto an eSWT Canvas object? Any help would be greatly appreciated. Best regards, Jim |
|
Good news, JSR-135 actually supports eSWT on S60 3rd Ed FP2 and 5th Ed. Here is a snippet that shows how to initialize VideoPlayer for eSWT.
Code:
// creating player
player = Manager.createPlayer("capture://video");
player.realize();
// Grab the video control and set it to the current display.
VideoControl vcCam = (VideoControl) player.getControl("VideoControl");
//setting VideoControl to eSWT control
Control control = (Control) vcCam.initDisplayMode(GUIControl.USE_GUI_PRIMITIVE, Control.class.getName());
// setting control to shell
control.setParent(shell);
|
| gorkem.ercan |
| View Public Profile |
| Find all posts by gorkem.ercan |
|
Hi Gorkem,
Thanks for the response, which seemed exactly what I hoped for :). I've used CaptureMidlet.java as the basis for my MIDlet, which is a LCDUI based camera demo (and works on my 5800). However when I run my eSWT MIDlet on the 5800 I get the following exception: Code:
Error java.lang.Error SymbianOS error = -1 : General: System error Code:
player = Manager.createPlayer("capture://video");
I've included my simple test case below, perhaps you can see the problem? Code:
import java.io.IOException;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
import javax.microedition.media.control.GUIControl;
import javax.microedition.media.control.VideoControl;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import org.eclipse.ercp.swt.mobile.MobileShell;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
public class ESWT_Test extends MIDlet implements Runnable {
private Thread thread;
protected void startApp() throws MIDletStateChangeException {
if ( thread == null ) {
//The GUI needs to run in a separate thread than the MIDlet
thread = new Thread( this );
thread.start();
}
}
protected void pauseApp() {
}
protected void destroyApp( boolean unconditional ) throws MIDletStateChangeException {
}
public void run() {
MobileShell shell = null;
shell = new MobileShell(SWT.RESIZE | SWT.MIN |SWT.MAX | SWT.CLOSE);
shell.setSize(240,350);
shell.setText("Hello");
shell.setLayout(new FormLayout());
// creating player
Player player = null;
try {
player = Manager.createPlayer("capture://video");
} catch (IOException e) {
e.printStackTrace();
} catch (MediaException e) {
e.printStackTrace();
}
try {
player.realize();
player.prefetch();
} catch (MediaException e) {
e.printStackTrace();
}
// Grab the video control and set it to the current display.
VideoControl vcCam = (VideoControl) player.getControl("VideoControl");
// setting VideoControl to eSWT control
Control control = (Control) vcCam.initDisplayMode(
GUIControl.USE_GUI_PRIMITIVE, Control.class.getName());
// setting control to shell
control.setParent(shell);
try {
player.start();
} catch (MediaException e) {
e.printStackTrace();
}
shell.open();
Display display = shell.getDisplay();
while(!shell.isDisposed()) {
if(!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
Jim |
|
Additionally, getting the system property "supports.video.capture" whilst using the lcdui Display results in "true" on the 5800. However getting that property on the same phone whilst using the eswt display results in null! Perhaps I'm making a mistake but I can't see it.. Any help would be greatly appreciated
Jim |
|
Dear forum members + nokia employees,
I've been in touch with Gorkem and he's discovered that there was a problem on early 5800s with MMAPI when used with eSWT. This is causing the camera to be unusable with eSWT on the 5800. The MMAPI team have notified us that a fix has been released to S60 5th ed. and the 5800 will be get it in the next software update. Please can anyone let me know when the next 5800 software update is due for release? Best wishes, Jim |
|
Dear all,
I've found a solution for this problem, when I want to use the camera I'm using the push registry to restart the app and startup with LCDUI. When the photo is taken it restarts in eSWT mode again! I have another question regarding eSWT. I'm using the ScrolledComposite helper class which exists in the org.eclipse.ercp.swt.demo module in Eclipse CVS. It's great as far as functionality goes, but visually tears as it's being scrolled (upon stopping scrolling it looks fine again). Does anyone have a suggestion for how to avoid this visual tearing? Many thanks, Jim Redfern |
|
Anyone knows if this problem has been solved in the last firmware update release of the 5800 (v31.0.0.15)?
Thanks |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|