Forums Register Login

createPlayer() working in emulator but not in phone..

+Pie Number of slices to send: Send
I have a Video Control in my Midlet. I purpose is to simply allow the user to take snapshots (similar to the camera) and do other things..
The video works fine in the emulator, but when I downloaded the app to my Motorolo V220 phone, it says "createPlayer() failed."
What is going on here? Huh Huh Huh
Please Help..

Here's a snippet of the code:
Player capturePlayer = null;
...
capturePlayer = Manager.createPlayer("capture://video");
capturePlayer.realize();
canvas = new CaptureVideoCanvas(this);
canvas.setCommandListener(this);
...


class CaptureVideoCanvas extends Canvas {

// the base midlet
CaptureVideoAndImageMIDlet midlet = null;

// the video control
private static VideoControl videoControl = null;
public CaptureVideoCanvas(CaptureVideoAndImageMIDlet midlet)
throws Exception {
this.midlet = midlet;

// initialize the video control
videoControl = (VideoControl)
midlet.capturePlayer.getControl
("javax.microedition.media.control.VideoControl");

// if not present, throw error
if(videoControl == null)
throw new Exception("No Video Control for capturing!");

// init display mode to use direct video and this form
videoControl.initDisplayMode(VideoControl.USE_DIRECT_VIDEO, this);

try { // try and set the size
videoControl.setDisplayFullScreen(true);
// videoControl.setDisplaySize(getWidth() - 30, getHeight() - 30);
// videoControl.setDisplayLocation(15, 5);
}

catch(MediaException me) {
// but some devices may not support full screen mode
videoControl.setDisplayLocation(5, 5);
try {
videoControl.setDisplaySize(getWidth() - 10, getHeight() - 10);
} catch(Exception e) {}
repaint();
}

// and make the video control visible
videoControl.setVisible(true);
}
+Pie Number of slices to send: Send
Have your tried using Manager.getSupportedProtocols() and Manager.getSupportedContentTypes() to see if and how the device supports video capture?

Next, do you know the exception class? This can help determine the root of the problem.
+Pie Number of slices to send: Send
Thank you for your reply..

Yes, I am using the exception class(I am unable to compile the code if I don't ) And through that, I am able to see the alert: "createPlayer() failed.".. but there is nothing more than that.

Also, the MIDlet works fine in the emulator. It is only when I upload it to the phone, that I get this error. I am stumped and don't know how to proceed with this.. please help or guide me in an alternate direction so that I can get the solution.

Basically I want a camera that can take a snapshot and then send it to my web server where the image will be stored.
+Pie Number of slices to send: Send
I recommend you attempt to capture and display the full stack trace. There's probably a secondary message that gives better details.

An emulator is not the same thing as a real device, so things won't always work quite the same. For that matter, ROMs get updated even between different versions of the real device, so it's always good if you can test on as many systems as possible.
+Pie Number of slices to send: Send
I am sorry. I should have been more specific.

I wanted to know the actually exception class name. From the exception text, I am almost certain that it is a MediaException. But similar text could result from a SecurityException. For example, you may not be able to create the player because the midlet lacks the permission to use the camera. And there is also the possibility of unchecked exceptions. It seems simple, but it can be an important hint in solving on-device issues.

On device debugging is an option. If your device supports on device debugging you can get the full stack trace. Alternatively, Nokia offers a free on-device testing service which you can use to test your code on multiple devices. The service is called RDA and is available here:

http://forum.nokia.com/main/technical_services/testing/rda_introduction.html?cp=frontpagebanner&entry=RDA_JA

You can use the aforementioned methods on the Manager class to determine if the particular device supports video capture. In addition, you may need to add parameters to the capture URI.

You should check the supported content types for the capture protocol.

I created two similar applications a couple of years ago when I first started with J2ME. The worked fine on the S66 I was using at the time. The is available from the links below.

Photo capture and upload

http://fotomica.astrientlabs.com
http://www.hostj2me.com/appdetails.html?id=7

Video capture and upload

http://www.hostj2me.com/appdetails.html?id=99
+Pie Number of slices to send: Send
I experienced the same problem with motorola devices. The specs say it supports video capture when it really doesn't. Beware motorola, they are dodgey. If you look through the developer forums within Motorola you can confirm this.
+Pie Number of slices to send: Send
I rememberd the moto A220 (and some other moto machine)have some question
in video capture,so you can change other brand machine to try your soft.
+Pie Number of slices to send: Send
Hi, I did so many practicals on MMAPI yesterday and found out that Sony Ericsson doesn't support capturing audio, video and playing mpeg4 video as well. I am not sure about the Motorola cause I didn't get the chance of trying the programs in a motorola. But my guess would be the reason is the real device implementation.
get schwifty. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1604 times.
Similar Threads
error message occured when video played
app working weidly
problem playing video and audio
problem with mmapi...urgent
KeyPressed event in canvas using j2me
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 21:15:05.