Methods Summary |
---|
public static android.media.MediaSyncEvent | createEvent(int eventType)Creates a synchronization event of the sepcified type.
The type specifies which kind of event is monitored.
For instance, event {@link #SYNC_EVENT_PRESENTATION_COMPLETE} corresponds to the audio being
presented to the user on a particular audio session.
if (!isValidType(eventType)) {
throw (new IllegalArgumentException(eventType
+ "is not a valid MediaSyncEvent type."));
} else {
return new MediaSyncEvent(eventType);
}
|
public int | getAudioSessionId()Gets the synchronization event audio session ID.
return mAudioSession;
|
public int | getType()Gets the synchronization event type.
return mType;
|
private static boolean | isValidType(int type)
switch (type) {
case SYNC_EVENT_NONE:
case SYNC_EVENT_PRESENTATION_COMPLETE:
return true;
default:
return false;
}
|
public android.media.MediaSyncEvent | setAudioSessionId(int audioSessionId)Sets the event source audio session ID.
The audio session ID specifies on which audio session the synchronization event should be
monitored.
It is mandatory for certain event types (e.g. {@link #SYNC_EVENT_PRESENTATION_COMPLETE}).
For instance, the audio session ID can be retrieved via
{@link MediaPlayer#getAudioSessionId()} when monitoring an event on a particular MediaPlayer.
if (audioSessionId > 0) {
mAudioSession = audioSessionId;
} else {
throw (new IllegalArgumentException(audioSessionId + " is not a valid session ID."));
}
return this;
|