public interface SoundPlayer
AudioInputStream returned by getAudioStream(). The sound is not
played directly.| Modifier and Type | Interface and Description |
|---|---|
static class |
SoundPlayer.StopReason
All possible reasons for the SoundPlayer to stop.
|
| Modifier and Type | Method and Description |
|---|---|
AudioInputStream |
getAudioStream()
Get the
AudioInputStream on which the audio is being played. |
boolean |
isRunning()
Checks if the player is currently running
|
void |
setOnStopHook(Consumer<SoundPlayer.StopReason> callback)
Sets the callback, which is called when this player ends playback.
|
void |
start()
Starts the audio output.
|
void |
stop()
Stops / cancels the audio output.
|
AudioInputStream getAudioStream()
AudioInputStream on which the audio is being played.void start()
void stop()
boolean isRunning()
void setOnStopHook(Consumer<SoundPlayer.StopReason> callback)
This method can only be called before start().
The callback is provided with a reason for the end of the playback.
callback - The method called.IllegalStateException - When the player has already been started.Copyright © 2018. All rights reserved.