Java Reference
In-Depth Information
•
initMediaPlayer
and
initSvgPlayer
: These methods initialize the classes in the
MMAPI and the SVGAPI, respectively.
•
configViewSound
,
configViewSvg
, and
configViewVideo
: These methods perform addi-
tional configuration of the
Canvas
subclass instance that displays the media. Some
are no-ops and don't do anything in this implementation; they're provided for
illustration only.
•
playFromResource
: This method uses the media type you select to determine
whether to initialize the MMAPI or the SVGAPI, start the media playback, and
show the
Canvas
subclass instance that contains the rendered media. The player
thread's
run
method invokes this method.
•
showException
: This method shows an exception in an
Alert
.
The
showSupportedMedia
method is one of those utilities you never think you have to
write, yet you find yourself writing it again and again. It queries the MMAPI
Manager
for a
list of supported content types using its
getSupportedContentTypes
function. With the con-
tent type (e.g.,
audio/wav
), it queries the
Manager
again to determine which protocols the
implementation of the MMAPI supports (e.g., HTTP). Finally, it prints each supported
pair to the console. Listing 16-17 shows representative output from the simulator.
Listing 16-17.
Supported Media Content Types and Protocols
video/mpeg:http
video/mpeg:file
image/gif:http
image/gif:file
audio/x-wav:http
audio/x-wav:file
audio/x-wav:capture
audio/amr:http
audio/amr:file
audio/x-tone-seq:http
audio/x-tone-seq:file
audio/x-tone-seq:device
video/vnd.sun.rgb565:capture
audio/sp-midi:http
audio/sp-midi:file
audio/midi:http
audio/midi:file
audio/midi:device