Java Reference
In-Depth Information
private void viewCamera() {
try {
mPlayer = Manager.createPlayer("capture://video");
mPlayer.realize();
if ((mVidc = (VideoControl)
mPlayer.getControl("VideoControl")) != null) {
mVideoItem = (Item)
mVidc.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null);
int prefLayout = Item.LAYOUT_2 | Item.LAYOUT_LEFT |
Item.LAYOUT_NEWLINE_AFTER;
mVideoItem.setLayout(prefLayout);
mCapturedImgItem =
new ImageItem("", mQMarkImg, prefLayout, "");
StringItem lab = new StringItem("Captured image:", "");
lab.setLayout(prefLayout);
mMainScreen.append(mVideoItem);
mMainScreen.append(lab);
mMainScreen.append(mCapturedImgItem);
}
mPlayer.start();
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);
}
}
Summary
In this chapter, you learned about playing tones and sampled audio in MIDP. It utilized a subset
of the Mobile Media API (MMAPI), the Audio Building Block (ABB). It is based on Player s that
know how to render audio data and implicit protocol objects that understand how to transport
audio data to the Player . Aside from optional and flexible support for sampled audio, the ABB
also includes a tone sequence player. In MMAPI, the same familiar Player and Control API
model is used to display video and to snap pictures on a camera phone. Your MIDlets can now
benefit from the excitement of music, sampled audio, and recorded video.
Search WWH ::




Custom Search