Skip to content

Events

The package exports three constant arrays and helper functions from src/events.ts.

ConstantSource
AUDIO_PLAYER_EVENTSPLAYER_EVENT_NAMES from @ddgutierrezc/legato-contract
MEDIA_SESSION_EVENTSMEDIA_SESSION_EVENT_NAMES from @ddgutierrezc/legato-contract
LEGATO_EVENTSLEGATO_EVENT_NAMES from @ddgutierrezc/legato-contract
ExportPurpose
addAudioPlayerListenerBound helper to audioPlayer.addListener.
addMediaSessionListenerBound helper to mediaSession.addListener.
addLegatoListenerFacade-level listener helper (Legato.addListener).
onPlaybackStateChangedShortcut for 'playback-state-changed'.
onPlaybackActiveTrackChangedShortcut for 'playback-active-track-changed'.
onPlaybackQueueChangedShortcut for 'playback-queue-changed'.
onPlaybackProgressShortcut for 'playback-progress'.
onPlaybackEndedShortcut for 'playback-ended'.
onPlaybackErrorShortcut for 'playback-error'.
onRemotePlayShortcut for 'remote-play'.
onRemotePauseShortcut for 'remote-pause'.
onRemoteNextShortcut for 'remote-next'.
onRemotePreviousShortcut for 'remote-previous'.
onRemoteSeekShortcut for 'remote-seek'.

LegatoModule (iOS and Android) declares these event names:

  • playback-state-changed
  • playback-active-track-changed
  • playback-queue-changed
  • playback-progress
  • playback-ended
  • playback-error
  • remote-play
  • remote-pause
  • remote-next
  • remote-previous
  • remote-seek
const handle = onPlaybackProgress(({ position }) => {
// update UI from projected progress
});