Class PlayerState
java.lang.Object
net.avadeaux.klipspringer.encoder.PlayerState
- Direct Known Subclasses:
ChannelStreamLine
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Sets status to closed and notifies all waiting.booleanisOpen()Checks if the object is not closed.voidRegisters something to be run on close.protected longGets the played amount.voidplayedMillis(long millis) Sets the played amount.protected voidwaitForPlayed(long surpass, long timeout) Waits until a certain amount 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 playedtimeout- time to wait (in milliseconds) before giving up- Throws:
WriteTimeoutException- if the timeout is reached before enough is playedAudioChannelException- if this object isclosed 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
Registers something to be run on close.
-