Interface TrackPositionListener

  • All Known Subinterfaces:

    public interface TrackPositionListener

    The listener interface for receiving updates when there are significant changes to the movement through a track on a player (for example, to send time code that represents the progress of playing the track).

    Classes that are interested in being informed when unexpected movement or changes in playback state occur on a player can implement this interface, and then pass the implementing instance to TimeFinder.addTrackPositionListener(int, TrackPositionListener). Then, whenever a player loads a new track (or the set of available metadata changes, so we know more or less about tracks in any loaded player), movementChanged(TrackPositionUpdate) will be called, with the currently available position and movement information about the track being played by the player.

    James Elliott
    • Method Detail

      • movementChanged

        void movementChanged​(TrackPositionUpdate update)

        Called when there has been a significant change in movement since the last reported change.

        To reduce latency, beat announcements are delivered to listeners directly on the thread that is receiving them them from the network, so if you want to interact with user interface objects in this method, you need to use javax.swing.SwingUtilities.invokeLater(Runnable) to do so on the Event Dispatch Thread. Even if you are not interacting with user interface objects, any code in this method must finish quickly, or it will add latency for other listeners, and beat announcements will back up. If you want to perform lengthy processing of any sort, do so on another thread.

        update - the latest information about the current track position and playback state and speed, or null if we can no longer determine that information