public class MediaSyncEvent extends Object
For instance, AudioRecord.startRecording(MediaSyncEvent)
is used to start capture
only when the playback on a particular audio session is complete.
The audio session ID is retrieved from a player (e.g MediaPlayer
, AudioTrack
or
ToneGenerator
) by use of the getAudioSessionId() method.
Modifier and Type | Field and Description |
---|---|
static int |
SYNC_EVENT_NONE
No sync event specified.
|
static int |
SYNC_EVENT_PRESENTATION_COMPLETE
The corresponding action is triggered only when the presentation is completed
(meaning the media has been presented to the user) on the specified session.
|
Modifier and Type | Method and Description |
---|---|
static MediaSyncEvent |
createEvent(int eventType)
Creates a synchronization event of the sepcified type.
|
int |
getAudioSessionId()
Gets the synchronization event audio session ID.
|
int |
getType()
Gets the synchronization event type.
|
MediaSyncEvent |
setAudioSessionId(int audioSessionId)
Sets the event source audio session ID.
|
public static final int SYNC_EVENT_NONE
public static final int SYNC_EVENT_PRESENTATION_COMPLETE
public static MediaSyncEvent createEvent(int eventType) throws IllegalArgumentException
The type specifies which kind of event is monitored.
For instance, event SYNC_EVENT_PRESENTATION_COMPLETE
corresponds to the audio being
presented to the user on a particular audio session.
eventType
- the synchronization event type.IllegalArgumentException
public MediaSyncEvent setAudioSessionId(int audioSessionId) throws IllegalArgumentException
The audio session ID specifies on which audio session the synchronization event should be
monitored.
It is mandatory for certain event types (e.g. SYNC_EVENT_PRESENTATION_COMPLETE
).
For instance, the audio session ID can be retrieved via
MediaPlayer.getAudioSessionId()
when monitoring an event on a particular MediaPlayer.
audioSessionId
- the audio session ID of the event source being monitored.IllegalArgumentException
public int getType()
public int getAudioSessionId()