Post on 06-Apr-2018
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 1/21
Mentor:
Team:
Ankit yadav (VII sem,CSE) - 0731012707
Anshul mittal(VII sem,CSE) - 0671012707
Naveen sachdeva(VII sem,CSE) - 0681012707
i
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 2/21
Objective:
The objective of the project is to create a
simple video player in j2me,the development
platform used. This video player is highly
flexible and has been designed to run with
any protocol and format.
ii
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 3/21
Technical Details:
Platform Used:
J2ME: J2ME is a version of java that is designed for
mobile devices and embedded systems and other
resource limited devices.J2ME offers portability
across a wide range of platforms including mobile
phone,PDA’s and smart phones.It also offers a wide
range of API’s that allow the application to fulfill all
the mandatory and discretionary requirements.
MMAPI:The mobile media API(MMAPI) is an optional
package that supports multimedia application on
J2ME enabled devices.MMAPI has been designed to
run on any J2ME-based virtual machine.
Operating system and Languages:
OS: All OS which supports java.
Languages/Tools: JAVA and J2ME wireless toolkit.
iii
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 4/21
J2ME:
Java Platform, Micro Edition, or Java ME, is a Java platform designed for embedded systems (mobile
devices are one kind of such systems). Target devices
range from industrial controls to mobile phones
(especially feature phones) and set-top boxes. Java
ME was formerly known as Java 2 Platform, Micro
Edition (J2ME).
Java ME was designed by Sun Microsystems, now asubsidiary of Oracle Corporation; the platform
replaced a similar technology, PersonalJava.
Originally developed under the Java Community
Process as JSR 68, the different flavors of Java ME
have evolved in separate JSRs. Sun provides a
reference implementation of the specification, but has
tended not to provide free binary implementations of its Java ME runtime environment for mobile devices,
rather relying on third parties to provide their own.
Java ME devices implement a profile. The most common of
these are the Mobile Information Device Profile aimed
at mobile devices, such as cell phones, and the
Personal Profile aimed at consumer products and
embedded devices like set-top boxes and PDAs.Profiles are subsets of configurations, of which there
are currently two: the Connected Limited Device
Configuration (CLDC) and the Connected Device
Configuration (CDC).
iv
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 5/21
Abstract:
The Mobile Media API (MMAPI) is an optional package
that supports multimedia applications on J2ME-
enabled devices. This standard Java specification,
defined by the Java Community Process (JCP) in JSR
135, is highly flexible. It has been designed to run
with any protocol and format; for example, it doesn'tspecify that the implementation must support
particular transport protocols such as HTTP or Real-
Time Transport Protocol (RTP), or media formats
such as MP3, MIDI, or MPEG-4
This article provides a technical overview of MMAPI'sarchitecture and APIs, followed by a tutorial in which
sample code demonstrates how MMAPI can be used
to build multimedia-rich wireless Java applications. A
complete media player is developed, and steps for
testing it are provided.
v
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 6/21
Overview of MMAPI:
MMAPI has been designed to run on any J2ME-basedvirtual machine, including the CDC and CLDC VMs.
Sun's reference implementation runs on CLDC/MIDP for
Windows 2000.
The mobile media API(MMAPI) is an optional package
that supports multimedia application on J2ME enabled
devices.MMAPI has been designed to run on any J2ME- based virtual machine.
The J2ME Wireless Toolkit comes with the MMAPI.
MMAPI's developers designed into it the following
features:
Support for Tone Generation, Playback, and Recording
of Time-Based Media: The package supports any time-
based audio or video content.
Small Footprint: MMAPI works within the strict
memory limits of CLDC devices.
Protocol- and Content-Agnostic: The API is not biased
towards any specific content type or protocol.
Subsettable: Developers can limit support to particular
types of content, basic audio for example.
vi
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 7/21
Extensible: New features can be added easily without
breaking older functionality.
]More importantly, additional formats can be easily
supported, and the framework is in place for additional
controls.
Options for Implementers: The API offers features for
different purposes.
The API is designed to allow implementers to leave some
features unimplemented if they cannot be supported.
vii
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 8/21
Multimedia Processing:
There are two parts to multimedia processing:
Protocol Handling: reading data from a source such as a file
or a streaming server into a media-processing system.
Content Handling: parsing or decoding the media data and
rendering it to an output device such as an audio speaker or
video display.
To facilitate these operations, the API provides two high-level object types:
DataSource encapsulates protocol handling by hiding the
details of how the data is read from its source. This object's
utility methods enable the Player object to handle the
content.
Player reads the data from DataSource, processes it, and
renders it to an output device. This object provides methods
to control media playback, including methods for type-
specific controls to access features for specific media types.
vii
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 9/21
MMAPI specifies a third object, a factory mechanism
known as the Manager, to enable your application to createPlayers from DataSources, and also from InputStreams.
The overall architecture of MMAPI is shown in Figure :
ix
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 10/21
The Manager object provides the method createPlayer(),
which is the top-level entry point into the API. Here's an
example:
...
Player player = Manager.createPlayer(String url);
...
The url specifies the protocol and the content, using the
format <protocol>:<content location>.
The application uses the methods of the returned Player to
control the retrieval and playback of time-based media.
The player's life-cycle includes five states: UNREALIZED,
REALIZED, PREFETCHED, STARTED, and CLOSED.
Six of its methods result in state transitions:
realize()
prefetch()
start()
stop()deallocate()
close()
x
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 11/21
When a player is created, it is in the UNREALIZED state.Calling realize() moves it to the REALIZED state and
initializes the information the player needs to acquire media
resources.
Calling prefetch() moves it to PREFETCHED, establishes
network connections for streaming data, and performs other
initialization tasks. Calling start() causes a transition to the
STARTED state, where the player can process data.
When it finishes processing (reaches the end of a mediastream), it returns to the PREFETCHED state. Calling
close() moves the player to the CLOSED state.
A Player provides controls specific to the particular types
of media it processes. The application uses getControl() to
obtain a single control, or getControls() to get an array of
them. As an example, if a player for MIDI media invokesgetControl() it gets back a MIDIControl.
xi
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 12/21
The MMAPI Packages:
MMAPI comprises three packages:
javax.microedition.media provides some interfaces, an
exception, and the Manager class, which is the access point
for obtaining system-dependent resources such as Players
for multimedia processing.
javax.microedition.media.control defines the specificcontrol types that can be used with a Player:
VolumeControl, VideoControl, and others.
javax.microedition.media.protocol defines the protocols
for handling custom controls. For example, it includes the
DataSource class, which is an abstraction for media-control
handlers.
The classes, interfaces, and exceptions contained in these
packages are shown in Tables 1, 2, and 3, respectively.
xii
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 13/21
Table 1: MMAPI Classes:
Package Class Description
javax.microedition.media Manager Access point
for obtainingsystem-dependent
resources, such
as Players
for multimedia
processing
javax.microedition.media.protocol ContentDescriptor Describes
media-typecontainers
javax.microedition.media.protocol DataSource Represents anabstraction for
media protocolhandlers by
hiding the
details of howthe data is read
from a media
file or a
streamingserver;
providesmethods for the Player to
access the
input data
xii
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 14/21
Table 2: MMAPI Interfaces:
Package Interface Description
javax.microedition.media Control Used to control some media-
processing related functions;obtained from
the Controllable interface,
which is extended
by Player;
enables a Player to expose,
for example,a VolumeControl to allow
the user to set volume level
javax.microedition.media Controllable Provides an interface for
obtaining the Controlsfrom a Player or other
object
javax.microedition.media Player Used to control therendering of media data;
provides methods to manage
the Player's life-cycle
javax.microedition.media PlayerListener Receives events generated
by Players
javax.microedition.media TimeBase A continuous source of time
ticks; used to measure the progress of time, so as to
synchronize media playback by multiple players
javax.microedition.media.control FramePositionControl Controls the precise
positioning of a video frame
for a Player
javax.microedition.media.control GUIControl Should be implemented by
any control that supports aGUI component
javax.microedition.media.control MetaDataControl Used to retrieve metadata
information included inmedia streams
javax.microedition.media.control MIDIControl Provides access to MIDI
rendering and transmitting
devices
javax.microedition.media.control PitchControl Controls the playback pitchof audio output without
xiv
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 15/21
changing the playback speed
javax.microedition.media.control RateControl Controls the playback rate
of a player
javax.microedition.media.control RecordControl Controls the recoding of media from a player
javax.microedition.media.control StopTimeControl Used to specify a preset stop
time for a player
javax.microedition.media.control TempoControl Controls the tempo of asong; implemented in
players for MIDI files
javax.microedition.media.control ToneControl Enables playback of a user-
defined sequence of singletones
javax.microedition.media.control VideoControl Controls the display of
video, for example itslocation relative to thecanvas where it's displayed
javax.microedition.media.control VolumeControl Controls the volume of a
player
javax.microedition.media.protocol SourceStream Used in conjunction witha DataSource to provide the
input interface to a Player;
extends
the Controllable interface
and therefore may provide
type-specific controls
Table 3: MMAPI Exceptions:
xv
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 16/21
Package Exception Description
javax.microedition.media MediaException Reports an unexpected error in a media- processing method
Using MMAPI
xvi
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 17/21
This section demonstrates how to use the multimedia APIs,
but provides only short snippets of sample code. To see
working examples, look at the mmademo project thatcomes with the J2ME Wireless Toolkit. You'll find it in
<j2me-toolkit>/wtk20/apps/mmademo.
Tone Generation
Tone generation is a characterized by frequency and
duration. This type of media is important for games andother audio applications, especially on small devices, where
it might be the only form of multimedia capability
available.
The Manager.playTone() method generates tones. Its
implementation can be mapped to the hardware's tone
generator. You specify the note, duration, and volume.
xvi
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 18/21
The J2ME Wireless Toolkit and MMAPI:
The J2ME Wireless Toolkit 2.0 supports MMAPI. It
provides demo applications and a MediaControlSkin – anemulator capable of playing audio and video content. To
experiment with the demos, open the mmademo project and
run it. You should see a list like the one shown in Figure 2.
Figure 2: J2ME Wireless Toolkit MMAPI Demo Project
Try one of the sample MIDlets. Note that some of theapplications require an Internet connection, because they
download the content from a remote server, such
as java.sun.com.
xvi
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 19/21
Supported Formats:
MMAPI supports several audio and video formats, of
which the J2ME Wireless Toolkit supports:
• Audio: PCM and WAV
• MIDI : Type 0 (single track), Type 1 (multiple tracks),
and SP-MIDI
• Video: MPEG-1
xix
8/3/2019 vpproject
http://slidepdf.com/reader/full/vpproject 20/21
Limitations on Using MMAPI in the
Toolkit:
• An application can create multiple players, but canrealize only one MIDI player or one tone-sequence
player. Any attempt to realize a second player of either
type will throw a MediaException. In other words,
only one MIDI or tone sequence player can be in use
at any time.
• The toolkit allows any number of simultaneous playTone() calls for a single note, but
guarantees only that at least four will actually work.
The playTone() method can be called while a MIDI or
tone-sequence player is playing.
• The number of video players is limited by the size of
the heap, as specified in the -Xheapsize option of
the emulator command if you are using the command
line utilities, or from KToolBar by choosing Edit ->
Preferences -> Storage.
• The number of WAV audio players is also limited by
the heap size.
• Only one audio capture can be in use at one time.
xx