class JavaFxMediaPlayer extends java.lang.Object implements SoundPlayer
| Modifier and Type | Field and Description |
|---|---|
private ListenerList<AudioListener> |
listeners |
private javafx.scene.media.MediaPlayer |
mediaPlayer |
| Constructor and Description |
|---|
JavaFxMediaPlayer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAudioListener(AudioListener listener)
Adds a listener that will be notified of audio playback events.
|
static void |
initFxPlatform()
Initializes the JavaFX platform runtime.
|
void |
pause(AudioPlayer.Execute command,
AudioPlayer.State stateChange,
java.net.URL playingUrl)
Ask player to pause the current playing media.
|
void |
play(AudioPlayer.Execute command,
AudioPlayer.State stateChange,
java.net.URL playingUrl)
Ask player to play a new media.
|
boolean |
playing(AudioPlayer.Execute command)
Method called when a media is being played.
|
double |
position()
Returns the media playback position, in seconds.
|
double |
speed()
Returns the media playback speed ratio.
|
private final ListenerList<AudioListener> listeners
private javafx.scene.media.MediaPlayer mediaPlayer
JavaFxMediaPlayer() throws JosmRuntimeException
JosmRuntimeExceptionpublic static void initFxPlatform() throws java.lang.InterruptedException
java.lang.InterruptedException - if the current thread is interrupted while waitingpublic void play(AudioPlayer.Execute command, AudioPlayer.State stateChange, java.net.URL playingUrl) throws AudioException, java.io.IOException
SoundPlayerplay in interface SoundPlayercommand - Command containing media informationstateChange - the previous stateplayingUrl - the currently playing URL, if anyAudioException - if an audio error occursjava.io.IOException - if an I/O error occurspublic void pause(AudioPlayer.Execute command, AudioPlayer.State stateChange, java.net.URL playingUrl) throws AudioException, java.io.IOException
SoundPlayerpause in interface SoundPlayercommand - Command containing media informationstateChange - the previous stateplayingUrl - the currently playing URL, if anyAudioException - if an audio error occursjava.io.IOException - if an I/O error occurspublic boolean playing(AudioPlayer.Execute command) throws AudioException, java.io.IOException, java.lang.InterruptedException
SoundPlayerplaying in interface SoundPlayercommand - Command containing media informationtrue if the playing call was blocking, and the playback is finished when this method returnsAudioException - if an audio error occursjava.io.IOException - if an I/O error occursjava.lang.InterruptedException - if the play is interruptedpublic double position()
SoundPlayerposition in interface SoundPlayerpublic double speed()
SoundPlayerspeed in interface SoundPlayerpublic void addAudioListener(AudioListener listener)
SoundPlayeraddAudioListener in interface SoundPlayerlistener - audio listener