Java Reference
In-Depth Information
intermediate calls needed to
realize()
or
prefetch()
being made
implicitly. Of course, the price you pay is less fine-grained control of
exception handling.
The matching methods to stop the
Player
are
close()
,
deal-
locate()
and
stop()
. As with the
start()
method, the
close()
method encompasses the other two, so they need not be invoked on a
Player
directly. You should be aware, however, that reaching the end
of the media results in the
Player
returning to the PREFETCHED state, as
though the
stop()
method had been called. The good thing about this
is that you can then conveniently replay the media by calling
start()
again. However, you must call the
close()
method explicitly to recover
all the resources associated with realization and prefetching and to set to
NULL
all references to your
Player
so the garbage collector can dispose
of it. (You do want to dispose of it, since a closed
Player
cannot be
reused!)
In playing media content, it is often useful to work with one or more
Control
objects that allow you to control media processing. They are
obtained from an implementer of the
Controllable
interface, in most
cases a
Player
, using one of the following methods:
Control getControl(String controlType);
Control[] getControls();
A media player of a given type may support a variety of controls. The
string passed in determines the name of the interface implemented by
the returned control, which is typically one of the pre-defined types in
the
javax.microedition.media.control
subpackage:
•
FramePositioningControl
•
GUIControl
•
MetaDataControl
•
MIDIControl
•
PitchControl
•
RateControl
•
TempoControl
•
RecordControl
•
StopTimeControl
•
ToneControl
•
VideoControl
•
VolumeControl
.