JavaFX media - yea or nay?

Hi,

I’ve just started out with java and coding games in java. I made a simple minded little game and wanted to have some background music for it. I originally thought to use an mp3 for it. But no mp3 support in the java sound api… but it seems in java 7, javafx is included. I don’t really want to deal with javafx, but the Media and Mediaplayer part of it did exactly what I wanted (load mp3, play mp3, allow volume control and mute, all very simple to use). It seemed to have good speed, and didn’t try to decompress the whole file at once or anything, etc.

However, when I tried to send the game to other people to test, I found that 2/3 of them didn’t have Java 7 installed on their desktops.

Should I continue using the JavaFX bits and hope for the best? (everyone will update? Maybe?) Or try using some other library? (I did bash my head for awhile with javazoom… got jlayer player to work, but not basicplayer. Downloaded some of the suggested libraries from here but have only tried tinysound so far.).

Thanks.

In my opinion Swing+Java2d/JavaFX are more suited for programs rather than games - you can do prototyping or tools using them, but I wouldn’t write games in them - use LWJGL or LibGDX instead. :slight_smile:

I agree with Mac70. I don’t find JavaFX really suited for games, its 3D API has some of the same design flaw than Java3D 1.5 (no more in 1.6), its memory footprint is higher than Swing and it is less reliable too. I advise you to use other libraries, the “hard” way with the sets of low level bindings like JogAmp (JOGL, JOAL and JOCL) or high level libraries (LibGDX, JMonkeyEngine, Ardor3D, Paul Lamb’s Sound Library, …). Why not using Ogg instead of MP3?

Thanks for the replies. :slight_smile: Yeah, I didn’t really like the look of JavaFX, though I do like Swing. Swing seems to do what it does very elegantly and robustly. Which isn’t gaming, but ah well. (I did find that out by about my second learning-experience game, when I realized I would have to code everything more directly myself.)

I have nothing against ogg. I naively thought mp3 would be more widely supported. I probably will end up using Ogg if I don’t go with the JavaFX media. I downloaded Paul Lamb’s sound library yesterday. I’ll try to figure it out later.

I’m going to do another newbie project first, then tackle LWJGL and 3D. If I ever do. 3D makes me dizzy. :-\