Image capture (getSnapShot) on S40 6th edition & below
Ok, im well experienced with j2me and have done alot of complex programming with it over the years.
i have an app that uses the camera to take a snapshot (jsr-135)
the app works on S40 6th edition FP1 and S60 handsets i got a failed QA in Ovi for it on S40 6th edition & below.
i dont have an S40 6th edition or below device so i decided to check the s40 6th edition emulator which according to the documentation should be able to capture an image (the app also work on s40 6th edition FP1 emulator).
the vc.getSnapShot(null) call fails with illegal state exception on the S40 6th edition emulator and please note my first line that i wrote (im 100% percent sure that my code is correct also note that it runs on FP1 emulator and device)
BUT to play the devils advocate i decided to use an official sample from the wiki for capture an image with j2me
[url]http://www.developer.nokia.com/Community/Wiki/How_to_display_the_camera_%26_take_snapshots_in_Java_ME[/url]
i checked this exact code on the s40 6th edition emulator (i changed the locator string to capture://image as wisely stated in the wiki as it should be from my knowledge as well) and it fails with the same exception as my app on the exact same line.....
so i ask WTF????
can someone with a s40 6th edition or below please help me by checking the code in the wiki if it works on their phone?
Thanks to the helpers
Re: Image capture (getSnapShot) on S40 6th edition & below
[B]getSnapshot[/B]
[B]public byte[] getSnapshot(java.lang.String imageType)
throws MediaException[/B]
Gets a snapshot of the displayed content. Features and format of the captured image are specified by the imageType. All implementations support at least PNG format. Available formats can be queried from System.getProperty with video.snapshot.encodings as the key.
Parameters:
imageType - Format and resolution of the returned image. If null is given, it will default to using the PNG format.
Returns:
image as a byte array in required format.
Throws:
[B]IllegalStateException - Thrown if initDisplayMode has not been called.[/B]
MediaException - Thrown if the requested format is not supported.
SecurityException - Thrown if the caller does not have the security permission to take the snapshot.
Check that initDisplayMode is called and VideoControl is visible before getSnapShot is called.
Try this codelet -
javax.microedition.lcdui.Canvas canvas;
:
try {
Player p = Manager.createPlayer("http://abc.mpg");
p.realize();
VideoControl vc;
if ((vc = (VideoControl)p.getControl("VideoControl")) != null)
vc.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, canvas));
vc.setVisible(true);
p.start();
byte[] raw=vc.getSnapShot(null); // within try catch
} catch (MediaException pe) {
} catch (IOException ioe) {
}
Re: Image capture (getSnapShot) on S40 6th edition & below
Amit ??? i dont need the documentation of getSnapshot im well informed of what causes it to throw exception and how it behaves etc, i've programmed in j2me since 2003.
as for your code snippet i dont need to take a snapshot from a movie but from the camera if you have an S40 6th edition and below please help me by testing the code from the wiki on the handset.
Thanks
Shai
Re: Image capture (getSnapShot) on S40 6th edition & below
I don't have any old S40 device with me, try some remote device testing labs.... check deviceAnywhere or perfecto mobile, they might provide your any s40 device for testing remotely even with its trail service.
Re: Image capture (getSnapShot) on S40 6th edition & below
ye i know DAW and perfecto, im asking if anyone in the forum that do have these kind of handset can confirm this and if there is anything that can be done.
Re: Image capture (getSnapShot) on S40 6th edition & below
doesnt anyone have s40 6th or less phone to check this one?
i mean its official example from the wiki and its not working on the emulator as it should....
Re: Image capture (getSnapShot) on S40 6th edition & below
[QUOTE=shaii;857040]Ok, im well experienced with j2me and have done alot of complex programming with it over the years.
i have an app that uses the camera to take a snapshot (jsr-135)
the app works on S40 6th edition FP1 and S60 handsets i got a failed QA in Ovi for it on S40 6th edition & below.
i dont have an S40 6th edition or below device so i decided to check the s40 6th edition emulator which according to the documentation should be able to capture an image (the app also work on s40 6th edition FP1 emulator).
the vc.getSnapShot(null) call fails with illegal state exception on the S40 6th edition emulator and please note my first line that i wrote (im 100% percent sure that my code is correct also note that it runs on FP1 emulator and device)
BUT to play the devils advocate i decided to use an official sample from the wiki for capture an image with j2me
[url]http://www.developer.nokia.com/Community/Wiki/How_to_display_the_camera_%26_take_snapshots_in_Java_ME[/url]
i checked this exact code on the s40 6th edition emulator (i changed the locator string to capture://image as wisely stated in the wiki as it should be from my knowledge as well) and it fails with the same exception as my app on the exact same line.....
so i ask WTF????
can someone with a s40 6th edition or below please help me by checking the code in the wiki if it works on their phone?
Thanks to the helpers[/QUOTE]
I have S40 5th edition fp 1 device with me and I have succeeded to capture image from it using code from WiKi
Re: Image capture (getSnapShot) on S40 6th edition & below
Hello shaii,
the error which you get in the Series 40 6th Edition SDK emulator is due to the fact that camera capture via Java MIDlets (by using JSR-135 MMAPI and/or JSR-234 AMMS API) is not supported by the SDK emulator.
The SDK documentation says as follows:
[QUOTE][I]Camera functionality works fine but screens overlap when camera application is launched. [/I][/QUOTE]
The above definition refers to using the camera on the phone (i.e. from Menu -> Media -> Camera).
I tested the example application with the capture locator for Series 40 capture://image by using Nokia 3710 fold (a Series 40 6th Edition device) and that works as expected.
Regarding the QA test issue, could you provide more details on the QA report i.e. what was the root cause for failing the pass test? Was there any specific devices defined which were used for testing (and which fail using the application)?
Regards,
r2j7