Java Reference
In-Depth Information
of a player listener, which allows you to track the progress of players
being initialized, started or stopped.
The following classes or interfaces embody the above basic concepts
and are the fundamental elements of the core package javax.micro-
edition.media :
Player
Manager
Control
PlayerListener .
In fact, of these only Manager is a concrete class; the others are all
interfaces. The Control interface exists merely as a marker for the set of
(more concrete) sub-interfaces which are defined in the related package
javax.microedition.media.control . The functionality provided
by the latter is so diverse that nothing is in common, and the Control
interface, remarkably, defines no methods!
MMAPI also allows you the flexibility to define your own protocols for
downloading or obtaining the media content to be played. This involves
defining concrete implementations of the abstract DataSource class. As
this is a specialist topic beyond the scope of this chapter, we shall not
say anything further. The MMAPI specification document contains further
details.
2.9.2 Obtaining Media Content
The elements of the Mobile Media API work together as shown in
Figure 2.19 (the PlayerListener has been omitted and we shall
return to it in a later section).
A Player is typically created using the following factory method of
the javax.microedition.media.Manager class:
public static Player createPlayer(String locator)
The method's argument is a media locator, a string representing a URI
that provides details about the media content being obtained. The details
are specified using the well-documented Augmented Backus-Naur For-
mat (ABNF) syntax. Table 2.2 lists some examples. MMAPI supports both
communication and local protocols, which allow retrieval of the desired
media from its source.
There are other variants of the createPlayer() method that take
different parameters, such as an InputStream and a MIME type (for
media stored locally) or a custom DataSource implemented by the
 
Search WWH ::




Custom Search