Class PlayerState

java.lang.Object
net.avadeaux.klipspringer.encoder.PlayerState
Direct Known Subclasses:
ChannelStreamLine

public class PlayerState extends Object
Record of the amount of audio data that has been played by the final recipient. This is to be able to throttle output to a maximum number of milliseconds ahead of what has been played.
  • Constructor Details

    • PlayerState

      public PlayerState()
  • Method Details

    • playedMillis

      protected long playedMillis()
      Gets the played amount.
    • playedMillis

      public void playedMillis(long millis)
      Sets the played amount.
    • waitForPlayed

      protected void waitForPlayed(long surpass, long timeout)
      Waits until a certain amount has been played. Throws exception if timeout is reached or the object is closed.
      Parameters:
      surpass - total number of milliseconds that should have been played
      timeout - time to wait (in milliseconds) before giving up
      Throws:
      WriteTimeoutException - if the timeout is reached before enough is played
      AudioChannelException - if this object is closed before or while waiting
    • close

      public void close()
      Sets status to closed and notifies all waiting.
    • isOpen

      public boolean isOpen()
      Checks if the object is not closed.
    • onClose

      public void onClose(Runnable runnable)
      Registers something to be run on close.