JavaFX MediaPlayer stops when file isn't complete

363 views Asked by At

I have a MediaPlayer and when there is a file that it is trying to play that isn't fully downloaded, it just stops. There is no indication that it has stopped either, just that there is no more audio. I have tried outputing the status of the MediaPlayer with a ChangeListener, but the status doesn't change when it stops. Any ideas on how to detect this event? I assume this is easy enough to understand without code :).

I think this also might happen if trying to play a downloading file, not sure though.

1

There are 1 answers

1
Chris Smith On BEST ANSWER

The darn MediaPlayer was being garbage collected. I was so sure it wasn't because it was a field, come to find that the entire program was being garbage collected. Stupid me.

I highly recommend, anybody else that has stopping problems with MediaPlayer, check thoroughly for garbage collection.