Java Reference
In-Depth Information
public void run() {
playFromResource();
}
private void playFromResource() {
try {
InputStream in = getClass().getResourceAsStream("/fish.mpg");
mPlayer = Manager.createPlayer(in, "video/mpeg");
mPlayer.realize();
if ((mVidc = (VideoControl)
mPlayer.getControl("VideoControl")) != null) {
mVideoItem = (Item)
mVidc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
mMainScreen.append(mVideoItem);
}
mPlayer.start();
mMainScreen.removeCommand(mPlayCommand);
mDisplay.setCurrent(mMainScreen);
}
catch (Exception e) {
showException(e);
return;
}
}
private void showException(Exception e) {
Alert a = new Alert("Exception", e.toString(), null, null);
a.setTimeout(Alert.FOREVER);
mDisplay.setCurrent(a, mMainScreen);
}
}
Snapping Pictures on a Camera Phone
An expensive executive toy in the past, cell phones with built-in cameras are now common-
place and inexpensive. MMAPI offers your application access to the camera's picture taking
ability.
The model is quite simple: the camera acts as a video player. The video displayed by this
player will be the live action that the camera is viewing. At any time after the player starts, you
can use the VideoControl to snap a still picture of the video.
Search WWH ::




Custom Search