Java-enabled devices are rapidly evolving into full-fledged multimedia platforms. Features once available on separate devices such as cameras, radios, and audio processing are now being combined. Currently the developer must program to many different operating systems and APIs to take advantage of these advanced multimedia features—but that is about to change.
In this article, I present an overview of the Advanced Multimedia Supplements Specification (AMMS), explaining how it fits with the other APIs available on J2ME, and giving a series of code samples demonstrating some of the new features.
The AMMS builds on the Mobile Media API for J2ME (MMAPI) and therefore inherits the concepts of Players, to play both sound and video; the Manager, to create Players; and Controls, to interact with the various types of Players. AMMS adds many new Controls and also a GlobalManager, which creates new objects for the effects network and image processing functionality. It is a small-footprint API targeted
for J2ME devices running Connected Limited Device Configuration (CLDC) or Connected Device Configuration (CDC), and profiles such as the Mobile Information Device Profile (MIDP). You can download the public review draft of the specification from the Java Community Process Website.
AMMS implementations consist of five building blocks, or capabilities:
At least one of these capabilities must be supported for a device to be "AMMS-compliant." Each of these capabilities defines the programming artifacts available to the developer, some of which are mandatory and some optional ("must" and "may" are used throughout the rest of this article to indicate this). Of course, the devices running this software will vary greatly in the level of sophistication they offer—think of all the kinds of mobile phones you can buy—so the developer will have to design the program to cope with what is available. The following sections describe these five capabilities and show some of the interfaces and methods available.
Although you can take a picture with the MMAPI's VideoControl, AMMS gives you much more control over the way the picture is taken and what is done with it—think digital camera. In the
examples that follow, I have already created a Player using Manager.createPlayer("capture://video"). Here we use the CameraControl (which must be supported in this capability) to enable the audio/visual shutter feedback, check if the camera is rotated
to be in portrait mode (some advanced devices may be able to tell which way the camera is facing), and then allow the user
to choose an exposure mode and image resolution:
CameraControl camera = (CameraControl)
player.getControl("javax.microedition.media.control.camera.CameraControl");
camera.enableShutterFeedback(true);
int rotation = camera.getCameraRotation();
boolean portrait = false;
if(CameraControl.ROTATE_LEFT==rotation ||
CameraControl.ROTATE_RIGHT==rotation)
portrait = true; // And then perhaps do something different with the image
String[] exposureModes = camera.getSupportedExposureModes();
camera.setExposureMode(exposureModes[2]); // Pick one
int[] resolutions = camera.getSupportedStillResolutions();
camera.setStillResolution(1); // Pick the second pair (w, h)
We can also set the flash to the mode we want using FlashControl (which must be supported). AMMS contains a predefined list of modes, some or all of which may be available. Here we assume
that auto with red-eye reduction is in the list of modes:
Archived Discussions (Read only)