Hubbry Logo
search
logo

Java Mobile Media API

logo
Community Hub0 Subscribers
Write something...
Be the first to start a discussion here.
Be the first to start a discussion here.
See all
Java Mobile Media API

The Mobile Media API (MMAPI) is an API specification for the Java ME platform CDC and CLDC devices such as mobile phones. Depending on how it is implemented, the APIs allow applications to play and record sounds and video, and to capture still images. MMAPI was developed under the Java Community Process as JSR 135.

The Multimedia Java API is based around four main types of classes in the javax.microedition.media package—the Manager, the Player, the PlayerListener and various types of Control.

Java ME programmers wishing to use JSR 135 would first make use of the static methods of the Manager class. Although there are other methods such as playTone, the main method used is createPlayer. This takes either a URI or an InputStream, and a MIME type. In most cases, URIs are used. Common URI protocols used include:

The MIME type is optional, and is inferred from the data passed in if not supplied.

The createPlayer method returns an implementation of the Player interface (even if you use a capture: protocol URI). This has core methods that are applicable to all players, such as starting and stopping the media, and requesting that it loop. You can also setPlayerListener to an object implementing the PlayerListener interface, which will receive various events related to the clip (starting, stopping, media finishing, etc.)

Player classes also have a getControl method that returns an implementation of a particular Control. A Control handles any optional APIs which are not applicable to all media types. Any given Player may or may not be able to supply an implementation of any given Control.

(Typically, the Control returned is actually the Player itself, but this is not guaranteed to be the case.)

The set of controls implemented by a Player is not limited; however, some standard ones are defined in the javax.microedition.media.control package by the JSR:

See all
User Avatar
No comments yet.