I am developing a JavaFX video game, and I am using the MediaPlayer to play sound effect files. Sometimes, I have multiple sound files played concurrently via multiple MediaPlayers.

I have noticed via use of jvisualvm, very large number of Threads getting created that appear to be as the result of using the MediaPlayer. I for a number of reasons want to stick with the MediaPlayer, and not fall back to the AudioClip API. I have noticed as the number of active Threads grows (I have seen it go over 1,000), the performance of my video game becomes extremely slow.

Does anyone have any ideas? Is there a current issue with the MediaPlayer? Are there workarounds for this?

Thanks!

0 Answers 11

Not the answer you're looking for? Browse other questions tagged or ask your own question.