Show us some of your code.
Sean Corfield -- (970) FOR-SEAN -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood ________________________________ From: [email protected] <[email protected]> on behalf of dimitris <[email protected]> Sent: Sunday, February 18, 2018 5:13:06 AM To: Clojure Subject: `lein run` VS `lein uberjar` behaviour Hi all, I'm experiencing something very strange with my JavaFX clojure application. What the application actually is about is not super important. What is important is the fact that I'm having a different experience when I run it via `lein run` (or in fact `lein trampoline run`), than when I run the created uberjar (via `lein uberjar`). The difference is the following: In my `-start` method I'm creating a MediaPlayer object (with a .wav resource), and setting its cycleCount to INDEFINITE, which is to say that is will keep repeating the audio file forever. That's all fine and dandy and it does work as expected when run through lein. However, the exact same code in the uberjar plays the file once and then it stops! The game carries on as usual with no exceptions or anything like that...It's only the music that stops! Now, before someone says that the MediaPlayer object has been GC'ed (as indicated by [1], [2] & [3]), I should point out that I am able to restart the music (by pressing 'M)' after it has stopped and while the program is running normally. The only thing that the KeyCode handler for M is doing calling `.play` or `.stop` on the original MediaPlayer object i created at the very start. In other words, I'm not creating any new MediaPlayer objects anywhere else other than the `-start` method. Unless I'm missing something, i shouldn't be able to restart the music if the MediaPlayer object had been GC'ed, right? I'm not sure if it plays any role but the MediaPlayer object lives inside a promise, which again is delivered in the `-start` method, right before the javaFX Scene is shown. So the controls that need access to that MediaPlayer object (like the <M> handler mentioned earlier), go through that promise to get it. I only did that because i want to have it as a global in that ns, but at the same time i can't just `def` it because the javaFX toolkit is not initialised at compile time. So it's either going to be a `promise` or a `delay`. In any case, I'm really not sure how/why this would be an issue - I'm just throwing it out there as an 'interesting' complication in case I'm wrong. Other than that, everything seems to work as expected, which is the same as with `lein run`. Feel free to drop suggestions, and/or brainstorm ideas. I could even provide the project in a zip if you would like to experience it yourself. Thanks in advance... Kind regards, Dimitris [1]: https://stackoverflow.com/questions/29870368/javafx-mediaplayer-music-stops-after-10-seconds [2]: https://stackoverflow.com/questions/6241687/mediaplayer-stop-playing-after-about-5-seconds [3]: https://stackoverflow.com/questions/30789973/javafx-mediaplayer-stops-when-file-isnt-complete Mine stops after the first cycle every time (which is between 15-16 seconds) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
