Reputation: 6039
I am trying to play a list of mp3 files in JavaFx and need to pause for few seconds in between each file.This question may be subjective but I am unable to find any technique to get handle of another JavaFx MediaPlayer object at the end of currently playing mediaPlayer, which is being played inside a runnable object.
Any code sample/Algorithm will be a great help.
Upvotes: 1
Views: 1917
Reputation: 43083
Turn @SoulMan
's comment into answer:
Thanks I used the following code:
PauseTransition pt = new PauseTransition(Duration.millis(2000));
pt.play();
pt.setOnFinished(
new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if (mediaPlayer3 != null) {
mediaPlayer3.play();
}
}
});
Upvotes: 1
Reputation: 159576
Create a list of mediaPlayers, iterate through the list and for each mediaPlayer:
Upvotes: 2