MIDlet questions - packaging and video

M

Me

Hi,

I have a MIDlet which has several classes within it. One displays an
MPEG and the other displays text. Is it possible to launch the second
class from the first?

The one which is displaying the video content works fine over HTTP but I
would like to be able to package the video with the MIDlet but am not
sure how to do this or if it is even possible.

Here's the code I am using at present:

void play(String url) {
try {
VideoControl vc;
defplayer();
// create a player instance
InputStream in = getClass().getResourceAsStream("/test-mpeg.mpg");
player = Manager.createPlayer(in, "video/mpeg");
player.addPlayerListener(this);
// realize the player
player.realize();
vc = (VideoControl)player.getControl(
"VideoControl");
if(vc != null) {
Item video = (Item)vc.initDisplayMode(
vc.USE_GUI_PRIMITIVE, null);
Form v = new Form("Playing Video...");
v.setCommandListener(this);
v.addCommand(exit);
v.append(video);
display.setCurrent(v);
}

player.prefetch();
player.start();
}
catch(Throwable t) {
reset();
}
}


Thanks in advance for any pointers,

Paul
 
D

Darryl L. Pierce

Me said:
Hi,

I have a MIDlet which has several classes within it. One displays an
MPEG and the other displays text. Is it possible to launch the second
class from the first?

Yes and no. Yes, you can instantiate and invoke the methods on the
second MIDlet class directly, but no it won't become the active MIDlet.
The Java Application Manager is the only item that can create a MIDlet
and make it truly active.
The one which is displaying the video content works fine over HTTP but I
would like to be able to package the video with the MIDlet but am not
sure how to do this or if it is even possible.

It's possible, but it will bloat your JAR file and may make the JAR file
too large for some devices to use. Your best bet would be to package
teh MPEG separately and download it via HTTP and store it in a
RecordStore instead.

To open the MPEG if it's packaged in the MIDlet suite, take a look at
the Javadoc for java.lang.Class.getResourceAsStream(String).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top