Java Mobile Media API
   HOME

TheInfoList



OR:

The Mobile Media API (MMAPI) is an
API An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build ...
specification for the
Java ME Java Platform, Micro Edition or Java ME is a computing platform for development and deployment of porting, portable code for embedded system, embedded and mobile devices (micro-controllers, sensors, gateways, mobile phones, personal digita ...
platform
CDC The Centers for Disease Control and Prevention (CDC) is the national public health agency of the United States. It is a United States federal agency under the Department of Health and Human Services (HHS), and is headquartered in Atlanta, ...
and
CLDC The Connected Limited Device Configuration (CLDC) is a specification of a Software framework, framework for Java ME applications describing the basic set of libraries and virtual-machine features that must be present in an implementation. The CLDC i ...
devices such as
mobile phones A mobile phone or cell phone is a portable telephone that allows users to make and receive calls over a radio frequency link while moving within a designated telephone service area, unlike fixed-location phones ( landline phones). This radio ...
. 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 The Java Community Process (JCP), established in 1998, is a formal mechanism that enables interested parties to develop standard technical specifications for Java technology. Becoming a member of the JCP requires solid knowledge of the Java program ...
as JSR 135.


Programming concepts

The Multimedia Java API is based around four main types of classes in the javax.microedition.media package—the Manager
/code>, the
/code>, the
/code> and various types of
/code>. Java ME programmers wishing to use JSR 135 would first make use of the static methods of the Manager
class Class, Classes, or The Class may refer to: Common uses not otherwise categorized * Class (biology), a taxonomic rank * Class (knowledge representation), a collection of individuals or objects * Class (philosophy), an analytical concept used d ...
. Although there are other methods such as playTone, the main method used is createPlayer. This takes either a
URI Uri may refer to: Places * Canton of Uri, a canton in Switzerland * Úri, a village and commune in Hungary * Uri, Iran, a village in East Azerbaijan Province * Uri, Jammu and Kashmir, a town in India * Uri (island), off Malakula Island in V ...
or an , and a
MIME type In information and communications technology, a media type, content type or MIME type is a two-part identifier for file formats and content formats. Their purpose is comparable to filename extensions and uniform type identifiers, in that they ide ...
. In most cases, URIs are used. Common URI protocols used include: * file: * resource: (which may extract a file from within the JAR of the MIDlet, but is implementation-dependent) * http: * rtsp: * capture: (used for recording audio or video) 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 Interface or interfacing may refer to: Academic journals * ''Interface'' (journal), by the Electrochemical Society * '' Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics'' * '' Inter ...
(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: (Others may be defined in JSR 234 (
Advanced Multimedia Supplements In computing, the Advanced Multimedia Supplements (also JSR-234 or AMMS) is an API specification for the Java ME platform. Practically speaking, it is an extension to JSR 135 Mobile Media API providing new features, such as positional 3D audio p ...
). A subset of JSR 135 is defined in JSR 118 (
MIDP Mobile Information Device Profile (MIDP) is a specification published for the use of Java on embedded devices such as mobile phones and PDAs. MIDP is part of the Java Platform, Micro Edition (Java ME) framework and sits on top of Connected Lim ...
2.0).


Player lifecycle

Regardless of the protocol or media type involved, the Player moves through the same discrete states during its lifecycle. These states are listed in table below


Implementations

As with most Java ME specifications, implementations differ despite the best efforts of the specification authors to ensure consistency. Two obvious areas for differences are in the controls supported, and in the acceptable URI types in the first place. More obscure areas are whether mixing is supported; many games would like to play a MIDI music track and layer
PCM Pulse-code modulation (PCM) is a method used to Digital signal (signal processing), digitally represent analog signals. It is the standard form of digital audio in computers, compact discs, digital telephony and other digital audio application ...
sound effects on top. Another source of extreme variance is in performance. For example, if an
HTTP HTTP (Hypertext Transfer Protocol) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, wher ...
clip is requested, at what point does the clip get downloaded? The specification recognises this by providing two Player methods that can be called in advance of actually playing: realize and prefetch. Depending on the implementation, these may do some of the work of getting the clip into a playable state, thus making it quicker to actually play the clip when it is needed. Some implementations are sophisticated enough to actually stream a clip on request whilst it is being played.
Symbian OS Symbian is a discontinued mobile operating system (OS) and computing platform designed for smartphones. It was originally developed as a proprietary software OS for personal digital assistants in 1998 by the Symbian Ltd. consortium. Symbian OS ...
contains a very complete implementation of JSR 135, but even this is highly dependent on the underlying multimedia capabilities of the device, and some device manufacturers may choose not to expose the more obscure parts of Java ME such as recording. Implementation consistency is ensured by forcing all implementations to pass the Java
Technology Compatibility Kit A Technology Compatibility Kit (TCK) is a suite of tests that at least nominally checks a particular alleged implementation of a Java Specification Request (JSR) for compliance. It is one of the three required pieces for a ratified JSR in the Java C ...
(TCK). This ensures that each supported URI schema, MIME type and Control is tested, but does not test every permutation of these optional parts.


Code example

package org.wikipedia; import javax.microedition.midlet.*; import javax.microedition.media.*; public class SimplePlayer extends MIDlet


See also

*
Advanced Multimedia Supplements In computing, the Advanced Multimedia Supplements (also JSR-234 or AMMS) is an API specification for the Java ME platform. Practically speaking, it is an extension to JSR 135 Mobile Media API providing new features, such as positional 3D audio p ...


Bibliography

*


External links


JSR 135


{{DEFAULTSORT:Multimedia Java API Java device platform Java specification requests