• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Chirag Ravishankar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
}
 
Rashid Mayes
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chirag Ravishankar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rashid Mayes
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jari Kemppinen
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Shoumin Li
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ransika deSilva
Ranch Hand
Posts: 524
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic