javax.microedition.media
Interface PlayerListener

public interface PlayerListener

PlayerListener is the interface for receiving
asynchronous
events generated by Players. Applications may implement
this interface and register their implementations with
the addPlayerListener method in Player.

A number of standard Player events are defined
here in this interface. Event types are defined as strings
to support extensibility as different implementations
may introduce proprietary events by adding new event types.
To avoid name conflicts, proprietary events should be named
with the "reverse-domainname" convention. For example, a
company named "mycompany" should name its proprietary event
names with strings like "com.mycompany.myEvent" etc.

Applications that rely on proprietary events may
not function properly across different implementations.
In order to make the applications that use those events to behave
well in environments that don't implement them,
String.equals() should
be used to check the event.

Code fragment for catching standard events in playerUpdate()

if (eventType == PlayerListener.STARTED) {...}

Code fragment for catching proprietary events in playerUpdate()

if (eventType.equals("com.company.myEvent")) {...}

RIM Implementation Notes

RIM uses a proprietary event to notify PlayerListeners that a recording has been committed.
After calling RecordControl.commit() the application should wait until it receives this event
before attempting to do anything with the recording. The event name is

END_OF_MEDIA

Posted when a Player has reached the
end of the media.
When this event is received, the eventData parameter
will be a Long object designating the media
time when the Player reached end of media and stopped.

DURATION_UPDATED

Posted when the duration of a Player is updated.
This happens for some media types where the duration cannot
be derived ahead of time. It can only be derived after the
media is played for a period of time -- for example, when it
reaches a key frame with duration info; or when it reaches
the end of media.

When this event is received, the eventData parameter
will be a Long object designating the duration
of the media.

RECORD_ERROR

The current recording will be discarded. The application may set a
new record location or stream to start recording again. When this event
is received, the eventData parameter will be a
String object specifying the error message.

Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.Java is a trademark of Oracle America Inc. in the US and other countries.Legal