
1
September 2003
Making the Most of the
Mobile Media API (JSR-135)
with Sony Ericsson handsets
Sony Ericsson T610/T616/T618 Sony Ericsson Z600

2
Contents
1. Purpose of this course........................................................................................................ 3
1.
Course history .....................................................................................................................3
2. 3
3.
Course conventions ............................................................................................................ 4
3.1. What you need ..................................................................................................................................... 4
4.
Scope ....................................................................................................................................4
5. Technology Overview .........................................................................................................4
6. JSR-135 Architecture and Interfaces................................................................................. 5
6.1.
Manager Methods................................................................................................................................. 6
6.1.1. Example MIDlet InfoTest.................................................................................................................. 9
6.1.2. Playing a Tone............................................................................................................................... 10
6.2.
Control Interface ................................................................................................................................. 10
6.2.1. Playing Tone Sequences ............................................................................................................... 11
6.3. The Player Interface ........................................................................................................................... 15
6.3.1.
Player States.................................................................................................................................. 15
6.3.2. Player Life Cycle............................................................................................................................ 18
6.3.3. Threading Issues ........................................................................................................................... 19
6.3.4.
Resource and Latency Issues........................................................................................................ 20
6.3.5. Player Implementation and Behaviour ........................................................................................... 21
7. Example MIDlet ..................................................................................................................23
8.
Appendix A.........................................................................................................................26
8.1.
Running JSR-135 MIDlets in the Emulator .........................................................................................26
9.
Appendix B.........................................................................................................................27
9.1.
Comparison between the Sony Ericsson JSR-135 and the MIDP 2.0 Media APIs.............................. 27
10.
Appendix C.....................................................................................................................28
10.1. Accessing Special Device Features Through iMelody ........................................................................ 28
11.
Appendix D.....................................................................................................................30
11.1. Converting Sampled Sounds to AMR Format ..................................................................................... 30
12.
Resource Information ................................................................................................... 32
12.1. Abbreviations...................................................................................................................................... 32
12.2.
Further Information and Links............................................................................................................. 32

3
Preface
1. Purpose of this course
This course is designed for Java™ 2 Platform, Micro Edition (J2ME™) programmers who wish to use Mobile Media
APIs (MMAPIs) to add multimedia capabilities to mobile applications. The MMAPIs are also known as Java
Specification Request 135, or JSR-135. These J2ME APIs manage time-dependent media, such as audio
playback, tone generation, and sound mixing.
This course’s goal is to first provide you a brief overview of these APIs. With this understanding, you next learn to
write Java applications that utilize these APIs effectively, given the mobile device’s limited resources. It is assumed
that you are familiar with J2ME’s Mobile Information Device Profile (MIDP), and how to write MIDP-based
applications (MIDlets). Sample Java MIDlet code is provided that illustrates the use of these APIs.
• Note: At the time this course was prepared, the Sony Ericsson devices that implements the JSR-135 are the
T610/T616/T618 and Z600 handsets, which for the rest of this paper will be denoted as the T610 and Z600
series.
2. Course history
Change history
2003-09-18 Version 1.0 Initial Release
This document is published by:
Sony Ericsson Mobile Communications AB
SE-221 88 Lund, Sweden
Phone:+46 46 19 40 00
Fax: +46 46 19 41 00
www.SonyEricsson.com
First edition (September 2003)
This document is published by
Sony
Ericsson Mobile Communications AB,
without any warranty. Improvements and
changes to this text necessitated by
typographical errors, inaccuracies of current
information or improvements to programs
and/or equipment, may be made by Sony
Ericsson Mobile Communications AB at
any time and without notice. Such changes
will, however, be incorporated into new
editions of this document. Any hard copies
of this document are to be regarded as
temporary reference copies only.

4
3. Course conventions
This course contains explanations of various Java classes and methods. The class and method names are
denoted by use of a mono-spaced typeface in the course text, as is source code. Example: JSR-135 consists of
three classes, Manager, Player, and Control. File names and directory path names are also denoted with this
typeface.
Descriptions of developer tool GUI elements, such as button and menus, and user’s interactions with them are
presented in bold typeface. Example: “Choose Sony Ericsson 1.1 Device from the Virtual Machine component
on the CodeWarrior Java target panel. Click
Apply
.”
3.1. What you need
To develop Java MIDlets that use JSR-135 on Sony Ericsson devices, this course requires that you have the
following SDKs installed on your Windows PC:
• Java 2 Standard Edition (J2SE) SDK 1.4.1 or later.
• Java 2 Runtime Environment (JRE) Standard Edition 1.4
• Sony Ericsson’s J2ME SDK, version 1.2 or later
• Sony Ericsson T610 and Z600 series handset and connection to host PC for program writing and debugging.
Connections are possible through a DSR-11 Enhanced RS 232 Cable, DCU-10 USB cable, infrared, or
Bluetooth interface.
The Java SDK and JRE are available from http://java.sun.com/j2se/1.4.1/download.html
.
Note: this paper assumes the use of Metrowerks CodeWarrior. However, you can use Sun ONE Studio 4; Borland
JBuilder or other Java development tools to write MIDlets.
4. Scope
This paper covers the Sony Ericsson implementation of the MMAPI interfaces described in the JSR-135
specification. Note that the Sony Ericsson JSR-135 implementation for the T610 and Z600 series handsets
supports only the audio components of this specification. While the T610 and Z600 series JSR-135 implementation
appears similar to the MIDP 2.0 Media API specification (which only supports the audio components of the
MMAPI), it is not.
• If you are familiar with the MMAPI or the Media API, you can go directly to Appendix B of this document. The
differences between these two specifications and the T610 and Z600 series JSR-135 implementation are
explained in detail there. These differences are also highlighted throughout the material in this document.
5. Technology Overview
JSR-135 APIs manage time-based data on J2ME-enabled devices. Such devices range in capabilities from high-
end set-top boxes with few constraints in power, CPU processing capacity, and memory, to low-end mobile phones
with severe constraints on power, CPU processing, and memory. JSR-135 APIs provide an abstraction layer that
enables you to manipulate and present various types of multimedia data without concern as to a J2ME device’s
hardware capabilities, the media’s format, or how the media content is delivered. For example, the APIs provide a
consistent, platform-independent scheme that describes whether the data resides on a storage device such as
hard drive or a DVD, or is obtained via the wired HTTP protocol or the WAP and SMS wireless protocols.

5
These APIs provide the following capabilities:
• Playback or recording of time-based media without regard to format – you use MIME types to describe
the media’s data format, and use Uniform Resource Identifiers (URIs) to specify where the media is located
and its delivery mechanism. Do not confuse a URI with a URL: a URI is an abstract superclass of URLs.
However, a URI can use a URL to locate media content. Content can also be stored as resources in a JAR file,
and you use the Java InputStreams to access them. JSR-135 thus presents a unified interface that you use
to obtain and process content in any format, and from any type of storage device.
•
Extensible
– new media types can be added by using plug-in style software modules known as Players
without disrupting existing media capabilities. This feature is available only to the implementation: an
application cannot add a new player or redefine the media type of an existing player. However, when the
implementation does add new media players, you use the same interface and methods to access the new
media content.
• Tone generation – you can generate a tone of a specific frequency and duration. You can also define tones
sequences that play a sophisticated melody.
• Permits a subset of functions – Designers of resource-constrained devices such as mobile phones can
choose to implement only those APIs that handle audio content.
The release of the MIDP 2.0 Media API specification in November 2002 provides an interface that is a subset of
JSR-135 APIs. While JSR-135 supports various types of content, such as audio, graphics, and video, the Media
APIs only support audio content.
• Because the MIDP 2.0 Media APIs are an exact subset of JSR-135, most programs written to use the Media
APIs will function with little or no modifications on the T610 and Z600 series. Likewise, most programs written
for the T610 and Z600 series with JSR-135 APIs will function on a MIDP 2.0 device with little or no
modifications. However, there are differences that can impact your application’s design. Consult Appendix B for
a comparison between the MIDP 2.0 Media API and the T610 and Z600 series JSR-135 implementation. Also,
the T610 and Z600 series handle only certain sound formats. Consult the section, “Manager Methods”, for the
supported audio formats.
This Developer’s course will focus on those JSR-135 classes and interfaces as implemented in Sony Ericsson
T610 and Z600 series phones.
To understand how to use JSR-135 effectively, it helps to understand how these APIs operate. This is covered in
the next section.
6. JSR-135 Architecture and Interfaces
For audio playback, JSR-135 provides several classes and interfaces. These are the Manager, Player and
Control classes. Table 1 summarizes the purpose of these classes.