Java Reference
In-Depth Information
Event
Purpose
PlayerListener.DEVICE_UNAVAILABLE
The system has seized an exclusive device previously
used by the Player instance.
PlayerListener.DURATION_UPDATED
The duration of the media rendered by the Player
instance has been updated.
PlayerListener.ERROR
An error occurred processing the media.
PlayerListener.RECORD_ERROR
An error occurred recording the media.
PlayerListener.RECORD_STARTED
Recording has started.
PlayerListener.RECORD_STOPPED
Recording has stopped.
PlayerListener.SIZE_CHANGED
The size of the video being rendered has changed.
PlayerListener.STARTED
The Player instance has entered the started state.
PlayerListener.STOPPED
The Player instance has stopped rendering media in
response to a stop invocation.
PlayerListener.STOPPED_AT_TIME
The Player instance has stopped rendering media as a
result of a StopTimeControl .
PlayerListener.VOLUME_CHANGED
The volume of an audio device has changed.
Capturing Media
The ability of a growing number of Java ME devices to capture audio and video is excit-
ing, because it enables new kinds of applications, such as those that perform music
recognition, as well as different social interactions over the network. The MMAPI makes it
almost too easy to capture pictures from a built-in image sensor; you only need to open a
Player to a device's video sensor and invoke a VideoControl 's getSnapshot method. Listing 16-7
shows some pseudocode for this.
Listing 16-7. Capturing a Snapshot from an Imaging Sensor
Player player;
VideoControl vc;
Form viewer;
private void startCamera() {
try {
player = Manager.createPlayer("capture://video");
vc = (VideoControl) player.getControl("VideoControl");
player.realize();
player.prefetch();
 
Search WWH ::




Custom Search