Java Reference
In-Depth Information
Now let us consider the playerUpdate() method mandated by the
PlayerListener interface:
public void playerUpdate(Player p, String event, Object eventData) {
if (event == PlayerListener.STARTED) {
// react to the Player being started
} else if (event == PlayerListener.END_OF_MEDIA) {
// react to reaching the end of media.
} else if (event == PlayerListener.VOLUME_CHANGED) {
// react to volume being changed
}
}
In this example, three types of PlayerListener event are pro-
cessed: STARTED, END OF MEDIA and VOLUME CHANGED. For a
complete list of events supported by PlayerListener , please check its
documentation.
The full source code and JAR and JAD files for the Audio Player MIDlet
can be downloaded from this topic's website.
2.9.5 Working with Video Content
We now illustrate how to play a video with code highlights taken from
a simple Video Player MIDlet (see Figure 2.21). The architecture of the
Video Player MIDlet is very similar to that of the Audio Player. The
Figure 2.21 Video Player MIDlet running on a Nokia S60 device
Search WWH ::




Custom Search